11# Inner CMakeLists.txt
22
3- ### Options #######################################################################################
3+ # Options
4+ # #######################################################################################
45
56# CUDA and SYCL are mutually exclusive, catch this error case
67if (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." )
811endif ()
912
1013# SYCL
1114option (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 )
1418option (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
2027option (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
2732if (GPRAT_WITH_CUDA)
2833 enable_language (CUDA )
2934endif ()
3035
31- ### Source files ##################################################################################
36+ # Source files
37+ # ##################################################################################
3238
3339# Option for steps duration measurement with APEX
3440option (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)
7883endif ()
7984
8085# Add CUDA-specific source files if enabled
@@ -91,7 +96,8 @@ if(GPRAT_WITH_CUDA)
9196 src/gpu/cuda/cuda_kernels.cu)
9297endif ()
9398
94- ### Add GPRat core library ########################################################################
99+ # Add GPRat core library
100+ # ########################################################################
95101
96102# Add GPRAT core library
97103add_library (gprat_core STATIC ${SOURCE_FILES} )
@@ -100,10 +106,11 @@ add_library(gprat_core STATIC ${SOURCE_FILES})
100106set_property (TARGET gprat_core PROPERTY EXPORT_NAME core)
101107add_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
108115file (GLOB_RECURSE header_files CONFIGURE_DEPENDS include /*.hpp
109116 include /cpu/*.hpp )
@@ -120,7 +127,8 @@ endif()
120127
121128target_sources (gprat_core PRIVATE ${header_files} )
122129
123- ### Linking #######################################################################################
130+ # Linking
131+ # #######################################################################################
124132
125133# Link HPX libraries
126134target_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
226221set_property (TARGET gprat_core PROPERTY POSITION_INDEPENDENT_CODE ON )
227222
228- ### Installation ##################################################################################
223+ # Installation
224+ # ##################################################################################
229225
230226if (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} " )
246242endif ()
247243
248- ### End of file ###################################################################################
244+ # End of file
245+ # ###################################################################################
0 commit comments