From caea6097f8ffe608561c16f16807b2ce75c8d711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Sp=C3=B6rri?= Date: Fri, 21 Jul 2017 11:30:15 +0200 Subject: [PATCH] Fix compilation on Kesch-TDS --- openacc_cuda_sample/CMakeLists.txt | 2 +- openacc_cuda_sample/cray.cmake | 7 +++---- openacc_cuda_sample/src/m_parameterizations.f90 | 10 +++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/openacc_cuda_sample/CMakeLists.txt b/openacc_cuda_sample/CMakeLists.txt index d3942e8..e7fa8fd 100644 --- a/openacc_cuda_sample/CMakeLists.txt +++ b/openacc_cuda_sample/CMakeLists.txt @@ -51,4 +51,4 @@ add_executable(openacc_cuda_sample ${FORTRAN_SRC} ${CUDA_COMPILED} ) -target_link_libraries(openacc_cuda_sample stdc++ gcc_eh) +target_link_libraries(openacc_cuda_sample stdc++ gcc_eh ${CUDA_LIBRARIES}) diff --git a/openacc_cuda_sample/cray.cmake b/openacc_cuda_sample/cray.cmake index 3485057..180b702 100644 --- a/openacc_cuda_sample/cray.cmake +++ b/openacc_cuda_sample/cray.cmake @@ -12,13 +12,12 @@ endif() SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenACC_FLAGS}") - -# Release -SET(CMAKE_Fortran_FLAGS_RELEASE "") +# Remove "-rdynamic" from the link options +SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) # Debug Options (replace default) if (TARGET_GPU) set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -g") else() set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -g -eZ -eD -Rb -Rc -Rd -Rp -Rs") -endif() \ No newline at end of file +endif() diff --git a/openacc_cuda_sample/src/m_parameterizations.f90 b/openacc_cuda_sample/src/m_parameterizations.f90 index 03dd80e..c46057e 100644 --- a/openacc_cuda_sample/src/m_parameterizations.f90 +++ b/openacc_cuda_sample/src/m_parameterizations.f90 @@ -4,7 +4,7 @@ ! module containing the physical parameterizations MODULE m_parameterizations - USE iso_c_binding, ONLY: C_LOC + USE iso_c_binding, ONLY: C_LOC, C_DOUBLE IMPLICIT NONE @@ -25,9 +25,9 @@ SUBROUTINE saturation_adjustment(npx, npy, nlev, t, qc, qv) ! arguments INTEGER, INTENT(IN) :: npx, npy, nlev ! dimensions of inputs - REAL*8, INTENT(IN) :: t(:,:,:) ! temperature - REAL*8, INTENT(OUT) :: qc(:,:,:) ! cloud water content - REAL*8, INTENT(INOUT) :: qv(:,:,:) ! water vapour content + REAL*8, INTENT(IN), TARGET :: t(:,:,:) ! temperature + REAL*8, INTENT(OUT), TARGET :: qc(:,:,:) ! cloud water content + REAL*8, INTENT(INOUT), TARGET :: qv(:,:,:) ! water vapour content ! Interface to CUDA wrapper function using iso_c_binding INTERFACE @@ -37,7 +37,7 @@ SUBROUTINE saturation_adjustment_cuda( ntot, t, qc, qv, & BIND(c, name='saturation_adjustment_cuda') USE, INTRINSIC :: iso_c_binding INTEGER(C_INT), VALUE :: ntot - TYPE(C_PTR), VALUE :: t, qc, qv + TYPE(C_PTR), VALUE, TARGET :: t, qc, qv REAL(KIND=C_DOUBLE), VALUE :: cs1, cs2, cs3, cs4, t0 END SUBROUTINE saturation_adjustment_cuda END INTERFACE