I am new to Sycl and have previously implemented a project with OpenCL. After a few hours I managed to compile the examples and get them running.

Can someone provide an example cmakelist.txt so I can see how to integrate sycl into the clion build process?

There has been a discussion about CMake integration with SYCL on the CMake project but as yet it has not quite been able to progress but you might want to add your support to such an effort. https ://gitlab.kitware.com/cmake/cmake/-/issues/21711
In the meantime there are some useful files here https ://github.com/KhronosGroup/SYCL-CTS/tree/SYCL-1.2.1/master/cmake

If you are using DPC++, you may want to use

SET(CMAKE_CXX_FLAGS "-fsycl -fsycl-unnamed-lambda")

And this should be what you need.

However if you want to use DPC++ with the CUDA support you will need to use

SET(CMAKE_CXX_FLAGS "-fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice  -fsycl-unnamed-lambda -Wno-unknown-cuda-version")

Alternatively you could use the script

source /opt/intel/oneapi/setvars.sh 

and then launch CLion from that same shell so all the required environment variables are passed to CLion and it’s subprocesses, you just have to select the DPC++ compiler in your toolchain.

Turns out there was a bug in CLion that was preventing the compiler detection if you’re using clang++ (dpc++), we got it fixed in the latest EAP release. You need you enable the fix by setting cidr.compiler.clang.fsycl=true in the CLion’s registry.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.