Build applications with oneDAL

See Get Started Guides for Windows* and Linux* for instruction on how to build applications for C++. This section contains instructions for building applications with oneDAL for SYCL*.

Applications on Windows* OS

  1. Download and install Intel® oneAPI Base Toolkit.

  2. In Microsoft Visual Studio* Integrated Development Environment (IDE), open or create a C++ project for your oneDAL application to build.

  3. In project properties:

    • Set Intel® oneAPI DPC++/C++ Compiler platform toolset:

      In General configuration properties, choose Platform Toolset property
    • Add oneDAL includes folder to Additional Include Directories.

    • Add folders with oneDAL and oneTBB libraries to Library Directories:

      In VC++ Directories, choose Library Directories property
    • Add oneDAL and OpenCL libraries to Additional Dependencies:

      In Linker configuration properties, choose Input.
  4. Add the appropriate libraries to your project based on oneDAL threading mode and linking method:

    oneDAL libraries for Windows

    Single-threaded (non-threaded)

    Multi-threaded (internally threaded)

    Static linking

    onedal_core.lib,
    onedal_sequential.lib
    onedal_core.lib,
    onedal_thread.lib

    Dynamic linking

    onedal_core_dll.lib

    onedal_core_dll.lib

    You may also add debug versions of the libraries based on the threading mode and linking method:

    oneDAL debug libraries for Windows

    Single-threaded (non-threaded)

    Multi-threaded (internally threaded)

    Static linking

    onedal_cored.lib,
    onedald.lib,
    onedal_dpcd.lib,
    onedal_sycld.lib,
    onedal_sequentiald.lib
    onedal_cored.lib,
    onedald.lib,
    onedal_dpcd.lib,
    onedal_sycld.lib,
    onedal_threadd.lib

    Dynamic linking

    onedal_cored_dll.lib (onedal_cored_dll.1.lib),
    onedald_dll.lib (onedald_dll.1.lib),
    onedal_dpcd_dll.lib (onedal_dpcd_dll.1.lib),
    onedald.1.dll,
    onedal_cored.1.dll,
    onedal_dpcd.1.dll,
    onedal_sequentiald.1.dll
    onedal_cored_dll.lib (onedal_cored_dll.1.lib),
    onedald_dll.lib (onedald_dll.1.lib),
    onedal_dpcd_dll.lib (onedal_dpcd_dll.1.lib),
    onedald.1.dll,
    onedal_cored.1.dll,
    onedal_dpcd.1.dll,
    onedal_threadd.1.dll

Applications on Linux* OS

  1. Download and install Intel® oneAPI Base Toolkit.

  2. Set environment variables by calling <install dir>/setvars.sh.

  3. Build your application with clang++:

    • Add fsycl option to the command:

      -fsycl
      
    • Add ONEAPI_DAAL_USE_MKL_GPU_GEMM definition:

      -DONEAPI_DAAL_USE_MKL_GPU_GEMM
      
    • Add oneDAL includes folder:

      -I<install dir>/daal/latest/include
      
    • Add oneDAL libraries. Choose the appropriate oneDAL libraries based on oneDAL threading mode and linking method:

      oneDAL libraries for Linux

      Single-threaded (non-threaded)

      Multi-threaded (internally threaded)

      Static linking

      libonedal_core.a,
      libonedal_sequential.a
      libonedal_core.a,
      libonedal_thread.a

      Dynamic linking

      libonedal_core.so,
      libonedal_sequential.so
      libonedal_core.so,
      libonedal_thread.so
    • Add an additional oneDAL library:

      -foffload-static-lib=<install dir>/daal/latest/libintel64/libonedal_sycl.a
      

Examples

Dynamic linking, Multi-threaded oneDAL:

clang++ -fsycl -DONEAPI_DAAL_USE_MKL_GPU_GEMM my_first_daal_program.cpp -Wl,
--start-group -L<install dir>/daal/latest/lib/intel64 -lonedal_core -lonedal_thread.so -lpthread -ldl -lOpenCL -L<install dir>/tbb/latest/lib/intel64/gcc4.8 -ltbb -ltbbmalloc -foffload-static-lib=<install dir>/daal/latest/lib/intel64/libonedal_sycl.a -Wl,--end-group

Static linking, Single-threaded oneDAL:

clang++ -fsycl -DONEAPI_DAAL_USE_MKL_GPU_GEMM my_first_daal_program.cpp -Wl,
--start-group <install dir>/daal/latest/lib/intel64/libonedal_core.a <install dir>/daal/latest/lib/intel64/libonedal_sequential.a -lpthread -ldl -lOpenCL -foffload-static-lib=<install dir>/daal/latest/lib/intel64/libonedal_sycl.a -Wl,--end-group