-
Notifications
You must be signed in to change notification settings - Fork 449
OpenCL Applications
You can run OpenCL applications under BOINC.
Your application must call
int boinc_get_opencl_ids(
int argc, char** argv, int type, cl_device_id* device, cl_platform_id* platform
);
This returns the OpenCL platform and device IDs for the GPU that your app should use. Pass the argc and argv your application receives from the BOINC client. The third argument type should specify the vendor of the desired GPU and can be one of the following:
Symbol | value |
PROC_TYPE_NVIDIA_GPU | 1 |
PROC_TYPE_AMD_GPU | 2 |
PROC_TYPE_INTEL_GPU | 3 |
With BOINC Clients version 7.0.12 or later, the first 3 arguments will be ignored and all data will be taken from the init_data.xml file in the slot directory. The first 3 arguments allow this to work with older BOINC Clients. If your OpenCL app can use OpenCL-capable GPUs from any vendor, you can pass 0 for the third argument (type); if you pass a type value of 0, the type will be taken from the gpu_type field of the init_data.xml file on newer clients, but will return an error code of CL_INVALID_DEVICE_TYPE on older clients.
This function is in the library boinc/api/libboinc_opencl.a (on Macs: boinc/mac_build/build/Deployment/libboinc_opencl.a). As an alternative to linking the library, you can add the file boinc/api/libboinc_opencl.cpp to your source files when building your project application.
The following plan classes are defined in sched/sched_customize.cpp:
For app versions that run on NVIDIA GPUs using OpenCL 1.1, using at most 256MB of GPU RAM.
For app versions that run on ATI GPUs using OpenCL 1.1, using at most 256MB of GPU RAM.
You can modify sched_customize.cpp to change these parameters or add your own plan classes.