Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,100 @@ jobs:
python -m pip install numpy pytest sphericart julia
python -m pytest .

sycl-tests:
runs-on: ubuntu-22.04
name: Test SYCL on ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y gpg-agent wget

- name: setup Intel oneAPI APT repository
run: |
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor \
| sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
| sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update

- name: install Intel oneAPI DPC++ compiler and SYCL runtime
run: |
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp intel-oneapi-runtime-opencl

- name: configure SYCL build
shell: bash
run: |
source /opt/intel/oneapi/setvars.sh
cmake -B build-sycl -S . \
-DSPHERICART_BUILD_TESTS=ON \
-DSPHERICART_ENABLE_SYCL=ON \
-DSPHERICART_SYCL_DEVICE=cpu \
-DCMAKE_CXX_COMPILER=icpx

- name: build SYCL tests
shell: bash
run: |
source /opt/intel/oneapi/setvars.sh
cmake --build build-sycl --parallel

- name: run SYCL ctest
shell: bash
run: |
source /opt/intel/oneapi/setvars.sh
ctest --test-dir build-sycl --output-on-failure -R test_derivatives_sycl

sycl-tests-windows:
runs-on: windows-2022
name: Test SYCL on windows-2022
env:
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/09a8acaf-265f-4460-866c-a3375ed5b4ff/intel-oneapi-base-toolkit-2025.2.0.591_offline.exe
WINDOWS_DPCPP_COMPONENTS: intel.oneapi.win.cpp-dpcpp-common
steps:
- uses: actions/checkout@v3

- name: setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: install Ninja
shell: pwsh
run: choco install -y ninja

- name: install Intel oneAPI DPC++ compiler
shell: cmd
run: |
curl.exe -L --retry 5 --retry-delay 5 -o oneapi-basekit.exe %WINDOWS_BASEKIT_URL%
start /b /wait "" oneapi-basekit.exe -s -a --silent --eula accept --components=%WINDOWS_DPCPP_COMPONENTS%

- name: configure SYCL build
shell: cmd
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" >nul 2>&1
cmake -G Ninja -B build-sycl -S . ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_C_COMPILER=icx ^
-DCMAKE_CXX_COMPILER=icx ^
-DSPHERICART_BUILD_TESTS=ON ^
-DSPHERICART_ENABLE_SYCL=ON ^
-DSPHERICART_SYCL_DEVICE=cpu

- name: build SYCL tests
shell: cmd
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" >nul 2>&1
cmake --build build-sycl --parallel

- name: run SYCL ctest
shell: cmd
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" >nul 2>&1
ctest --test-dir build-sycl --output-on-failure -R test_derivatives_sycl

# check that we can build Python wheels on any Python version
python-build:
runs-on: ubuntu-22.04
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
endif()
endif()

add_subdirectory(sphericart)

OPTION(SPHERICART_BUILD_TORCH "Build the torch bindings" OFF)
OPTION(SPHERICART_BUILD_EXAMPLES "Build and run examples and benchmarks for Sphericart" OFF)
OPTION(SPHERICART_PRINT_DEBUG "Enable debug print statements" OFF)



if (SPHERICART_PRINT_DEBUG)
add_compile_definitions(PRINT_DEBUG)
endif()

add_subdirectory(sphericart)

if (SPHERICART_BUILD_EXAMPLES)
add_subdirectory(examples)
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ The following cmake configuration options are available:
- `-DSPHERICART_OPENMP=ON/OFF`: enable OpenMP parallelism
- `-DCMAKE_INSTALL_PREFIX=<where/you/want/to/install>` set the root path for installation

### GPU Support

The support for GPU offload could be controled with the following CMake variables at configuration:

- `-DSPHERICART_ENABLE_CUDA=ON/OFF`: build with CUDA support also set `CUDA_HOME` environement variable.
- `-DSPHERICART_ENABLE_SYCL=ON/OFF`: build with SYCL support, configure tool will search for `sycl/sycl.h` header.
- `-DSPHERICART_SYCL_DEVICE=all/cpu/gpu`: target architecute for SYCL support, check which devices are available with `sycl-ls`, for `all` (default) is possible to control at execution with `export ONEAPI_DEVICE_SELECTOR=opencl:gpu` or `export ONEAPI_DEVICE_SELECTOR=opencl:cpu`.

The following flags have been tested with Intel OneAPI 2025.3 for enabling SYCL support:
- `-DCMAKE_CXX_COMPILER=icpx`
- `-DCMAKE_C_COMPILER=icx`
- `-DCMAKE_CXX_FLAGS=" -qopenmp --intel -fsycl -fsycl-targets=spir64 -Wno-deprecated-declarations -Wno-macro-redefined -Wno-unused-parameter -w"`

**Note**: Only tested in C++, python/JAX/Torch support is in progress.

### Running tests and documentation

Expand Down
8 changes: 8 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ add_executable(benchmark_cpp cpp/benchmark.cpp)
target_link_libraries(benchmark_cpp sphericart)
add_test(benchmark benchmark_cpp COMMAND ./benchmark_cpp)
target_compile_features(benchmark_cpp PRIVATE cxx_std_17)

if (SPHERICART_ENABLE_SYCL)
# SYCL_DEVICE and DTYPE are defined in the parent CMakeLists.txt
add_executable(benchmark_sycl sycl/benchmark_sycl.cpp)
target_link_libraries(benchmark_sycl sphericart)
target_compile_features(benchmark_sycl PRIVATE cxx_std_17)
add_test(NAME benchmark_sycl COMMAND ./benchmark_sycl)
endif()
Loading
Loading