On Apr 16, 2013, at 3:26 AM, Richard Haselgrove wrote:
> Typo alert. "The ... file that the BOINC client writes to each slot" (second 
> paragraph) is of course init_data.xml, and I suspect the sample file contents 
> likewise. Calling it app_info.xml may set people's minds running down the 
> wrong path.

And I made the same typo again in the 4th paragraph.  For clarity, here is a 
corrected version:

Hello Raistmer,

I am sorry if I have not been clear enough in my responses.  We have _already_ 
done what you are requesting, but not the way you suggest.  Doing it the way 
you suggest would be incompatible with existing applications, servers and older 
versions of BOINC and so would break older code.  Everything we have done is 
fully backward compatible.

Under recent versions of BOINC, we have added more values to the init_data.xml 
file that the BOINC client writes to each slot.  Let us use as an example the 
case we have been discussing in the SETI forum, where the user has 2 ATI GPUs.  
The first GPU (ATI GPU 0) is capable of (and recognized by) CAL but not OpenCL. 
 The second ATI GPU (GPU 1) is recognized by and capable of both CAL and OpenCL.

Thus, my test version of BOINC _correctly_ reports that ATI GPU 1 is the only 
OpenCL capable ATI GPU:
> CAL: ATI GPU 0: ATI Radeon HD 2600 (RV630) (CAL version 1.4.1734, 1024MB, 
> 992MB available, 348 GFLOPS peak)
> CAL: ATI GPU 1: ATI Radeon HD 4600 series (R730) (CAL version 1.4.1734, 
> 1024MB, 992MB available, 960 GFLOPS peak)
> OpenCL: AMD/ATI GPU 1: ATI Radeon HD 4600 series (R730) (driver version CAL 
> 1.4.1734, device version OpenCL 1.0 AMD-APP (937.2), 1024MB, 992MB available, 
> 960 GFLOPS peak)

His app_info.xml file will now contain the following values specifying that the 
application should use the first ATI GPU, which has ATI gpu_device_num 1 and 
which also has ATI gpu_opencl_dev_index of 0:
<gpu_type>ATI</gpu_type>
<gpu_device_num>1</gpu_device_num>
<gpu_opencl_dev_index>0</gpu_opencl_dev_index>

Older versions of init_data.xml don't have gpu_opencl_dev_index field.  Still 
older versions of init_data.xml don't have the gpu_device_num or the gpu_type 
field.

So those versions of BOINC passed the gpu_device_num to the application in the 
command line.  If the value of gpu_device_num was 1, they would pass "--device 
1" in the command line.

For backward compatibility, BOINC _still_ passes the gpu_device_num to the 
application in the command line; in our example case it _still_ passes 
"--device 1" in the command line. To do anything different would break 
compatibility with older applications!

Around August 2011, we realized that passing the device number is not 
sufficient if a user had both ATI and NVIDIA GPUs on the same computer, so we 
created the API:
  int boinc_get_opencl_ids(cl_device_id* device, cl_platform_id* platform);
which gets the GPU vendor and device number from the init_data.xml file.

In January 2012, we discovered that on Macs, Apple's OpenCL does not support 
some NVIDIA GPUs which CUDA does support, so we added the gpu_opencl_dev_index 
field.  This allowed the boinc_get_opencl_ids() API to handle these correctly.  
OpenCL project applications did not need to worry about this, as long as they 
were linked with a current version of boinc_get_opencl_ids().  When used with 
older versions of BOINC which do not provide the gpu_opencl_dev_index field, 
boinc_get_opencl_ids() reverts to using only gpu_device_num to be as backward 
compatible as possible.

But in December 2012, we realized that boinc_get_opencl_ids() was not 
compatible with very old clients which did not provide the gpu_device_num or 
the gpu_type field.  So we deprecated the old boinc_get_opencl_ids() API and 
added a new version which takes 5 arguments:
 int boinc_get_opencl_ids(int argc, char** argv, int type, cl_device_id* 
device, cl_platform_id* platform);

Passing in the same argv and argc which were passed to the application allows 
this function to use the value of --device from the command line for 
compatibility with very old BOINC clients which did not have the gpu_device_num 
field in the init_data.xml file.  This gives us even better backward 
compatibility than we had before.  And allowing the project application to pass 
in the type (NVIDIA, ATI or Intel) allows it to work with older BOINC clients 
which did not have the gpu_type in the init_data.xml file.

This newest boinc_get_opencl_ids() API has an added feature.  If your OpenCL 
application can run on any vendor's GPU, then you can create a plan class 
telling BOINC that the vendor (gpu_type) does not matter.  On any version of 
BOINC new enough to put the gpu_type in the init_data.xml file, that one 
application will run on whichever GPU is assigned by BOINC; you will no longer 
need separate copies of the same OpenCL application for each GPU vendor.

I looked at the source code for your OpenCL and Brook anonymous platform SETI 
Astropulse applications.  I see they do not examine the --device argument 
directly, but instead call the older version of boinc_get_opencl_ids() with 2 
arguments.  I strongly recommend you update to the newer, 5 argument version to 
have backward compatibility with even older versions of the BOINC client.

A release of the BOINC client in the near future will handle most situations 
where one or more ATI/AMD GPUs support CAL but not OpenCL.  Both the _existing_ 
2-argument and the _existing_ 5-argument versions of boinc_get_opencl_ids() 
will take advantage of the improved GPU detection logic in this new BOINC 
client.

I have one more suggestion.  In your OpenCL anonymous platform SETI Astropulse 
application, the application writes "BOINC assigns device %d" with the value of 
BOINCs_device, which is the value of the gpu_opencl_dev_index.  This is 
confusing to users, who have seen the GPUs identified by their physical device 
number gpu_device_num in the Event Log.  It would be better if the application 
would display the physical device number, and use the gpu_opencl_dev_index only 
internally.  You can get the value of gpu_device_num either from the --device 
command-line argument, or from the gpu_device_num field of the init_data struct.

Cheers,
--Charlie
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to