Skip to content

Commit 7ffbd15

Browse files
committed
Apply formating
1 parent a92b710 commit 7ffbd15

25 files changed

Lines changed: 1688 additions & 1833 deletions

CMakeLists.txt

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Top-level CMakeLists.txt
22

3-
### CMake initialization ##########################################################################
3+
# CMake initialization
4+
# ##########################################################################
45
cmake_minimum_required(VERSION 3.23)
56

67
project(
@@ -12,12 +13,13 @@ project(
1213

1314
include(CMakeDependentOption)
1415

15-
### Build options #################################################################################
16+
# Build options
17+
# #################################################################################
1618
option(GPRAT_BUILD_CORE "Build the core library" ON)
1719

1820
cmake_dependent_option(GPRAT_BUILD_BINDINGS "Build the Python bindings" ON
1921
"GPRAT_BUILD_CORE" OFF)
20-
22+
2123
cmake_dependent_option(
2224
GPRAT_ENABLE_EXAMPLES "Build example applications as well?"
2325
${PROJECT_IS_TOP_LEVEL} "GPRAT_BUILD_CORE" OFF)
@@ -31,7 +33,8 @@ cmake_dependent_option(GPRAT_ENABLE_MKL "Enable support for Intel oneMKL"
3133
option(GPRAT_ENABLE_FORMAT_TARGETS "Enable clang-format / cmake-format targets"
3234
${PROJECT_IS_TOP_LEVEL})
3335

34-
### Format settings ###############################################################################
36+
# Format settings
37+
# ###############################################################################
3538
if(GPRAT_ENABLE_FORMAT_TARGETS)
3639
set(CMAKE_FORMAT_EXCLUDE "^external_ports/")
3740

@@ -47,18 +50,20 @@ if(GPRAT_ENABLE_FORMAT_TARGETS)
4750
endif()
4851
endif()
4952

50-
### GNU install dirs ##############################################################################
53+
# GNU install dirs
54+
# ##############################################################################
5155
if(NOT CMAKE_SKIP_INSTALL_RULES)
5256
# Our installs follow the standard GNU directory layout. This include needs to
5357
# come first since we need the CMAKE_INSTALL_* in the CMakeLists.txt of each
5458
# target.
5559
include(GNUInstallDirs)
5660
endif()
5761

58-
### Building the GPRAT core #######################################################################
62+
# Building the GPRAT core
63+
# #######################################################################
5964
if(GPRAT_BUILD_CORE)
6065

61-
## MKL backend
66+
# MKL backend
6267
if(GPRAT_ENABLE_MKL)
6368
set(MKL_INTERFACE_FULL "intel_lp64")
6469
set(MKL_THREADING "sequential")
@@ -69,7 +74,7 @@ if(GPRAT_BUILD_CORE)
6974
message(FATAL_ERROR "Intel oneMKL Library NOT found")
7075
endif()
7176

72-
## OpenBLAS backend
77+
# OpenBLAS backend
7378
else()
7479
find_library(OpenBLAS_LIB NAMES openblas REQUIRED)
7580
if(OpenBLAS_LIB)
@@ -79,20 +84,21 @@ if(GPRAT_BUILD_CORE)
7984
endif()
8085
endif()
8186

82-
## HPX
87+
# HPX
8388
find_package(HPX REQUIRED)
8489

85-
## Add core subdirectiory
90+
# Add core subdirectiory
8691
add_subdirectory(core)
8792

88-
## Bindings subdirectory
93+
# Bindings subdirectory
8994
if(GPRAT_BUILD_BINDINGS)
9095
add_subdirectory(bindings)
9196
endif()
9297

9398
endif()
9499

95-
### Installation ##################################################################################
100+
# Installation
101+
# ##################################################################################
96102
if(NOT CMAKE_SKIP_INSTALL_RULES AND GPRAT_BUILD_CORE)
97103
include(CMakePackageConfigHelpers)
98104

@@ -132,15 +138,18 @@ if(NOT CMAKE_SKIP_INSTALL_RULES AND GPRAT_BUILD_CORE)
132138
endif()
133139
endif()
134140

135-
### Examples ######################################################################################
141+
# Examples
142+
# ######################################################################################
136143
if(GPRAT_ENABLE_EXAMPLES)
137144
add_subdirectory(examples/gprat_cpp)
138145
endif()
139146

140-
### Tests #########################################################################################
147+
# Tests
148+
# #########################################################################################
141149
if(GPRAT_ENABLE_TESTS)
142150
enable_testing()
143151
add_subdirectory(test)
144152
endif()
145153

146-
### End of file ###################################################################################
154+
# End of file
155+
# ###################################################################################

bindings/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ option(GPRAT_WITH_CUDA "Enable GPU support with CUDA, cuSolver, cuBLAS" OFF)
2323
option(GPRAT_WITH_SYCL "Enable SYCL support with oneMath" OFF)
2424

2525
# Pass variable to C++ code
26-
add_compile_definitions(
27-
GPRAT_WITH_CUDA=$<BOOL:${GPRAT_WITH_CUDA}>
28-
GPRAT_WITH_SYCL=$<BOOL:${GPRAT_WITH_SYCL}>
29-
)
26+
add_compile_definitions(GPRAT_WITH_CUDA=$<BOOL:${GPRAT_WITH_CUDA}>
27+
GPRAT_WITH_SYCL=$<BOOL:${GPRAT_WITH_SYCL}>)
3028

3129
# Option for steps duration measurement with APEX
3230
option(GPRAT_APEX_STEPS "Enable measuring duration of steps with APEX" OFF)

core/CMakeLists.txt

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
11
# Inner CMakeLists.txt
22

3-
### Options #######################################################################################
3+
# Options
4+
# #######################################################################################
45

56
# CUDA and SYCL are mutually exclusive, catch this error case
67
if(GPRAT_WITH_CUDA AND GPRAT_WITH_SYCL)
7-
message(FATAL_ERROR "GPRAT_WITH_CUDA and GPRAT_WITH_SYCL cannot be enabled at the same time.")
8+
message(
9+
FATAL_ERROR
10+
"GPRAT_WITH_CUDA and GPRAT_WITH_SYCL cannot be enabled at the same time.")
811
endif()
912

1013
# SYCL
1114
option(GPRAT_WITH_SYCL "Enable SYCL support with oneMath" OFF)
1215

13-
option(GPRAT_SYCL_NVIDIA "Enable NVIDIA GPU support with oneMath SYCL backend" OFF)
16+
option(GPRAT_SYCL_NVIDIA "Enable NVIDIA GPU support with oneMath SYCL backend"
17+
OFF)
1418
option(GPRAT_SYCL_AMD "Enable AMD GPU support with oneMath SYCL backend" OFF)
15-
option(GPRAT_SYCL_INTEL "Enable Intel GPU support with oneMath SYCL backend" OFF)
19+
option(GPRAT_SYCL_INTEL "Enable Intel GPU support with oneMath SYCL backend"
20+
OFF)
1621

17-
set(HIP_TARGETS "" CACHE STRING "Target HIP architectures")
22+
set(HIP_TARGETS
23+
""
24+
CACHE STRING "Target HIP architectures")
1825

1926
# CUDA
2027
option(GPRAT_WITH_CUDA "Enable GPU support with CUDA, cuSolver, cuBLAS" OFF)
2128

22-
add_compile_definitions(
23-
GPRAT_WITH_CUDA=$<BOOL:${GPRAT_WITH_CUDA}>
24-
GPRAT_WITH_SYCL=$<BOOL:${GPRAT_WITH_SYCL}>
25-
)
29+
add_compile_definitions(GPRAT_WITH_CUDA=$<BOOL:${GPRAT_WITH_CUDA}>
30+
GPRAT_WITH_SYCL=$<BOOL:${GPRAT_WITH_SYCL}>)
2631

2732
if(GPRAT_WITH_CUDA)
2833
enable_language(CUDA)
2934
endif()
3035

31-
### Source files ##################################################################################
36+
# Source files
37+
# ##################################################################################
3238

3339
# Option for steps duration measurement with APEX
3440
option(GPRAT_APEX_STEPS "Enable measuring duration of steps with APEX" OFF)
@@ -73,8 +79,7 @@ if(GPRAT_WITH_SYCL)
7379
src/gpu/sycl/sycl_gp_functions.cpp
7480
src/gpu/sycl/sycl_gp_optimizer.cpp
7581
src/gpu/sycl/sycl_gp_uncertainty.cpp
76-
src/gpu/sycl/sycl_tiled_algorithms.cpp
77-
)
82+
src/gpu/sycl/sycl_tiled_algorithms.cpp)
7883
endif()
7984

8085
# Add CUDA-specific source files if enabled
@@ -91,7 +96,8 @@ if(GPRAT_WITH_CUDA)
9196
src/gpu/cuda/cuda_kernels.cu)
9297
endif()
9398

94-
### Add GPRat core library ########################################################################
99+
# Add GPRat core library
100+
# ########################################################################
95101

96102
# Add GPRAT core library
97103
add_library(gprat_core STATIC ${SOURCE_FILES})
@@ -100,10 +106,11 @@ add_library(gprat_core STATIC ${SOURCE_FILES})
100106
set_property(TARGET gprat_core PROPERTY EXPORT_NAME core)
101107
add_library(GPRat::core ALIAS gprat_core)
102108

103-
### Headers #######################################################################################
109+
# Headers
110+
# #######################################################################################
104111

105-
# Add them as PRIVATE sources here so they show up in project files Can't use PUBLIC etc.
106-
# see: https://stackoverflow.com/a/62465051
112+
# Add them as PRIVATE sources here so they show up in project files Can't use
113+
# PUBLIC etc. see: https://stackoverflow.com/a/62465051
107114

108115
file(GLOB_RECURSE header_files CONFIGURE_DEPENDS include/*.hpp
109116
include/cpu/*.hpp)
@@ -120,7 +127,8 @@ endif()
120127

121128
target_sources(gprat_core PRIVATE ${header_files})
122129

123-
### Linking #######################################################################################
130+
# Linking
131+
# #######################################################################################
124132

125133
# Link HPX libraries
126134
target_link_libraries(gprat_core PUBLIC HPX::hpx)
@@ -138,33 +146,23 @@ if(GPRAT_WITH_SYCL)
138146
# Select SYCL backend architecture
139147
if(GPRAT_SYCL_NVIDIA)
140148

141-
set(SYCL_FLAGS
142-
${SYCL_FLAGS}
143-
-fsycl
144-
-fsycl-targets=nvptx64-nvidia-cuda
145-
)
149+
set(SYCL_FLAGS ${SYCL_FLAGS} -fsycl -fsycl-targets=nvptx64-nvidia-cuda)
146150

147151
elseif(GPRAT_SYCL_AMD)
148152

149-
set(SYCL_FLAGS
150-
${SYCL_FLAGS}
151-
-fsycl
152-
-fsycl-targets=amdgcn-amd-amdhsa
153-
-Xsycl-target-backend
154-
--offload-arch=${HIP_TARGETS}
155-
)
153+
set(SYCL_FLAGS ${SYCL_FLAGS} -fsycl -fsycl-targets=amdgcn-amd-amdhsa
154+
-Xsycl-target-backend --offload-arch=${HIP_TARGETS})
156155

157156
elseif(GPRAT_SYCL_INTEL)
158157

159-
set(SYCL_FLAGS
160-
${SYCL_FLAGS}
161-
-fsycl
162-
-fsycl-targets=spir64
163-
)
158+
set(SYCL_FLAGS ${SYCL_FLAGS} -fsycl -fsycl-targets=spir64)
164159

165160
else()
166161

167-
message(FATAL_ERROR "No SYCL backend specified. Please enable one of GPRAT_SYCL_NVIDIA, GPRAT_SYCL_AMD, or GPRAT_SYCL_INTEL.")
162+
message(
163+
FATAL_ERROR
164+
"No SYCL backend specified. Please enable one of GPRAT_SYCL_NVIDIA, GPRAT_SYCL_AMD, or GPRAT_SYCL_INTEL."
165+
)
168166

169167
endif()
170168

@@ -175,32 +173,29 @@ if(GPRAT_WITH_SYCL)
175173
# Set link libraries based on SYCL backend
176174
if(GPRAT_SYCL_NVIDIA)
177175

178-
target_link_libraries(gprat_core PUBLIC
179-
ONEMATH::onemath_blas_cublas
180-
ONEMATH::onemath_lapack_cusolver
181-
)
176+
target_link_libraries(gprat_core PUBLIC ONEMATH::onemath_blas_cublas
177+
ONEMATH::onemath_lapack_cusolver)
182178

183179
elseif(GPRAT_SYCL_AMD)
184180

185-
target_link_libraries(gprat_core PUBLIC
186-
ONEMATH::onemath_blas_rocblas
187-
ONEMATH::onemath_lapack_rocsolver
188-
)
181+
target_link_libraries(gprat_core PUBLIC ONEMATH::onemath_blas_rocblas
182+
ONEMATH::onemath_lapack_rocsolver)
189183

190184
elseif(GPRAT_SYCL_INTEL)
191185

192-
target_link_libraries(gprat_core PUBLIC
193-
ONEMATH::onemath_blas_mklgpu
194-
ONEMATH::onemath_lapack_mklgpu
195-
)
186+
target_link_libraries(gprat_core PUBLIC ONEMATH::onemath_blas_mklgpu
187+
ONEMATH::onemath_lapack_mklgpu)
196188

197189
else()
198190

199-
message(FATAL_ERROR "No SYCL backend specified. Please enable one of GPRAT_SYCL_NVIDIA, GPRAT_SYCL_AMD, or GPRAT_SYCL_INTEL.")
191+
message(
192+
FATAL_ERROR
193+
"No SYCL backend specified. Please enable one of GPRAT_SYCL_NVIDIA, GPRAT_SYCL_AMD, or GPRAT_SYCL_INTEL."
194+
)
200195

201196
endif()
202197

203-
if (TARGET ONEMATH::onemath)
198+
if(TARGET ONEMATH::onemath)
204199
target_link_libraries(gprat_core PUBLIC ONEMATH::onemath)
205200
endif()
206201

@@ -225,7 +220,8 @@ target_compile_features(gprat_core PUBLIC cxx_std_20)
225220

226221
set_property(TARGET gprat_core PROPERTY POSITION_INDEPENDENT_CODE ON)
227222

228-
### Installation ##################################################################################
223+
# Installation
224+
# ##################################################################################
229225

230226
if(NOT CMAKE_SKIP_INSTALL_RULES)
231227
# We need to manually install those into CMAKE_INSTALL_INCLUDEDIR. Below
@@ -245,4 +241,5 @@ if(NOT CMAKE_SKIP_INSTALL_RULES)
245241
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
246242
endif()
247243

248-
### End of file ###################################################################################
244+
# End of file
245+
# ###################################################################################

core/include/gprat_c.hpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ struct GP_data
5858
class GP
5959
{
6060
private:
61-
6261
/** @brief Input data for training */
6362
std::vector<double> training_input_;
6463

@@ -83,8 +82,8 @@ class GP
8382
std::shared_ptr<Target> target_;
8483

8584
public:
86-
87-
/// Variables /////////////////////////////////////////////////////////////////////////////////////////////////////////
85+
/// Variables
86+
/// /////////////////////////////////////////////////////////////////////////////////////////////////////////
8887

8988
/** @brief Number of regressors */
9089
int n_reg;
@@ -94,7 +93,8 @@ class GP
9493
*/
9594
gprat_hyper::SEKParams kernel_params;
9695

97-
/// Generic constructor ///////////////////////////////////////////////////////////////////////////////////////////////
96+
/// Generic constructor
97+
/// ///////////////////////////////////////////////////////////////////////////////////////////////
9898

9999
/**
100100
* @brief Constructs a Gaussian Process (GP)
@@ -119,7 +119,8 @@ class GP
119119
std::vector<bool> trainable_bool,
120120
std::shared_ptr<Target> target);
121121

122-
/// CPU constructor ///////////////////////////////////////////////////////////////////////////////////////////////////
122+
/// CPU constructor
123+
/// ///////////////////////////////////////////////////////////////////////////////////////////////////
123124

124125
/**
125126
* @brief Constructs a Gaussian Process (GP) for CPU computations
@@ -142,7 +143,8 @@ class GP
142143
std::vector<double> kernel_hyperparams,
143144
std::vector<bool> trainable_bool);
144145

145-
/// GPU constructor ///////////////////////////////////////////////////////////////////////////////////////////////////
146+
/// GPU constructor
147+
/// ///////////////////////////////////////////////////////////////////////////////////////////////////
146148

147149
/**
148150
* @brief Constructs a Gaussian Process (GP) for GPU computations
@@ -169,7 +171,8 @@ class GP
169171
int gpu_id,
170172
int n_units);
171173

172-
/// Class methods /////////////////////////////////////////////////////////////////////////////////////////////////////
174+
/// Class methods
175+
/// /////////////////////////////////////////////////////////////////////////////////////////////////////
173176

174177
/**
175178
* Returns Gaussian Process attributes as string.

0 commit comments

Comments
 (0)