Problem with host_task (old interop_task) to embed a CUDA kernel within SYCL code

Hi all,

I have a linux box with oneAPI 2023.0 and the latest CUDA plugin from Codeplay. I have a problem compiling the examples/cuda_interop project from this repo: https://github.com/codeplaysoftware/SYCL-For-CUDA-Examples. The simpler project example/vector_addition compiles and runs well.

The output of sycl-ls:

[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.15.12.0.01_081451]
[opencl:cpu:1] Intel(R) OpenCL, Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz 3.0 [2022.15.12.0.01_081451]
[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) UHD Graphics 630 [0x3e98] 3.0 [21.33.20678]
[ext_oneapi_level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) UHD Graphics 630 [0x3e98] 1.1 [1.1.20678]
[ext_oneapi_cuda:gpu:0] NVIDIA CUDA BACKEND, NVIDIA GeForce RTX 2060 0.0 [CUDA 11.4]

The compilation error:

coffeelake:~/oneapi/SYCL-For-CUDA-Examples/examples/cuda_interop>make
/opt/intel/oneapi/compiler/2023.0.0/linux/bin-llvm/clang++ -std=c++17 --cuda-gpu-arch=sm_60 -I/opt/intel/oneapi/compiler/2023.0.0/linux/bin-llvm/../include/ -I/opt/intel/oneapi/compiler/2023.0.0/linux/bin-llvm/../include/sycl/ -Wno-linker-warnings -g vec_add.cu -L/opt/intel/oneapi/compiler/2023.0.0/linux/bin-llvm/../lib -lOpenCL -lsycl -L/usr/local/cuda//lib64 -lcudart -o vec_add.exe
**<built-in>:1:10:** **fatal error:** **'__clang_cuda_runtime_wrapper.h' file not found**
#include "__clang_cuda_runtime_wrapper.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated when compiling for sm_60.
make: *** [Makefile:43: vec_add.exe] Error 1

Thanks a lot in advance for any help you can provide!

Rafa.

Hi Rafa,
Is it possible to confirm if it is just this example that fails to build besides the vector_addition example?
I have passed this issue onto second support who are closer to the development of the examples.
Thanks
Illya

It seems there is a bug with this example. The file is not included with the oneAPI toolkit. It looks like it should be.
ATM is is shipped with dpct, not the compiler. We have noted the issue to be resolved for the next oneAPI release.
Sorry for any inconvenience.

Ok, I’ve waited for the next oneAPI release (2023.1.0), installed it as well as the latest oneapi-for-nvidia-gpus-2023.1.0-cuda-12.0-linux.sh available here (thanks for swiftly providing the updated version).

However the problem is still there:

alder:~/oneAPI/SYCL-For-CUDA-Examples/examples/cuda_interop>make
/opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm/clang++ -std=c++17 --cuda-gpu-arch=sm_80 -I/opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm/../include/ -I/opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm/../include/sycl/ -Wno-linker-warnings  -g vec_add.cu -L/opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm/../lib -lOpenCL -lsycl -L/usr/local/cuda//lib64 -lcudart -o vec_add.exe
clang++: warning: CUDA version is newer than the latest partially supported version 11.8 [-Wunknown-cuda-version]
<built-in>:1:10: fatal error: '__clang_cuda_runtime_wrapper.h' file not found
#include "__clang_cuda_runtime_wrapper.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated when compiling for sm_80.
make: *** [Makefile:39: vec_add.exe] Error 1

alder:~/oneAPI/SYCL-For-CUDA-Examples/examples/cuda_interop>sycl-ls 
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2023.15.3.0.20_160000]
[opencl:cpu:1] Intel(R) OpenCL, 12th Gen Intel(R) Core(TM) i9-12900K 3.0 [2023.15.3.0.20_160000]
[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) UHD Graphics 770 [0x4680] 3.0 [22.24.23453]
[ext_oneapi_level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) UHD Graphics 770 [0x4680] 1.3 [1.3.23453]
[ext_oneapi_cuda:gpu:0] NVIDIA CUDA BACKEND, NVIDIA GeForce RTX 3090 0.0 [CUDA 12.0]

Am I doing something wrong? Thank you very much for your help!

Rafa.

Unfortunately, these headers are still only shipped with the dpcpp-ct tool and not with the main compiler. Apologies for the inconvenience. However, since both are part of the oneAPI Base Toolkit, there is a workaround possible. The main compiler can be pointed to the other installation of header files with the flag:

-resource-dir=/opt/intel/oneapi/dpcpp-ct/2023.1.0/lib/clang/16

as opposed to the default path where the compiler looks, which is

$ clang++ -print-resource-dir
/opt/intel/oneapi/compiler/2023.1.0/linux/lib/clang/16

The flag may be added in the Makefile variable CXXFLAGS.