mirror of https://gitlab.com/QEF/q-e.git
45 lines
1.8 KiB
CMake
45 lines
1.8 KiB
CMake
# Check compiler version
|
|
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 14.0.0)
|
|
message(FATAL_ERROR "Requires CCE 14.0.0 or higher ")
|
|
endif()
|
|
|
|
message(WARNING "The Cray Fortran compiler is not ready for QE production use.")
|
|
|
|
qe_add_global_compile_definitions(__CRAY)
|
|
|
|
# set preprocessor specific flag
|
|
set(Fortran_PREPROCESSOR_FLAGS "-eZ")
|
|
|
|
if(NOT QE_ENABLE_OPENACC)
|
|
target_compile_options(qe_openacc_fortran INTERFACE "$<$<COMPILE_LANGUAGE:Fortran>:-hnoacc>")
|
|
endif()
|
|
|
|
if(QE_ENABLE_OFFLOAD)
|
|
set(CMAKE_Fortran_FLAGS "-O0")
|
|
if(DEFINED QE_GPU_ARCHS)
|
|
string(REPLACE "gfx" "amd_gfx" ACCEL_TARGET "${QE_GPU_ARCHS}")
|
|
target_compile_options(qe_openmp_fortran INTERFACE "$<$<COMPILE_LANGUAGE:Fortran>:-target-accel=${ACCEL_TARGET}>")
|
|
target_link_options(qe_openmp_fortran INTERFACE "$<$<LINK_LANGUAGE:Fortran>:-target-accel=${ACCEL_TARGET}>")
|
|
else()
|
|
execute_process(
|
|
COMMAND ${CMAKE_Fortran_COMPILER} -craype-verbose --version
|
|
RESULT_VARIABLE VERSION_QUERY_RETURN
|
|
OUTPUT_VARIABLE VERSION_QUERY_OUTPUT)
|
|
|
|
if(VERSION_QUERY_RETURN)
|
|
message(WARNING "Command `${CMAKE_Fortran_COMPILER} -craype-verbose --version` failed!")
|
|
elseif(NOT VERSION_QUERY_OUTPUT MATCHES "accel=")
|
|
message(FATAL_ERROR "Cannot find -haccel=<gpu_arc> option being used by the ftn compiler wrapper. "
|
|
"Make sure the GPU architecture module is loaded."
|
|
"Command `${CMAKE_Fortran_COMPILER} -craype-verbose --version` returns\n"
|
|
"${VERSION_QUERY_OUTPUT}")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
if(QE_ENABLE_OPENMP)
|
|
target_link_options(qe_openmp_fortran INTERFACE "$<$<LINK_LANGUAGE:Fortran>:-homp>")
|
|
else()
|
|
target_compile_options(qe_openmp_fortran INTERFACE "$<$<COMPILE_LANGUAGE:Fortran>:-hnoomp>")
|
|
endif()
|