Skip to content

Commit

Permalink
Merge pull request QMCPACK#5064 from ye-luo/oneapi-aot
Browse files Browse the repository at this point in the history
Enable ahead-of-time compilation when using oneapi
  • Loading branch information
ye-luo authored Jun 27, 2024
2 parents ac18a8b + 997dc30 commit 237f3f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
18 changes: 14 additions & 4 deletions CMake/IntelCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ endif()
if(QMC_OMP)
if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
if(ENABLE_OFFLOAD)
set(OFFLOAD_TARGET
"spir64"
CACHE STRING "Offload target architecture")
set(OPENMP_OFFLOAD_COMPILE_OPTIONS "-fopenmp-targets=${OFFLOAD_TARGET}")
if(DEFINED OFFLOAD_ARCH OR QMC_GPU_ARCHS)
# for ahead-of-time compilation and linking
set(OPENMP_OFFLOAD_COMPILE_OPTIONS "-fopenmp-targets=spir64_gen")
if(DEFINED OFFLOAD_ARCH)
set(OpenMP_OFFLOAD_LINKER_FLAGS "-Xs \"-device ${OFFLOAD_ARCH}\"")
else()
set(OpenMP_OFFLOAD_LINKER_FLAGS "-Xs \"-device ${QMC_GPU_ARCHS}\"")
endif()
else()
set(OFFLOAD_TARGET
"spir64"
CACHE STRING "Offload target architecture")
set(OPENMP_OFFLOAD_COMPILE_OPTIONS "-fopenmp-targets=${OFFLOAD_TARGET}")
endif()
endif(ENABLE_OFFLOAD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fiopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fiopenmp")
Expand Down
2 changes: 1 addition & 1 deletion CMake/IntelDPCPPConfig-modified.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ if(WIN32)
list(APPEND SYCL_FLAGS "/EHsc")
endif()

set(SYCL_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SYCL_FLAGS}")
set(SYCL_CXX_FLAGS "${SYCL_FLAGS}")

# And now test the assumptions.

Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ if(QMC_OMP)
if(ENABLE_OFFLOAD AND DEFINED OPENMP_OFFLOAD_COMPILE_OPTIONS)
message(STATUS "OpenMP offload CXX flags: ${OPENMP_OFFLOAD_COMPILE_OPTIONS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENMP_OFFLOAD_COMPILE_OPTIONS}")
if(DEFINED OpenMP_OFFLOAD_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_OFFLOAD_LINKER_FLAGS}")
endif()
endif()

#--------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion config/build_alcf_aurora_icpx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if [[ $name == *"_MP"* ]]; then
fi

if [[ $name == *"offload"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_OFFLOAD=ON"
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_OFFLOAD=ON -DQMC_GPU_ARCHS=pvc"
CMAKE_CXX_FLAGS="-mllvm -vpo-paropt-atomic-free-reduction-slm=true"
fi

Expand Down
2 changes: 1 addition & 1 deletion config/build_alcf_sunspot_icpx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if [[ $name == *"_MP"* ]]; then
fi

if [[ $name == *"offload"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_OFFLOAD=ON"
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_OFFLOAD=ON -DQMC_GPU_ARCHS=pvc"
CMAKE_CXX_FLAGS="-mllvm -vpo-paropt-atomic-free-reduction-slm=true"
fi

Expand Down

0 comments on commit 237f3f0

Please sign in to comment.