[Neuroimaging] [nipype] Detecting OpenCL devices

Anders Eklund anders.eklund at liu.se
Fri Aug 14 10:38:48 CEST 2015


Hi Satra,

I tested on another machine with an Nvidia GPU and then everything works as expected, strange.

I have wrapped one BROCCOLI function so far. Since I'm a beginner in Python, I'm not sure if I have done everything correctly (I started by copying the wrappers for FSL). Should I make a pull request for that function first, and let you look at it, before I continue with the other functions?

- Anders


________________________________
Från: Neuroimaging [neuroimaging-bounces+anders.eklund=liu.se at python.org] för Satrajit Ghosh [satra at mit.edu]
Skickat: den 13 augusti 2015 17:12
Till: Neuroimaging analysis in Python
Ämne: Re: [Neuroimaging] [nipype] Detecting OpenCL devices

hi anders,

that is a little strange. perhaps you could mimic the nipype call.

https://github.com/nipy/nipype/blob/master/nipype/interfaces/base.py#L1211

i suspect it may have something to do with either environment variables or shell=True

cheers,

satra

On Thu, Aug 13, 2015 at 8:33 AM, Anders Eklund <anders.eklund at liu.se<mailto:anders.eklund at liu.se>> wrote:
Hello,

I'm working on adding BROCCOLI functions to the nipype interface. I have managed to run a BROCCOLI function through nipype, but I discovered that all my OpenCL devices are not available (for those of you unfamiliar with BROCCOLI, it is a software for fMRI analysis, it is written in OpenCL (open computing language), which makes it possible to run the same code in parallel on CPUs, AMD GPUs and Nvidia GPUs, see https://github.com/wanderine/BROCCOLI).

I have a C function called GetOpenCL info, which prints information about all OpenCL devices on a machine. If I call it using subprocess it looks like this, detecting an Intel CPU and an AMD GPU


>>> import subprocess
>>> subprocess.call("GetOpenCLInfo")

Device info

---------------------------------------------
Platform number: 0
---------------------------------------------
Platform vendor: Intel(R) Corporation
Platform name: Intel(R) OpenCL
Platform extentions: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64
Platform profile: FULL_PROFILE
---------------------------------------------

---------------------------------------------
Device number: 0
---------------------------------------------
Device vendor: Intel(R) Corporation
Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
Hardware version: OpenCL 1.2 (Build 8)
Software version: 1.2.0.8
OpenCL C version: OpenCL C 1.2
Device extensions: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64
Global memory size in MB: 32054
Size of largest memory object in MB: 8013
Global memory cache size in KB: 256
Local memory size in KB: 32
Constant memory size in KB: 128
Parallel compute units: 8
Clock frequency in MHz: 4000
Max number of threads per block: 8192
Max number of threads in each dimension: 8192 8192 8192

---------------------------------------------
Platform number: 1
---------------------------------------------
Platform vendor: Advanced Micro Devices, Inc.
Platform name: AMD Accelerated Parallel Processing
Platform extentions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices cl_amd_hsa
Platform profile: FULL_PROFILE
---------------------------------------------

---------------------------------------------
Device number: 0
---------------------------------------------
Device vendor: Advanced Micro Devices, Inc.
Device name: Hawaii
Hardware version: OpenCL 1.2 AMD-APP (1445.5)
Software version: 1445.5 (VM)
OpenCL C version: OpenCL C 1.2
Device extensions: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_atomic_counters_32 cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_gl_event
Global memory size in MB: 3072
Size of largest memory object in MB: 1024
Global memory cache size in KB: 16
Local memory size in KB: 32
Constant memory size in KB: 64
Parallel compute units: 44
Clock frequency in MHz: 1030
Max number of threads per block: 256
Max number of threads in each dimension: 256 256 256

---------------------------------------------
Device number: 1
---------------------------------------------
Device vendor: GenuineIntel
Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
Hardware version: OpenCL 1.2 AMD-APP (1445.5)
Software version: 1445.5 (sse2,avx)
OpenCL C version: OpenCL C 1.2
Device extensions: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_device_fission cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_spir cl_amd_svm cl_khr_gl_event
Global memory size in MB: 32054
Size of largest memory object in MB: 8013
Global memory cache size in KB: 32
Local memory size in KB: 32
Constant memory size in KB: 64
Parallel compute units: 8
Clock frequency in MHz: 4001
Max number of threads per block: 1024
Max number of threads in each dimension: 1024 1024 1024







However, if I call the same function through nipype (using exactly the same GetOpenCL function), it looks like this, i.e. not detecting the AMD GPU. I'm a total beginner in Python, so can anyone tell me what the difference is between subprocess and how nipype actually calls the functions?



>>> import nipype
>>> import nipype.interfaces.broccoli as broccoli
>>> info = broccoli.GetOpenCLInfo()
>>> info.run()
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device info
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform number: 0
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform vendor: Intel(R) Corporation
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform name: Intel(R) OpenCL
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform extentions: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform profile: FULL_PROFILE
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device number: 0
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device vendor: Intel(R) Corporation
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Hardware version: OpenCL 1.2 (Build 8)
150813-14:27:24,780 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Software version: 1.2.0.8
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:OpenCL C version: OpenCL C 1.2
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device extensions: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Global memory size in MB: 32054
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Size of largest memory object in MB: 8013
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Global memory cache size in KB: 256
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Local memory size in KB: 32
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Constant memory size in KB: 128
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Parallel compute units: 8
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Clock frequency in MHz: 4000
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Max number of threads per block: 8192
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Max number of threads in each dimension: 8192 8192 8192
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform number: 1
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform vendor: Advanced Micro Devices, Inc.
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform name: AMD Accelerated Parallel Processing
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform extentions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices cl_amd_hsa
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Platform profile: FULL_PROFILE
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device number: 0
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device vendor: GenuineIntel
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Hardware version: OpenCL 1.2 AMD-APP (1445.5)
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Software version: 1445.5 (sse2,avx)
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:OpenCL C version: OpenCL C 1.2
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Device extensions: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_device_fission cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_spir cl_amd_svm cl_khr_gl_event
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Global memory size in MB: 32054
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Size of largest memory object in MB: 8013
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Global memory cache size in KB: 32
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Local memory size in KB: 32
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Constant memory size in KB: 64
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Parallel compute units: 8
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Clock frequency in MHz: 4001
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Max number of threads per block: 1024
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:Max number of threads in each dimension: 1024 1024 1024
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:
150813-14:27:24,781 interface INFO:
     stdout 2015-08-13T14:27:24.780131:
<nipype.interfaces.base.InterfaceResult object at 0x7fe4b23a8bd0>









_______________________________________________
Neuroimaging mailing list
Neuroimaging at python.org<mailto:Neuroimaging at python.org>
https://mail.python.org/mailman/listinfo/neuroimaging


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20150814/c5380a68/attachment.html>


More information about the Neuroimaging mailing list