<div dir="ltr">On Fri, Apr 12, 2013 at 4:51 PM, Karl Rupp <span dir="ltr"><<a href="mailto:rupp@mcs.anl.gov" target="_blank">rupp@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear PETScians,<br>
<br>
in order to make proper use of OpenCL functionality, we need some diagnostics for the user such that the correct device is used. Such functionality is partly also desired for CUDA, but less urgent (only addresses NVIDIA GPUs anyway).<br>

<br>
OpenCL defines platforms (think of it as SDKs from the various vendors) and devices with one type out of {CPU, GPU, ACCELERATOR}. Each platform may support multiple devices, but not necessarily all OpenCL-enabled devices on the machine. For example, the AMD SDK (platform) does not provide support for NVIDIA GPUs, but it supports Intel CPUs (x86 ftw!). Since multiple SDKs can be installed in parallel, information on the proper enumeration is quite important to use the correct device.<br>

<br>
Example: A machine equipped with an Intel CPU and an NVIDIA GPU with OpenCL SDKs from Intel, AMD, and NVIDIA installed. Within OpenCL one will 'see' the following:<br>
<br>
- Platform 0:<br>
  - Vendor: Intel<br>
  - Device 0: Intel i7 whatever (CPU)<br>
<br>
- Platform 1:<br>
  - Vendor: AMD<br>
  - Device 0: Intel i7 whatever (CPU)<br>
<br>
- Platform 2:<br>
  - Vendor NVIDIA<br>
  - Device 0: NVIDIA GTX whatever (GPU)<br>
<br>
(Maybe in different order. Matters can get worse with Xeon Phi, AMD APUs, etc.)<br>
<br>
To provide the necessary diagnostics, I suggest in line with -vec_view the flag<br>
  -opencl_view<br>
to print the OpenCL infrastructure available on the system.<br>
Is there any better naming scheme/proposal? -cuda_view and maybe some time later -threadcomm_view (-numa_view?) would follow from this choice. Note that this should be independent of external linear algebra libraries such as CUSP, ViennaCL, etc. to avoid unnecessary code duplication. However, the actual platform/device *setter* flags (e.g. pick device 0 from platform 1) need to be package-specific.<br>
</blockquote><div><br></div><div style>Do we want to have a concept, of which opencl, cuda, and threadcomm are instantiations? -device_opencl_view?</div><div style><br></div><div style>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Best regards,<br>
Karli<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>