wiki:OpenclApps

Version 5 (modified by charlief, 11 years ago) (diff)

--

OpenCL Applications

You can run OpenCL applications under BOINC.

Application requirements

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_GPU1
PROC_TYPE_AMD_GPU2
PROC_TYPE_INTEL_GPU3

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.

Scheduler requirements

The following plan classes are defined in sched/sched_customize.cpp:

opencl_nvidia_101
For app versions that run on NVIDIA GPUs using OpenCL 1.1, using at most 256MB of GPU RAM.
opencl_ati_101
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.