UCL / openqcd-oneapi

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

Compile generated sycl code with hipsycl #4

Closed tkoskela closed 2 years ago

tkoskela commented 2 years ago

Kacper's instructions

For hipsycl on csd3 it is necessary to load the following modules:

module load rhel8/default-amp
module load hipsycl/0.9.1/gcc-9.4.0-gieutz2

Additionally for running a binary produced with hipsycl it may be necessary to load a module providing newer libstdc++, for example:

module load gcc/9.4.0
tkoskela commented 2 years ago

Results

Makefile

cat Makefile
SHELL:=/bin/bash
CC=dpcpp
CFLAGS=-O2 -Wall
LDFLAGS=
INCLUDES=-Iincludes

intel_cpu: CC = dpcpp

nvidia_gpu: CC = clang++
nvidia_gpu: CFLAGS += -fsycl -fsycl-targets=nvptx64-nvidia-cuda

hip_gpu: CC = syclcc

all: intel_cpu nvidia_gpu

intel_cpu: main.c dw_soa_sycl.cpp read_in.c
    $(CC) $(INCLUDES) $(CFLAGS) $^ -o main.intel_cpu

nvidia_gpu: main.c dw_soa_sycl.cpp read_in.c
    $(CC) $(INCLUDES) $(CFLAGS) $^ -o main.nvidia_gpu

hip_gpu:  main.c dw_soa_sycl.cpp read_in.c
    $(CC) $(INCLUDES) $(CFLAGS) $^ -o main.hip_gpu

clean:
    rm -f *.o main a.out 2>/dev/null

Environment

(base) [dc-kosk1@login-q-1 dpct_output]$ module purge
(base) [dc-kosk1@login-q-1 dpct_output]$ module load rhel8/default-amp
Loading rhel8/default-amp
  Loading requirement: dot rhel8/slurm singularity/current rhel8/global cuda/11.4 openmpi/4.1.1/gcc-9.4.0-epagguv
(base) [dc-kosk1@login-q-1 dpct_output]$ module load hipsycl/0.9.2/gcc-9.4.0-jg2gfgh
(base) [dc-kosk1@login-q-1 dpct_output]$ module load gcc/9.4.0
(base) [dc-kosk1@login-q-4 dpct_output]$ export HIPSYCL_TARGETS=cuda:sm_80
(base) [dc-kosk1@login-q-4 dpct_output]$ export HIPSYCL_GPU_ARCH=sm_80

Code modifidactions

tkoskela commented 2 years ago

Kacper (12 Apr): I see that hipsycl started to support some atomic operations only in 0.9.2. I will try to make a build of it for you later today. I've just added module for newer version of hipsycl on csd3: hipsycl/0.9.2

tkoskela commented 2 years ago

Building hipsycl on cosma

tkoskela commented 2 years ago

Reopening this because there are issues with building for AMD GPUs on Cosma8 that need more investigation.

tkoskela commented 2 years ago

Closing this and continuing investigation in #29