Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ jobs:
cmake "--preset=ci-${{ matrix.os }}"

- name: Build
run: cmake --build build --config Release -j 2
run: cmake --build build --config Release

- name: Install
run: cmake --install build --config Release --prefix prefix

- name: Test
working-directory: build
run: ctest --output-on-failure --no-tests=ignore -C Release -j 2
run: ctest --output-on-failure --no-tests=ignore -C Release

- name: Upload
uses: actions/upload-artifact@v4
Expand All @@ -90,7 +90,7 @@ jobs:
cmake -G "Unix Makefiles" -S examples/gprat_cpp -B build_examples -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PWD/prefix -DUSE_MKL=ON

- name: Build example project
run: cmake --build build_examples --config Release -j 2
run: cmake --build build_examples --config Release

# See: https://github.com/spack/setup-spack?tab=readme-ov-file#example-caching-your-own-binaries-for-public-repositories
- name: Push packages and update index
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,14 @@ examples/*/output.csv
examples/gprat_*/include/
examples/gpflow_reference/GPflow
/.vscode
benchmark_results_*

# Editor related files
ltex*
compile_commands.json

# Build files
build*

# Ignore folder
ignore
41 changes: 35 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Top-level CMakeLists.txt

# CMake initialization
# ##############################################################################
cmake_minimum_required(VERSION 3.23)

project(
Expand All @@ -9,21 +13,28 @@ project(

include(CMakeDependentOption)

# What to build?
# Build options
# ##############################################################################
option(GPRAT_BUILD_CORE "Build the core library" ON)

cmake_dependent_option(GPRAT_BUILD_BINDINGS "Build the Python bindings" ON
"GPRAT_BUILD_CORE" OFF)

cmake_dependent_option(
GPRAT_ENABLE_EXAMPLES "Build example applications as well?"
${PROJECT_IS_TOP_LEVEL} "GPRAT_BUILD_CORE" OFF)

cmake_dependent_option(GPRAT_ENABLE_TESTS "Build unit and integration tests"
${PROJECT_IS_TOP_LEVEL} "GPRAT_BUILD_CORE" OFF)

cmake_dependent_option(GPRAT_ENABLE_MKL "Enable support for Intel oneMKL"
${PROJECT_IS_TOP_LEVEL} "GPRAT_BUILD_CORE" OFF)

option(GPRAT_ENABLE_FORMAT_TARGETS "Enable clang-format / cmake-format targets"
${PROJECT_IS_TOP_LEVEL})

# Format settings
# ##############################################################################
if(GPRAT_ENABLE_FORMAT_TARGETS)
set(CMAKE_FORMAT_EXCLUDE "^external_ports/")

Expand All @@ -39,44 +50,55 @@ if(GPRAT_ENABLE_FORMAT_TARGETS)
endif()
endif()

# GNU install dirs
# ##############################################################################
if(NOT CMAKE_SKIP_INSTALL_RULES)
# Our installs follow the standard GNU directory layout. This include needs to
# come first since we need the CMAKE_INSTALL_* in the CMakeLists.txt of each
# target.
include(GNUInstallDirs)
endif()

# Building the GPRAT core
# ##############################################################################
if(GPRAT_BUILD_CORE)

# MKL backend
if(GPRAT_ENABLE_MKL)
# Try to find Intel oneMKL
set(MKL_INTERFACE_FULL "intel_lp64")
set(MKL_THREADING "sequential")
find_package(MKL CONFIG REQUIRED)

if(MKL_FOUND)
message(STATUS "Intel oneMKL Library found")
else()
message(FATAL_ERROR "No BLAS Library found")
message(FATAL_ERROR "Intel oneMKL Library NOT found")
endif()

# OpenBLAS backend
else()
# Try to find OpenBLAS
find_library(OpenBLAS_LIB NAMES openblas REQUIRED)

if(OpenBLAS_LIB)
message(STATUS "OpenBLAS Library found at ${OpenBLAS_LIB}")
else()
message(FATAL_ERROR "No BLAS Library found")
endif()
endif()

# HPX
find_package(HPX REQUIRED)

# Add core subdirectiory
add_subdirectory(core)

# Bindings subdirectory
if(GPRAT_BUILD_BINDINGS)
add_subdirectory(bindings)
endif()

endif()

# Installation
# ##############################################################################
if(NOT CMAKE_SKIP_INSTALL_RULES AND GPRAT_BUILD_CORE)
include(CMakePackageConfigHelpers)

Expand Down Expand Up @@ -116,11 +138,18 @@ if(NOT CMAKE_SKIP_INSTALL_RULES AND GPRAT_BUILD_CORE)
endif()
endif()

# Examples
# ##############################################################################
if(GPRAT_ENABLE_EXAMPLES)
add_subdirectory(examples/gprat_cpp)
endif()

# Tests
# ##############################################################################
if(GPRAT_ENABLE_TESTS)
enable_testing()
add_subdirectory(test)
endif()

# End of file
# ##############################################################################
50 changes: 38 additions & 12 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@
}
},
{
"name": "dev-linux-gpu",
"binaryDir": "${sourceDir}/build/dev-linux-gpu",
"name": "dev-linux-cuda",
"binaryDir": "${sourceDir}/build/dev-linux-cuda",
"inherits": ["dev-linux"],
"cacheVariables": {
"GPRAT_WITH_CUDA": "ON",
Expand All @@ -202,15 +202,31 @@
}
},
{
"name": "release-linux-gpu",
"binaryDir": "${sourceDir}/build/release-linux-gpu",
"name": "release-linux-cuda",
"binaryDir": "${sourceDir}/build/release-linux-cuda",
"inherits": ["release-linux"],
"cacheVariables": {
"GPRAT_WITH_CUDA": "ON",
"GPRAT_APEX_STEPS": "OFF",
"GPRAT_APEX_CHOLESKY": "OFF"
}
},
{
"name": "dev-linux-sycl",
"binaryDir": "${sourceDir}/build/dev-linux-sycl",
"inherits": ["dev-linux"],
"cacheVariables": {
"GPRAT_WITH_SYCL": "ON"
}
},
{
"name": "release-linux-sycl",
"binaryDir": "${sourceDir}/build/release-linux-sycl",
"inherits": ["release-linux"],
"cacheVariables": {
"GPRAT_WITH_SYCL": "ON"
}
}
],
"buildPresets": [
{
Expand All @@ -224,13 +240,23 @@
"configuration": "Release"
},
{
"name": "dev-linux-gpu",
"configurePreset": "dev-linux-gpu",
"name": "dev-linux-cuda",
"configurePreset": "dev-linux-cuda",
"configuration": "Debug"
},
{
"name": "release-linux-cuda",
"configurePreset": "release-linux-cuda",
"configuration": "Release"
},
{
"name": "dev-linux-sycl",
"configurePreset": "dev-linux-sycl",
"configuration": "Debug"
},
{
"name": "release-linux-gpu",
"configurePreset": "release-linux-gpu",
"name": "release-linux-sycl",
"configurePreset": "release-linux-sycl",
"configuration": "Release"
}
],
Expand Down Expand Up @@ -258,8 +284,8 @@
}
},
{
"name": "dev-linux-gpu",
"configurePreset": "dev-linux-gpu",
"name": "dev-linux-cuda",
"configurePreset": "dev-linux-cuda",
"configuration": "Debug",
"output": {
"outputOnFailure": true
Expand All @@ -269,8 +295,8 @@
}
},
{
"name": "release-linux-gpu",
"configurePreset": "release-linux-gpu",
"name": "release-linux-cuda",
"configurePreset": "release-linux-cuda",
"configuration": "Release",
"output": {
"outputOnFailure": true
Expand Down
1 change: 1 addition & 0 deletions Testing/Temporary/CTestCostData.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
5 changes: 4 additions & 1 deletion bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ endif()

# Option for GPU support with CUDA, cuSolver, cuBLAS
option(GPRAT_WITH_CUDA "Enable GPU support with CUDA, cuSolver, cuBLAS" OFF)
option(GPRAT_WITH_SYCL "Enable SYCL support with oneMath" OFF)

# Pass variable to C++ code
add_compile_definitions(GPRAT_WITH_CUDA=$<BOOL:${GPRAT_WITH_CUDA}>)
add_compile_definitions(GPRAT_WITH_CUDA=$<BOOL:${GPRAT_WITH_CUDA}>
GPRAT_WITH_SYCL=$<BOOL:${GPRAT_WITH_SYCL}>)

# Option for steps duration measurement with APEX
option(GPRAT_APEX_STEPS "Enable measuring duration of steps with APEX" OFF)
Expand Down
8 changes: 4 additions & 4 deletions bindings/gprat_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ n_streams to a value enables computations on the GPU.
trainable (list): List of booleans for trainable hyperparameters. Default is
{true, true, true}.
gpu_id (int): ID of the GPU to use. Default is 0.
n_streams (int): Number of streams for GPU computation. Default is 1.
n_units (int): Number of streams/queues for GPU computation. Default is 1.
)pbdoc")

// GPU constructor
Expand All @@ -100,11 +100,11 @@ n_streams to a value enables computations on the GPU.
py::arg("kernel_params") = std::vector<double>{ 1.0, 1.0, 0.1 },
py::arg("trainable") = std::vector<bool>{ true, true, true },
py::arg("gpu_id") = 0,
py::arg("n_streams") = 1,
py::arg("n_units") = 1,
R"pbdoc(
Create Gaussian Process including its data, hyperparameters, and target. By
default, the calculations are performed on the CPU. Setting at least gpu_id or
n_streams to a value enables computations on the GPU.
n_units to a value enables computations on the GPU.

Parameters:
input_data (list): Input data for the GP.
Expand All @@ -117,7 +117,7 @@ n_streams to a value enables computations on the GPU.
trainable (list): List of booleans for trainable hyperparameters. Default is
{true, true, true}.
gpu_id (int): ID of the GPU to use. Default is 0.
n_streams (int): Number of streams for GPU computation. Default is 1.
n_units (int): Number of streams/queues for GPU computation. Default is 1.

)pbdoc")
.def_readwrite("n_reg", &gprat::GP::n_reg)
Expand Down
1 change: 1 addition & 0 deletions bindings/utils_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void init_utils(py::module &m)
m.def("stop_hpx", &utils::stop_hpx_runtime);

m.def("compiled_with_cuda", &utils::compiled_with_cuda, "Check if the code was compiled with CUDA support");
m.def("compiled_with_sycl", &utils::compiled_with_sycl, "Check if the code was compiled with SYCL support");

m.def("print_available_gpus", &gprat::print_available_gpus, "Print available GPUs with their properties");
m.def("gpu_count", &gprat::gpu_count, "Return the number of available GPUs");
Expand Down
24 changes: 24 additions & 0 deletions boilerplate-benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
#SBATCH --job-name=gprat
#SBATCH --output=output_gprat.txt
#SBATCH --time=48:00:00

source ~/Setup_Scripts/setup_breyerml.sh

if [[ "$HOSTNAME" == "simcl1n1" || "$HOSTNAME" == "simcl1n2" ]]; then

./execute-benchmark.sh yes yes yes yes gpu nvidia cuda
./execute-benchmark.sh no no yes yes gpu nvidia sycl

elif [[ "$HOSTNAME" == "simcl1n3" ]];
then

./execute-benchmark.sh yes yes yes yes gpu amd

elif [[ "$HOSTNAME" == "simcl1n4" ]];
then

./execute-benchmark.sh yes yes yes yes cpu cpu

fi
Loading
Loading