UCL / openqcd-oneapi

GNU General Public License v2.0
0 stars 0 forks source link

Compile generated SYCL code with `dpcpp` #16

Closed tkoskela closed 2 years ago

tkoskela commented 2 years ago

We have generated SYCL code in UCL/openqcd-oneapi#20. The next step is compiling.

tkoskela commented 2 years ago

How to compile on csd3

tkoskela commented 2 years ago

Compilation fails on csd3 with


"/usr/bin/ld" --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o dw_cuda.dp.o /lib/../lib64/crt1.o /lib/../lib64/crti.o /usr/local/software/master/gcc/8/lib/gcc/x86_64-pc-linux-gnu/8.4.0/crtbegin.o -L/usr/local/software/intel/oneapi/2022.1/compiler/2022.0.2/linux/bin-llvm/../compiler/lib/intel64_lin -L/usr/local/software/intel/oneapi/2022.1/compiler/2022.0.2/linux/bin-llvm/../lib -L/usr/local/software/intel/oneapi/2022.1/compiler/2022.0.2/linux/bin-llvm/../compiler/lib/intel64_lin -L/usr/local/software/master/gcc/8/lib/gcc/x86_64-pc-linux-gnu/8.4.0 -L/usr/local/software/master/gcc/8/lib/gcc/x86_64-pc-linux-gnu/8.4.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/local/software/master/gcc/8/lib/gcc/x86_64-pc-linux-gnu/8.4.0/../../.. -L/usr/local/software/intel/oneapi/2022.1/compiler/2022.0.2/linux/bin-llvm/../lib -L/lib -L/usr/lib -L/usr/local/software/intel/oneapi/2022.1/vpl/2022.0.0/lib -L/usr/local/software/intel/oneapi/2022.1/tbb/2021.5.1/env/../lib/intel64/gcc4.8 -L/usr/local/software/intel/oneapi/2022.1/mpi/2021.5.1//libfabric/lib -L/usr/local/software/intel/oneapi/2022.1/mpi/2021.5.1//lib/release -L/usr/local/software/intel/oneapi/2022.1/mpi/2021.5.1//lib -L/usr/local/software/intel/oneapi/2022.1/mkl/2022.0.2/lib/intel64 -L/usr/local/software/intel/oneapi/2022.1/ipp/2021.5.2/lib/intel64 -L/usr/local/software/intel/oneapi/2022.1/ippcp/2021.5.1/lib/intel64 -L/usr/local/software/intel/oneapi/2022.1/ipp/2021.5.2/lib/intel64 -L/usr/local/software/intel/oneapi/2022.1/dnnl/2022.0.2/cpu_dpcpp_gpu_dpcpp/lib -L/usr/local/software/intel/oneapi/2022.1/dal/2021.5.3/lib/intel64 -L/usr/local/software/intel/oneapi/2022.1/compiler/2022.0.2/linux/compiler/lib/intel64_lin -L/usr/local/software/intel/oneapi/2022.1/compiler/2022.0.2/linux/lib -L/usr/local/software/intel/oneapi/2022.1/clck/2021.5.0/lib/intel64 -L/usr/local/software/intel/oneapi/2022.1/ccl/2021.5.1/lib/cpu_gpu_dpcpp -L/usr/local/software/master/gcc/8/lib64 -L/usr/local/software/master/gcc/8/lib /tmp/dw_cuda-edb674.o /tmp/dw_cuda-bc67aa.o -Bstatic -lsvml -Bdynamic -Bstatic -lirng -Bdynamic -lstdc++ -Bstatic -limf -Bdynamic -lm -lgcc_s -lgcc -Bstatic -lirc -Bdynamic -ldl -lgcc_s -lgcc -lsycl -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic /usr/local/software/master/gcc/8/lib/gcc/x86_64-pc-linux-gnu/8.4.0/crtend.o /lib/../lib64/crtn.o
/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
dpcpp: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [dw_cuda.dp.o] Error 1```
tkoskela commented 2 years ago

Kacper:

BTW please do not expect to be able to run the produced code on Nvidia hardware. I've just got confirmation from Intel, that to be able to do it, we need to compile dpc++ ourselves.

Intel confirmed that the dpcpp compiler provided in the OneAPI package only supports Intel devices. For NVidia you need to compile the open-source version of the compiler. We have it installed on CSD3. To use it

module purge
module use /usr/local/software/spack/spack-modules/dpcpp-cuda-20220220/linux-centos8-x86_64_v3/
module load dpcpp
module load gcc/11.2.0

NOTE: when running on the NVidia GPU nodes, these modules also need to be loaded

tkoskela commented 2 years ago

Plan for the short term

tkoskela commented 2 years ago

Makefiles auto-generated with --gen-build-script are not working for me. I can compile on the command line with

clang++ -Iincludes -fsycl -fsycl-targets=nvptx64-nvidia-cuda main.c read_in.c dw_cuda.dp.cpp -o main