<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Satra,<br>
<br>
I tested on another machine with an Nvidia GPU and then everything works as expected, strange.<br>
<br>
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?<br>
<br>
- Anders<br>
<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF525472"><font face="Tahoma" color="#000000" size="2"><b>Från:</b> Neuroimaging [neuroimaging-bounces+anders.eklund=liu.se@python.org] för Satrajit Ghosh [satra@mit.edu]<br>
<b>Skickat:</b> den 13 augusti 2015 17:12<br>
<b>Till:</b> Neuroimaging analysis in Python<br>
<b>Ämne:</b> Re: [Neuroimaging] [nipype] Detecting OpenCL devices<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">hi anders,
<div><br>
</div>
<div>that is a little strange. perhaps you could mimic the nipype call.</div>
<div><br>
</div>
<div><a href="https://github.com/nipy/nipype/blob/master/nipype/interfaces/base.py#L1211" target="_blank">https://github.com/nipy/nipype/blob/master/nipype/interfaces/base.py#L1211</a><br>
</div>
<div><br>
</div>
<div>i suspect it may have something to do with either environment variables or shell=True</div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">cheers,<br>
<br>
satra<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="gmail_quote">On Thu, Aug 13, 2015 at 8:33 AM, Anders Eklund <span dir="ltr">
<<a href="mailto:anders.eklund@liu.se" target="_blank">anders.eklund@liu.se</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hello,<br>
<br>
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
<a href="https://github.com/wanderine/BROCCOLI" target="_blank">https://github.com/wanderine/BROCCOLI</a>).<br>
<br>
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<br>
<br>
<br>
>>> import subprocess<br>
>>> subprocess.call("GetOpenCLInfo")<br>
<br>
Device info <br>
 <br>
---------------------------------------------<br>
Platform number: 0<br>
---------------------------------------------<br>
Platform vendor: Intel(R) Corporation<br>
Platform name: Intel(R) OpenCL<br>
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 <br>
Platform profile: FULL_PROFILE<br>
---------------------------------------------<br>
<br>
---------------------------------------------<br>
Device number: 0<br>
---------------------------------------------<br>
Device vendor: Intel(R) Corporation<br>
Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz<br>
Hardware version: OpenCL 1.2 (Build 8)<br>
Software version: 1.2.0.8<br>
OpenCL C version: OpenCL C 1.2 <br>
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 <br>
Global memory size in MB: 32054<br>
Size of largest memory object in MB: 8013<br>
Global memory cache size in KB: 256<br>
Local memory size in KB: 32<br>
Constant memory size in KB: 128<br>
Parallel compute units: 8<br>
Clock frequency in MHz: 4000<br>
Max number of threads per block: 8192<br>
Max number of threads in each dimension: 8192 8192 8192<br>
<br>
---------------------------------------------<br>
Platform number: 1<br>
---------------------------------------------<br>
Platform vendor: Advanced Micro Devices, Inc.<br>
Platform name: AMD Accelerated Parallel Processing<br>
Platform extentions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices cl_amd_hsa
<br>
Platform profile: FULL_PROFILE<br>
---------------------------------------------<br>
<br>
---------------------------------------------<br>
Device number: 0<br>
---------------------------------------------<br>
Device vendor: Advanced Micro Devices, Inc.<br>
Device name: Hawaii<br>
Hardware version: OpenCL 1.2 AMD-APP (1445.5)<br>
Software version: 1445.5 (VM)<br>
OpenCL C version: OpenCL C 1.2 <br>
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
<br>
Global memory size in MB: 3072<br>
Size of largest memory object in MB: 1024<br>
Global memory cache size in KB: 16<br>
Local memory size in KB: 32<br>
Constant memory size in KB: 64<br>
Parallel compute units: 44<br>
Clock frequency in MHz: 1030<br>
Max number of threads per block: 256<br>
Max number of threads in each dimension: 256 256 256<br>
<br>
---------------------------------------------<br>
Device number: 1<br>
---------------------------------------------<br>
Device vendor: GenuineIntel<br>
Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz<br>
Hardware version: OpenCL 1.2 AMD-APP (1445.5)<br>
Software version: 1445.5 (sse2,avx)<br>
OpenCL C version: OpenCL C 1.2 <br>
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
<br>
Global memory size in MB: 32054<br>
Size of largest memory object in MB: 8013<br>
Global memory cache size in KB: 32<br>
Local memory size in KB: 32<br>
Constant memory size in KB: 64<br>
Parallel compute units: 8<br>
Clock frequency in MHz: 4001<br>
Max number of threads per block: 1024<br>
Max number of threads in each dimension: 1024 1024 1024<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
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?<br>
<br>
<br>
<br>
>>> import nipype<br>
>>> import nipype.interfaces.broccoli as broccoli<br>
>>> info = broccoli.GetOpenCLInfo()<br>
>>> info.run()<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Device info <br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131: <br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform number: 0<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform vendor: Intel(R) Corporation<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform name: Intel(R) OpenCL<br>
150813-14:27:24,780 interface INFO:<br>
     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 <br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform profile: FULL_PROFILE<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Device number: 0<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Device vendor: Intel(R) Corporation<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Hardware version: OpenCL 1.2 (Build 8)<br>
150813-14:27:24,780 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Software version: 1.2.0.8<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:OpenCL C version: OpenCL C 1.2 <br>
150813-14:27:24,781 interface INFO:<br>
     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 <br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Global memory size in MB: 32054<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Size of largest memory object in MB: 8013<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Global memory cache size in KB: 256<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Local memory size in KB: 32<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Constant memory size in KB: 128<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Parallel compute units: 8<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Clock frequency in MHz: 4000<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Max number of threads per block: 8192<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Max number of threads in each dimension: 8192 8192 8192<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform number: 1<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform vendor: Advanced Micro Devices, Inc.<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform name: AMD Accelerated Parallel Processing<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform extentions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices cl_amd_hsa
<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Platform profile: FULL_PROFILE<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Device number: 0<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:---------------------------------------------<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Device vendor: GenuineIntel<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Device name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Hardware version: OpenCL 1.2 AMD-APP (1445.5)<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Software version: 1445.5 (sse2,avx)<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:OpenCL C version: OpenCL C 1.2 <br>
150813-14:27:24,781 interface INFO:<br>
     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
<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Global memory size in MB: 32054<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Size of largest memory object in MB: 8013<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Global memory cache size in KB: 32<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Local memory size in KB: 32<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Constant memory size in KB: 64<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Parallel compute units: 8<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Clock frequency in MHz: 4001<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Max number of threads per block: 1024<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:Max number of threads in each dimension: 1024 1024 1024<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131:<br>
150813-14:27:24,781 interface INFO:<br>
     stdout 2015-08-13T14:27:24.780131: <br>
<nipype.interfaces.base.InterfaceResult object at 0x7fe4b23a8bd0><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</div>
<br>
_______________________________________________<br>
Neuroimaging mailing list<br>
<a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/neuroimaging</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>