AddCACL Module

OpenCL specific CMake utilities are provided by the source/cl/cmake/AddCACL.cmake module, exposing utilities in a similar way to the AddCA Module, and in some cases working on top of it. For example, the add_ca_cl_executable() function calls add_ca_executable() before adding OpenCL specific compiler definitions to the target.

If we’re testing through the ICD loader then environment variables that may be needed for testing are also added to the target properties here. add_ca_cl_check() sets the OCL_ICD_FILENAMES environment var to the name of our OpenCL library, and the OCL_ICD_VENDORS environment variable to set to some arbitrary path to prevent system installed drivers from being found.

To use this module with add_ca_example_subdirectory():

include(${ComputeAorta_SOURCE_DIR}/source/cl/cmake/AddCACL.cmake)
CA_CL_COMPILE_DEFINITIONS

A CMake variable containing list of compile definitions which provides a single place for setting OpenCL specific pre-processor flags such as CA_TARGET_OPENCL_VERSION.

A CMake command which specifies the required link libraries for building libraries or executables which require OpenCL entry points. Either CL or OpenCL is linked automatically baased on the CL_CA_ENABLE_ICD_LOADER option.

Arguments:
  • target Library or executable target to link OpenCL into.

add_ca_cl_executable

A CMake command which acts acts exactly like add_ca_executable() except it selectively links against one of the CL or OpenCL targets depending on the value of the CA_CL_ENABLE_ICD_LOADER option.

Arguments:
  • target Name of the executable target to add.

add_ca_cl_library

A CMake command which acts exactly like add_ca_library() except it selectively links against one of the CL or OpenCL targets depending on the value of CA_CL_ENABLE_ICD_LOADER option.

Arguments:
  • target Name of the library target to add.

add_ca_cl_icd_file

A CMake command which generates two .icd files, the first is used during development and points to an OpenCL library which exists in the build directory, and the second is installed and points to the installed path of the OpenCL library.

Arguments:
  • target The CMake target of the OpenCL library.

Keyword Arguments:
  • NAME The name, without the .icd extension, for the output file. Defaults to ${target}.

add_ca_cl_check

A CMake command which acts exactly like add_ca_check() except it also sets environment variables to specify the use of the CL target library. If CA_CL_ENABLE_ICD_LOADER is ON the OCL_ICD_FILENAMES environment variable is set when executing the check, and the OCL_ICD_VENDORS environment variable to set to some arbitrary path (that does not need to exist) to prevent system installed drivers from being found. If CA_CL_ENABLE_INTERCEPT_LAYER is ON the CLI_OpenCLFileName environment variable is set.

Note

If CA_ENABLE_TESTS is set to OFF this function does nothing.

Arguments:
  • name A unique name for the check, should include the name of the target being checked.

Keyword Arguments:
  • NOGLOBALCL - Flag to specify that the new target should not be added to the CL-wide check target.