Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions FORTRAN/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ include("${CMAKE_CURRENT_LIST_DIR}/../cmake/PRKFortranFeatures.cmake")
prk_check_coarray_single()
prk_check_coarray_lib()
prk_check_openmp_offload()
if(PRK_OPENMP_OFFLOAD_FLAG)
prk_check_openmp_target_loop()
endif()
prk_check_openacc_links()

set(PRK_WITH_COARRAY FALSE)
Expand Down Expand Up @@ -162,10 +165,15 @@ if(PRK_WITH_OFFLOAD)
prk_fortran_executable(transpose-openmp-target SOURCES transpose-openmp-target.F90 FLAGS ${PRK_OPENMP_OFFLOAD_FLAG})
prk_fortran_executable(nstream-openmp-target SOURCES nstream-openmp-target.F90 FLAGS ${PRK_OPENMP_OFFLOAD_FLAG})
prk_fortran_executable(dgemm-openmp-target SOURCES dgemm-openmp-target.F90 FLAGS ${PRK_OPENMP_OFFLOAD_FLAG})
prk_fortran_executable(transpose-openmp-target-loop SOURCES transpose-openmp-target-loop.F90 FLAGS ${PRK_OPENMP_OFFLOAD_FLAG})
add_custom_target(fortran_target DEPENDS
fortran_stencil-openmp-target fortran_transpose-openmp-target fortran_nstream-openmp-target
fortran_dgemm-openmp-target fortran_transpose-openmp-target-loop)
fortran_dgemm-openmp-target)
if(PRK_OPENMP_TARGET_LOOP_COMPILES)
prk_fortran_executable(transpose-openmp-target-loop SOURCES transpose-openmp-target-loop.F90 FLAGS ${PRK_OPENMP_OFFLOAD_FLAG})
add_dependencies(fortran_target fortran_transpose-openmp-target-loop)
else()
message(STATUS "FORTRAN transpose-openmp-target-loop: skipped, compiler lacks OpenMP 'target teams loop'")
endif()
else()
message(STATUS "FORTRAN target (OpenMP offload): skipped, no working target-offload flags found")
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/AutobuildDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function(prk_autobuild_global_arrays)
PREFIX "${_ga_prefix}"
BUILD_IN_SOURCE TRUE
CONFIGURE_COMMAND ${_prk_autoreconf} -vif
COMMAND <SOURCE_DIR>/configure --with-armci=${_armci_install_dir}
COMMAND <SOURCE_DIR>/configure --with-armci=${_armci_install_dir} --without-scalapack
MPICC=${_prk_mpicc} MPIFC=${_prk_mpif90} MPIF77=${_prk_mpif90}
--prefix=<INSTALL_DIR>
BUILD_COMMAND make
Expand Down
14 changes: 14 additions & 0 deletions cmake/PRKFortranFeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,17 @@ function(prk_check_openmp_offload)
message(STATUS "Fortran OpenMP target offload: compiled but failed to run correctly (broken offload runtime)")
endif()
endfunction()

# Some compilers (e.g. gfortran) accept `!$omp target` but not the OpenMP 5.0
# `loop` construct used by transpose-openmp-target-loop.F90. Probe it
# separately (compile-only) so that one source can be skipped on its own.
function(prk_check_openmp_target_loop)
if(DEFINED PRK_OPENMP_TARGET_LOOP_COMPILES)
return()
endif()
set(_src "program main\n integer :: i, j\n real :: a(4,4)\n !$omp target teams loop collapse(2)\n do j=1,4\n do i=1,4\n a(i,j) = 0\n enddo\n enddo\n !$omp end target teams loop\nend program main\n")
string(REPLACE ";" " " _flags "${PRK_OPENMP_OFFLOAD_FLAG}")
set(CMAKE_REQUIRED_FLAGS "${_flags}")
check_fortran_source_compiles("${_src}" PRK_OPENMP_TARGET_LOOP_COMPILES SRC_EXT F90)
unset(CMAKE_REQUIRED_FLAGS)
endfunction()
Loading