Skip to content

Commit

Permalink
Merge pull request #29 from bd4/pr/oneapi-2023
Browse files Browse the repository at this point in the history
Pr/oneapi 2023
  • Loading branch information
jtramm authored Jul 17, 2023
2 parents f733fc5 + f3cf732 commit 3b6b7c1
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 23 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions .github/workflows/hip.yml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions .github/workflows/omp.yml
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions .github/workflows/oneapi.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.o
*/XSBench
10 changes: 5 additions & 5 deletions opencl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions openmp-offload/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 17 additions & 6 deletions sycl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,7 +29,7 @@ obj = $(source:.cpp=.o)
#===============================================================================

# Standard Flags
CFLAGS := -std=c++14 -Wall
CFLAGS := -std=c++17 -Wall

# Linker Flags
LDFLAGS = -lm
Expand All @@ -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
Expand Down
10 changes: 4 additions & 6 deletions sycl/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{

Expand Down Expand Up @@ -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<cl::sycl::info::device::name>().c_str());
queue sycl_q{default_selector_v};
if(mype == 0 ) printf("Running on: %s\n", sycl_q.get_device().get_info<sycl::info::device::name>().c_str());
if(mype == 0 ) printf("Initializing device buffers and JIT compiling kernel...\n");

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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<cl::sycl::info::device::max_mem_alloc_size>() );
assert( index_grid_allocation_sz <= sycl_q.get_device().get_info<sycl::info::device::max_mem_alloc_size>() );
buffer<int, 1> index_grid_d(SD.index_grid, (unsigned long long ) SD.length_index_grid);

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion sycl/XSbench_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include<assert.h>
#include<stdint.h>
#include <chrono>
#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

// Papi Header
#ifdef PAPI
Expand Down

0 comments on commit 3b6b7c1

Please sign in to comment.