diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml new file mode 100644 index 00000000..2b518595 --- /dev/null +++ b/.github/workflows/cuda.yml @@ -0,0 +1,19 @@ +name: CUDA Tests + +on: + push: + branches: [ master, 'pr/*' ] + pull_request: + branches: [ master ] + +jobs: + build-cuda: + runs-on: ubuntu-latest + container: nvidia/cuda:11.0.3-devel-ubuntu20.04 + env: + DEBIAN_FRONTEND: noninteractive + BACKEND: cuda + steps: + - uses: actions/checkout@v3 + - name: make + run: cd $BACKEND; make -j4 diff --git a/.github/workflows/hip.yml b/.github/workflows/hip.yml new file mode 100644 index 00000000..1c8ff460 --- /dev/null +++ b/.github/workflows/hip.yml @@ -0,0 +1,19 @@ +name: HIP Tests + +on: + push: + branches: [ master, 'pr/*' ] + pull_request: + branches: [ master ] + +jobs: + build-hip: + runs-on: ubuntu-latest + container: rocm/dev-ubuntu-22.04:5.4.2-complete + env: + DEBIAN_FRONTEND: noninteractive + BACKEND: hip + steps: + - uses: actions/checkout@v3 + - name: make + run: cd $BACKEND; make -j4 diff --git a/.github/workflows/omp.yml b/.github/workflows/omp.yml new file mode 100644 index 00000000..e38b21ff --- /dev/null +++ b/.github/workflows/omp.yml @@ -0,0 +1,27 @@ +name: OMP Tests + +on: + push: + branches: [ master, 'pr/*' ] + pull_request: + branches: [ master ] + +jobs: + omp-run-cpu: + runs-on: ubuntu-latest + env: + DEBIAN_FRONTEND: noninteractive + CC: gcc + BACKEND: openmp-threading + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: make + run: cd $BACKEND; make -j4 + - name: run nuclide + run: ./$BACKEND/XSBench -m event -s small -G nuclide + - name: run hash + run: ./$BACKEND/XSBench -m event -s small -G hash + - name: run unionized + run: ./$BACKEND/XSBench -m event -s small -G unionized diff --git a/.github/workflows/oneapi.yml b/.github/workflows/oneapi.yml new file mode 100644 index 00000000..e2473ffa --- /dev/null +++ b/.github/workflows/oneapi.yml @@ -0,0 +1,45 @@ +name: SYCL Tests + +on: + push: + branches: [ master, 'pr/*' ] + pull_request: + branches: [ master ] + +jobs: + sycl-oneapi-run-cpu: + runs-on: ubuntu-latest + container: intel/oneapi-basekit:2023.1.0-devel-ubuntu22.04 + env: + DEBIAN_FRONTEND: noninteractive + ONEAPI_DEVICE_SELECTOR: opencl:cpu + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: sycl-ls + run: | + which sycl-ls + sycl-ls + - name: make sycl + run: cd sycl; CC=oneapi make -j4 + - name: run sycl nuclide + run: ./sycl/XSBench -m event -s small -G nuclide + - name: run sycl hash + run: ./sycl/XSBench -m event -s small -G hash + - name: run sycl unionized + run: ./sycl/XSBench -m event -s small -G unionized + - name: make openmp-offload + run: cd openmp-offload; COMPILER=intel make -j4 + - name: run openmp-offload nuclide + run: ./openmp-offload/XSBench -m event -s small -G nuclide + - name: run openmp-offload hash + run: ./openmp-offload/XSBench -m event -s small -G hash + - name: run openmp-offload unionized + run: ./openmp-offload/XSBench -m event -s small -G unionized + - name: install opencl packages + run: | + apt-get -y update && apt-get install -y --no-install-recommends intel-oneapi-runtime-opencl clinfo opencl-headers intel-opencl-icd + clinfo + - name: make opencl + run: cd opencl; COMPILER=gnu make -j4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..08f0e1b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +*/XSBench diff --git a/opencl/Makefile b/opencl/Makefile index 9c5cb906..cdc49b0d 100644 --- a/opencl/Makefile +++ b/opencl/Makefile @@ -2,11 +2,11 @@ # User Options #=============================================================================== -COMPILER = gnu -OPTIMIZE = yes -DEBUG = no -PROFILE = no -MPI = no +COMPILER ?= gnu +OPTIMIZE ?= yes +DEBUG ?= no +PROFILE ?= no +MPI ?= no #=============================================================================== # Program name & source code list diff --git a/openmp-offload/Makefile b/openmp-offload/Makefile index f3aae5ce..3c4166d3 100644 --- a/openmp-offload/Makefile +++ b/openmp-offload/Makefile @@ -2,11 +2,11 @@ # User Options #=============================================================================== -COMPILER = llvm -OPTIMIZE = yes -DEBUG = no -PROFILE = no -MPI = no +COMPILER ?= llvm +OPTIMIZE ?= yes +DEBUG ?= no +PROFILE ?= no +MPI ?= no #=============================================================================== # Program name & source code list diff --git a/sycl/Makefile b/sycl/Makefile index 95ac06ac..9632680b 100644 --- a/sycl/Makefile +++ b/sycl/Makefile @@ -2,11 +2,11 @@ # User Options #=============================================================================== -CC = llvm -OPTIMIZE = yes -DEBUG = no -PROFILE = no -MPI = no +CC ?= llvm +OPTIMIZE ?= yes +DEBUG ?= no +PROFILE ?= no +MPI ?= no #=============================================================================== # Program name & source code list @@ -29,7 +29,7 @@ obj = $(source:.cpp=.o) #=============================================================================== # Standard Flags -CFLAGS := -std=c++14 -Wall +CFLAGS := -std=c++17 -Wall # Linker Flags LDFLAGS = -lm @@ -48,6 +48,17 @@ ifeq ($(CC),llvm) LDFLAGS += -lOpenCL endif +# IntelOneAPI Compiler +ifeq ($(CC),oneapi) + CC = icpx + CFLAGS += -fsycl +endif + +ifeq ($(CC),opensycl) + CC = syclcc + CFLAGS += -fsycl +endif + # Debug Flags ifeq ($(DEBUG),yes) CFLAGS += -g diff --git a/sycl/Simulation.cpp b/sycl/Simulation.cpp index 1a882e0c..2c04f157 100644 --- a/sycl/Simulation.cpp +++ b/sycl/Simulation.cpp @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////////////////////// // use SYCL namespace to reduce symbol names -using namespace cl::sycl; +using namespace sycl; unsigned long long run_event_based_simulation(Inputs in, SimulationData SD, int mype, double * kernel_init_time) { @@ -48,10 +48,8 @@ unsigned long long run_event_based_simulation(Inputs in, SimulationData SD, int { // create a queue using the default device for the platform (cpu, gpu) - queue sycl_q{default_selector()}; - //queue sycl_q{gpu_selector()}; - //queue sycl_q{cpu_selector()}; - if(mype == 0 ) printf("Running on: %s\n", sycl_q.get_device().get_info().c_str()); + queue sycl_q{default_selector_v}; + if(mype == 0 ) printf("Running on: %s\n", sycl_q.get_device().get_info().c_str()); if(mype == 0 ) printf("Initializing device buffers and JIT compiling kernel...\n"); //////////////////////////////////////////////////////////////////////////////// @@ -84,7 +82,7 @@ unsigned long long run_event_based_simulation(Inputs in, SimulationData SD, int // For the unionized grid, this is a large array. Enforce that it is able to be allocated on the // OpenCL device (as some OpenCL devices have fairly low limts here for some reason...) size_t index_grid_allocation_sz = ceil((SD.length_index_grid * sizeof(int))); - assert( index_grid_allocation_sz <= sycl_q.get_device().get_info() ); + assert( index_grid_allocation_sz <= sycl_q.get_device().get_info() ); buffer index_grid_d(SD.index_grid, (unsigned long long ) SD.length_index_grid); //////////////////////////////////////////////////////////////////////////////// diff --git a/sycl/XSbench_header.h b/sycl/XSbench_header.h index 8411dd62..8679d2dd 100644 --- a/sycl/XSbench_header.h +++ b/sycl/XSbench_header.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include // Papi Header #ifdef PAPI