Skip to content

Commit 0c6f2b4

Browse files
authored
CMake: AMReX_PARALLEL_LINK_JOBS (#3628)
Add AMReX_PARALLEL_LINK_JOBS option to the CMake build system and use it for SYCL builds. Adjust SYCL's RelWithDebInfo mode to the recommendation of Intel VTune. This is a follow-up on #3498 that made similar changes to GNU Make.
1 parent 0a208bb commit 0c6f2b4

File tree

5 files changed

+44
-22
lines changed

5 files changed

+44
-22
lines changed

.github/workflows/intel.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ jobs:
4444
-DCMAKE_C_COMPILER=$(which icx) \
4545
-DCMAKE_CXX_COMPILER=$(which icpx) \
4646
-DCMAKE_Fortran_COMPILER=$(which ifx) \
47-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
47+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
48+
-DAMReX_PARALLEL_LINK_JOBS=2
4849
cmake --build build --parallel 2
4950
5051
ccache -s
@@ -86,7 +87,8 @@ jobs:
8687
-DAMReX_GPU_BACKEND=SYCL \
8788
-DCMAKE_C_COMPILER=$(which icx) \
8889
-DCMAKE_CXX_COMPILER=$(which icpx) \
89-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
90+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
91+
-DAMReX_PARALLEL_LINK_JOBS=2
9092
cmake --build build --parallel 2
9193
9294
ccache -s
@@ -136,7 +138,8 @@ jobs:
136138
-DAMReX_GPU_BACKEND=SYCL \
137139
-DCMAKE_C_COMPILER=$(which icx) \
138140
-DCMAKE_CXX_COMPILER=$(which clang++) \
139-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
141+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
142+
-DAMReX_PARALLEL_LINK_JOBS=2
140143
cmake --build build --parallel 2
141144
142145
ccache -s
@@ -186,7 +189,8 @@ jobs:
186189
-DAMReX_SYCL_SUB_GROUP_SIZE=64 \
187190
-DCMAKE_C_COMPILER=$(which icx) \
188191
-DCMAKE_CXX_COMPILER=$(which clang++) \
189-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
192+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
193+
-DAMReX_PARALLEL_LINK_JOBS=2
190194
cmake --build build --parallel 2
191195
192196
ccache -s

Docs/sphinx_documentation/source/GPU.rst

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ variables to configure the build
217217
+------------------------------+-------------------------------------------------+-------------+-----------------+
218218
| SYCL_SUB_GROUP_SIZE | Specify subgroup size | 32 | 64, 32, 16 |
219219
+------------------------------+-------------------------------------------------+-------------+-----------------+
220-
| SYCL_MAX_PARALLEL_LINK_JOBS | Number of parallel jobs in device link | 1 | 1, 2, 3, etc. |
220+
| SYCL_PARALLEL_LINK_JOBS | Number of parallel jobs in device link | 1 | 1, 2, 3, etc. |
221221
+------------------------------+-------------------------------------------------+-------------+-----------------+
222222
.. raw:: latex
223223

@@ -428,22 +428,24 @@ Below is an example configuration for SYCL:
428428

429429
.. table:: AMReX SYCL-specific build options
430430

431-
+------------------------------+-------------------------------------------------+-------------+-----------------+
432-
| Variable Name | Description | Default | Possible values |
433-
+==============================+=================================================+=============+=================+
434-
| AMReX_SYCL_AOT | Enable SYCL ahead-of-time compilation | NO | YES, NO |
435-
+------------------------------+-------------------------------------------------+-------------+-----------------+
436-
| AMReX_SYCL_AOT_GRF_MODE | Specify AOT register file mode | Default | Default, Large, |
437-
| | | | AutoLarge |
438-
+------------------------------+-------------------------------------------------+-------------+-----------------+
439-
| AMREX_INTEL_ARCH | Specify target if AOT is enabled | None | pvc, etc. |
440-
+------------------------------+-------------------------------------------------+-------------+-----------------+
441-
| AMReX_SYCL_SPLIT_KERNEL | Enable SYCL kernel splitting | YES | YES, NO |
442-
+------------------------------+-------------------------------------------------+-------------+-----------------+
443-
| AMReX_SYCL_ONEDPL | Enable SYCL's oneDPL algorithms | NO | YES, NO |
444-
+------------------------------+-------------------------------------------------+-------------+-----------------+
445-
| AMReX_SYCL_SUB_GROUP_SIZE | Specify subgroup size | 32 | 64, 32, 16 |
446-
+------------------------------+-------------------------------------------------+-------------+-----------------+
431+
+-------------------------------+----------------------------------------------+-------------+------------------+
432+
| Variable Name | Description | Default | Possible values |
433+
+===============================+==============================================+=============+==================+
434+
| AMReX_SYCL_AOT | Enable SYCL ahead-of-time compilation | NO | YES, NO |
435+
+-------------------------------+----------------------------------------------+-------------+------------------+
436+
| AMReX_SYCL_AOT_GRF_MODE | Specify AOT register file mode | Default | Default, Large, |
437+
| | | | AutoLarge |
438+
+-------------------------------+----------------------------------------------+-------------+------------------+
439+
| AMREX_INTEL_ARCH | Specify target if AOT is enabled | None | pvc, etc. |
440+
+-------------------------------+----------------------------------------------+-------------+------------------+
441+
| AMReX_SYCL_SPLIT_KERNEL | Enable SYCL kernel splitting | YES | YES, NO |
442+
+-------------------------------+----------------------------------------------+-------------+------------------+
443+
| AMReX_SYCL_ONEDPL | Enable SYCL's oneDPL algorithms | NO | YES, NO |
444+
+-------------------------------+----------------------------------------------+-------------+------------------+
445+
| AMReX_SYCL_SUB_GROUP_SIZE | Specify subgroup size | 32 | 64, 32, 16 |
446+
+-------------------------------+----------------------------------------------+-------------+------------------+
447+
| AMReX_PARALLEL_LINK_JOBS | Specify number of parallel link jobs | 1 | positive integer |
448+
+-------------------------------+----------------------------------------------+-------------+------------------+
447449
.. raw:: latex
448450

449451
\end{center}

Tools/CMake/AMReXFlagsTargets.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ target_compile_options( Flags_CXX
8989
$<${_cxx_appleclang_rwdbg}:>
9090
$<${_cxx_appleclang_rel}:>
9191
$<${_cxx_intelllvm_dbg}:-O0 -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable>
92-
$<${_cxx_intelllvm_rwdbg}:-g1>
92+
$<${_cxx_intelllvm_rwdbg}:-gline-tables-only -fdebug-info-for-profiling> # recommended by Intel VTune
9393
$<${_cxx_intelllvm_rel}:>
9494
)
9595

Tools/CMake/AMReXOptions.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ if (AMReX_SYCL)
213213
endif()
214214
endif()
215215

216+
set(AMReX_PARALLEL_LINK_JOBS_DEFAULT 1)
217+
if (DEFINED ENV{AMREX_PARALLEL_LINK_JOBS})
218+
set(AMReX_PARALLEL_LINK_JOBS_DEFAULT "$ENV{AMREX_PARALLEL_LINK_JOBS}")
219+
endif()
220+
set(AMReX_PARALLEL_LINK_JOBS ${AMReX_PARALLEL_LINK_JOBS_DEFAULT}
221+
CACHE STRING "SYCL max parallel link jobs")
222+
if (NOT AMReX_PARALLEL_LINK_JOBS GREATER_EQUAL 1 OR
223+
NOT AMReX_PARALLEL_LINK_JOBS MATCHES "^[1-9][0-9]*$")
224+
message(FATAL_ERROR "AMReX_PARALLEL_LINK_JOBS (${AMReX_PARALLEL_LINK_JOBS}) must be a positive integer")
225+
endif()
216226
endif ()
217227

218228
# --- HIP ----

Tools/CMake/AMReXSYCL.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,10 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND "${CMAKE_BUILD_TYPE}" MATCHES "Debug"
8888
"$<${_cxx_sycl}:-fsycl-link-huge-device-code>" )
8989
endif ()
9090

91+
if (AMReX_PARALLEL_LINK_JOBS GREATER 1)
92+
target_link_options( SYCL
93+
INTERFACE
94+
$<${_cxx_sycl}:-fsycl-max-parallel-link-jobs=${AMReX_PARALLEL_LINK_JOBS}>)
95+
endif()
96+
9197
unset(_cxx_sycl)

0 commit comments

Comments
 (0)