diff --git a/CMakeLists.txt b/CMakeLists.txt index eb709cbe0..5ffa15283 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,9 +29,12 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) # Set some options the user may choose # Uncomment the below if you want the user to choose a parallelization library -OPTION(USE_CAF "Use Coarray Fortran for parallelization" ON) +OPTION(USE_COARRAY "Use Coarray Fortran for parallelization" OFF) OPTION(USE_OPENMP "Use OpenMP for parallelization" ON) +IF (USE_COARRAY) + ADD_DEFINITIONS(-DCOARRAY) +ENDIF() # Locate and set parallelization libraries. There are some CMake peculiarities # taken care of here, such as the fact that the FindOpenMP routine doesn't know diff --git a/cmake/Modules/FindCoarray_Fortran.cmake b/cmake/Modules/FindCoarray_Fortran.cmake index 05f28ef0a..314371326 100644 --- a/cmake/Modules/FindCoarray_Fortran.cmake +++ b/cmake/Modules/FindCoarray_Fortran.cmake @@ -25,17 +25,31 @@ INCLUDE (${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +STRING(TOUPPER "${CMAKE_BUILD_TYPE}" BT) +IF(BT STREQUAL "DEBUG") + SET (Coarray_Fortran_FLAG_CANDIDATES + #Intel + "-coarray=single" + #Intel windows + "/Qcoarray:single" + #Gnu + "-fcoarray=single" + #Empty, if compiler automatically accepts coarray + " " + ) +ELSE() + SET (Coarray_Fortran_FLAG_CANDIDATES + #Intel + "-coarray=distributed" + #Intel windows + "/Qcoarray:distributed" + #Gnu + "-fcoarray=lib -lcaf_mpi" + #Empty, if compiler automatically accepts coarray + " " + ) +ENDIF() -SET (Coarray_Fortran_FLAG_CANDIDATES - #Intel - "-coarray=distributed" - #Intel windows - "/Qcoarray:distributed" - #Gnu - "-fcoarray=lib -lcaf_mpi" - #Empty, if compiler automatically accepts coarray - " " -) IF (DEFINED Coarray_Fortran_FLAGS) SET (Coarray_Fortran_FLAG_CANDIDATES) diff --git a/cmake/Modules/SetParallelizationLibrary.cmake b/cmake/Modules/SetParallelizationLibrary.cmake index 3f3153f4d..505a77d62 100644 --- a/cmake/Modules/SetParallelizationLibrary.cmake +++ b/cmake/Modules/SetParallelizationLibrary.cmake @@ -17,21 +17,20 @@ IF (USE_OPENMP) ENDIF (NOT OpenMP_Fortran_FLAGS) ENDIF (USE_OPENMP) -IF (USE_CAF) - # Find MPI +IF (USE_COARRAY) IF (NOT Coarray_Fortran_FLAGS) FIND_PACKAGE (Coarray_Fortran) IF (NOT Coarray_Fortran_FLAGS) MESSAGE (FATAL_ERROR "Fortran compiler does not support Coarrays") ENDIF (NOT Coarray_Fortran_FLAGS) ENDIF (NOT Coarray_Fortran_FLAGS) -ENDIF (USE_CAF) +ENDIF (USE_COARRAY) -IF (NOT USE_OPENMP AND NOT USE_CAF) +IF (NOT USE_OPENMP AND NOT USE_COARRAY) # Turn off both OpenMP and CAF SET (OMP_NUM_PROCS 0 CACHE STRING "Number of processors OpenMP may use" FORCE) UNSET (OpenMP_Fortran_FLAGS CACHE) UNSET (Coarray_Fortran_FLAGS CACHE) UNSET (GOMP_Fortran_LINK_FLAGS CACHE) -ENDIF (NOT USE_OPENMP AND NOT USE_CAF) +ENDIF (NOT USE_OPENMP AND NOT USE_COARRAY)