Skip to content

Commit

Permalink
CMake: AMReX_SYCL_PARALLEL_LINK_JOBS
Browse files Browse the repository at this point in the history
Add AMReX_SYCL_PARALLEL_LINK_JOBS option to the CMake build system.

Adjust SYCL's RelWithDebInfo mode to the recommendation of Intel VTune.

This is a follow-up on AMReX-Codes#3498 that made similar changes to GNU Make.
  • Loading branch information
WeiqunZhang committed Nov 14, 2023
1 parent b7408ea commit 5e90ea1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 22 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
-DCMAKE_C_COMPILER=$(which icx) \
-DCMAKE_CXX_COMPILER=$(which icpx) \
-DCMAKE_Fortran_COMPILER=$(which ifx) \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DAMReX_SYCL_PARALLEL_LINK_JOBS=2
cmake --build build --parallel 2
ccache -s
Expand Down Expand Up @@ -86,7 +87,8 @@ jobs:
-DAMReX_GPU_BACKEND=SYCL \
-DCMAKE_C_COMPILER=$(which icx) \
-DCMAKE_CXX_COMPILER=$(which icpx) \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DAMReX_SYCL_PARALLEL_LINK_JOBS=2
cmake --build build --parallel 2
ccache -s
Expand Down Expand Up @@ -136,7 +138,8 @@ jobs:
-DAMReX_GPU_BACKEND=SYCL \
-DCMAKE_C_COMPILER=$(which icx) \
-DCMAKE_CXX_COMPILER=$(which clang++) \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DAMReX_SYCL_PARALLEL_LINK_JOBS=2
cmake --build build --parallel 2
ccache -s
Expand Down Expand Up @@ -186,7 +189,8 @@ jobs:
-DAMReX_SYCL_SUB_GROUP_SIZE=64 \
-DCMAKE_C_COMPILER=$(which icx) \
-DCMAKE_CXX_COMPILER=$(which clang++) \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DAMReX_SYCL_PARALLEL_LINK_JOBS=2
cmake --build build --parallel 2
ccache -s
Expand Down
36 changes: 19 additions & 17 deletions Docs/sphinx_documentation/source/GPU.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ variables to configure the build
+------------------------------+-------------------------------------------------+-------------+-----------------+
| SYCL_SUB_GROUP_SIZE | Specify subgroup size | 32 | 64, 32, 16 |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| SYCL_MAX_PARALLEL_LINK_JOBS | Number of parallel jobs in device link | 1 | 1, 2, 3, etc. |
| SYCL_PARALLEL_LINK_JOBS | Number of parallel jobs in device link | 1 | 1, 2, 3, etc. |
+------------------------------+-------------------------------------------------+-------------+-----------------+
.. raw:: latex

Expand Down Expand Up @@ -428,22 +428,24 @@ Below is an example configuration for SYCL:

.. table:: AMReX SYCL-specific build options

+------------------------------+-------------------------------------------------+-------------+-----------------+
| Variable Name | Description | Default | Possible values |
+==============================+=================================================+=============+=================+
| AMReX_SYCL_AOT | Enable SYCL ahead-of-time compilation | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_SYCL_AOT_GRF_MODE | Specify AOT register file mode | Default | Default, Large, |
| | | | AutoLarge |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMREX_INTEL_ARCH | Specify target if AOT is enabled | None | pvc, etc. |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_SYCL_SPLIT_KERNEL | Enable SYCL kernel splitting | YES | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_SYCL_ONEDPL | Enable SYCL's oneDPL algorithms | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_SYCL_SUB_GROUP_SIZE | Specify subgroup size | 32 | 64, 32, 16 |
+------------------------------+-------------------------------------------------+-------------+-----------------+
+-------------------------------+----------------------------------------------+-------------+------------------+
| Variable Name | Description | Default | Possible values |
+===============================+==============================================+=============+==================+
| AMReX_SYCL_AOT | Enable SYCL ahead-of-time compilation | NO | YES, NO |
+-------------------------------+----------------------------------------------+-------------+------------------+
| AMReX_SYCL_AOT_GRF_MODE | Specify AOT register file mode | Default | Default, Large, |
| | | | AutoLarge |
+-------------------------------+----------------------------------------------+-------------+------------------+
| AMREX_INTEL_ARCH | Specify target if AOT is enabled | None | pvc, etc. |
+-------------------------------+----------------------------------------------+-------------+------------------+
| AMReX_SYCL_SPLIT_KERNEL | Enable SYCL kernel splitting | YES | YES, NO |
+-------------------------------+----------------------------------------------+-------------+------------------+
| AMReX_SYCL_ONEDPL | Enable SYCL's oneDPL algorithms | NO | YES, NO |
+-------------------------------+----------------------------------------------+-------------+------------------+
| AMReX_SYCL_SUB_GROUP_SIZE | Specify subgroup size | 32 | 64, 32, 16 |
+-------------------------------+----------------------------------------------+-------------+------------------+
| AMReX_SYCL_PARALLEL_LINK_JOBS | Specify number of parallel link jobs | 1 | positive integer |
+-------------------------------+----------------------------------------------+-------------+------------------+
.. raw:: latex

\end{center}
Expand Down
2 changes: 1 addition & 1 deletion Tools/CMake/AMReXFlagsTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ target_compile_options( Flags_CXX
$<${_cxx_appleclang_rwdbg}:>
$<${_cxx_appleclang_rel}:>
$<${_cxx_intelllvm_dbg}:-O0 -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable>
$<${_cxx_intelllvm_rwdbg}:-g1>
$<${_cxx_intelllvm_rwdbg}:-gline-tables-only -fdebug-info-for-profiling> # recommended by Intel VTune
$<${_cxx_intelllvm_rel}:>
)

Expand Down
10 changes: 10 additions & 0 deletions Tools/CMake/AMReXOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ if (AMReX_SYCL)
endif()
endif()

set(AMReX_SYCL_PARALLEL_LINK_JOBS_DEFAULT 1)
if (DEFINED ENV{AMREX_SYCL_PARALLEL_LINK_JOBS})
set(AMReX_SYCL_PARALLEL_LINK_JOBS_DEFAULT "$ENV{AMREX_SYCL_PARALLEL_LINK_JOBS}")
endif()
set(AMReX_SYCL_PARALLEL_LINK_JOBS ${AMReX_SYCL_PARALLEL_LINK_JOBS_DEFAULT}
CACHE STRING "SYCL max parallel link jobs")
if (NOT AMReX_SYCL_PARALLEL_LINK_JOBS GREATER_EQUAL 1 OR
NOT AMReX_SYCL_PARALLEL_LINK_JOBS MATCHES "^[1-9][0-9]*$")
message(FATAL_ERROR "AMReX_SYCL_PARALLEL_LINK_JOBS (${AMReX_SYCL_PARALLEL_LINK_JOBS}) must be an integer >= 1")
endif()
endif ()

# --- HIP ----
Expand Down
6 changes: 6 additions & 0 deletions Tools/CMake/AMReXSYCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,10 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND "${CMAKE_BUILD_TYPE}" MATCHES "Debug"
"$<${_cxx_sycl}:-fsycl-link-huge-device-code>" )
endif ()

if (AMReX_SYCL_PARALLEL_LINK_JOBS GREATER 1)
target_link_options( SYCL
INTERFACE
$<${_cxx_sycl}:-fsycl-max-parallel-link-jobs=${AMReX_SYCL_PARALLEL_LINK_JOBS}>)
endif()

unset(_cxx_sycl)

0 comments on commit 5e90ea1

Please sign in to comment.