diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b467d6..5dd636d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: clang-format uses: jidicula/clang-format-action@v4.11.0 @@ -101,9 +101,31 @@ jobs: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_COMPILER=clang++ + -DENABLE_GRAPHICS=ON -DENABLE_SPIR=ON -DENABLE_CUDA=OFF -DENABLE_HIP=OFF -DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Werror' -G Ninja - name: Build run: cmake --build ${{github.workspace}}/build -- -k 0 + + cmake-build-nographics: + runs-on: ubuntu-latest + container: + image: intel/oneapi-basekit:latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure CMake (no graphics) + run: > + cmake -B ${{github.workspace}}/build + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -DCMAKE_CXX_COMPILER=icpx + -DENABLE_GRAPHICS=OFF + -DENABLE_SPIR=ON -DENABLE_CUDA=OFF -DENABLE_HIP=OFF + -DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Werror' + + - name: Build (no graphics) + run: cmake --build ${{github.workspace}}/build -- -k -j diff --git a/CMakeLists.txt b/CMakeLists.txt index 165711d..5b00c6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,29 +9,18 @@ project(SYCL-samples) set(CMAKE_CXX_STANDARD 17) # Configure Magnum -list(APPEND CMAKE_MODULE_PATH - "${PROJECT_SOURCE_DIR}/modules/magnum-bootstrap/modules" - "${PROJECT_SOURCE_DIR}/modules/magnum-integration/modules") -set(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE) -set(MAGNUM_WITH_ANYIMAGEIMPORTER ON CACHE BOOL "" FORCE) -set(MAGNUM_WITH_STBIMAGEIMPORTER ON CACHE BOOL "" FORCE) -set(IMGUI_DIR ${PROJECT_SOURCE_DIR}/modules/imgui) -set(MAGNUM_WITH_IMGUI ON CACHE BOOL "" FORCE) -add_subdirectory(modules/corrade EXCLUDE_FROM_ALL) -add_subdirectory(modules/magnum EXCLUDE_FROM_ALL) -add_subdirectory(modules/magnum-plugins EXCLUDE_FROM_ALL) -add_subdirectory(modules/magnum-integration EXCLUDE_FROM_ALL) -find_package(Magnum REQUIRED GL Sdl2Application Shaders Primitives Trade) -find_package(MagnumIntegration REQUIRED ImGui) +include(cmake/ConfigureMagnum.cmake) # Configure SYCL include(cmake/ConfigureSYCL.cmake) # Configure the demo projects set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} CACHE PATH "" FORCE) -add_subdirectory(src/fluid) -add_subdirectory(src/game_of_life) -add_subdirectory(src/mandelbrot) -add_subdirectory(src/nbody) add_subdirectory(src/matrix_multiply_omp_compare) add_subdirectory(src/scan_parallel_inclusive) +if(ENABLE_GRAPHICS) + add_subdirectory(src/fluid) + add_subdirectory(src/game_of_life) + add_subdirectory(src/mandelbrot) + add_subdirectory(src/nbody) +endif() diff --git a/README.md b/README.md index 3c5566c..9e73d66 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Drag the mouse around the screen to create fluid particles with velocities in direction of the mouse travel. The fluid fades slowly over time so as not to fill the container. +## Non-graphical Demos ### MPI for CUDA Backend MPI, the Message Passing Interface, is a standard API for communicating data via messages between distributed processes that is commonly used in HPC to build @@ -76,7 +77,9 @@ include them in the checkout via `git clone --recurse-submodules `. SDL2 needs to be supplied by the user and can be installed with common package managers on most systems, or built from source. If you install SDL2 from source in a non-default location, -pass it into the CMake configuration with `-DSDL2_ROOT=`. +pass it into the CMake configuration with `-DSDL2_ROOT=`. It is possible +to build the project without the graphical demos using `-DENABLE_GRAPHICS=OFF` +if SDL2 cannot be provided - see the Building section below. Although the code should compile with any SYCL implementation, the CMake configuration assumes the DPC++ compiler driver CLI for compilation flags setup. @@ -89,7 +92,8 @@ The project uses a standard CMake build configuration system. Ensure the SYCL compiler is used by the configuration either by setting the environment variable `CXX=` or passing the configuration flag `-DCMAKE_CXX_COMPILER=` where `` is your SYCL compiler's -executable (for example Intel `icpx` or LLVM `clang++`). \ +executable (for example Intel `icpx` or LLVM `clang++`). + To check out the repository and build the examples, use simply: ``` git clone --recurse-submodules @@ -110,3 +114,10 @@ be overridden with `-D