test_ELPA.cmake 2.39 KB
Newer Older
1 2
#First check if we can compile with ELPA
try_compile(FLEUR_USE_ELPA ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA.f90
3
LINK_LIBRARIES ${FLEUR_LIBRARIES})
4

5
if (NOT FLEUR_USE_ELPA)
Gregor Michalicek's avatar
Gregor Michalicek committed
6
   set(STORE_FLAGS "${CMAKE_Fortran_FLAGS}")
7 8 9 10
   if (DEFINED ENV{ELPA_MODULES})
      set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I$ENV{ELPA_MODULES}")
   endif()
   if (DEFINED ENV{ELPA_LIB})
Uliana Alekseeva's avatar
Uliana Alekseeva committed
11
      set(TEST_LIBRARIES "-L$ENV{ELPA_LIB};-lelpa_openmp;-lstdc++;${FLEUR_LIBRARIES}")
12 13 14 15 16 17
   endif()
   try_compile(FLEUR_USE_ELPA ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA.f90
LINK_LIBRARIES ${TEST_LIBRARIES})
   if (FLEUR_USE_ELPA)
      set(FLEUR_LIBRARIES "${TEST_LIBRARIES}")
   else()
Gregor Michalicek's avatar
Gregor Michalicek committed
18
      set(CMAKE_Fortran_FLAGS "${STORE_FLAGS}")
19 20 21 22
   endif()
endif()


23 24
message("ELPA Library found:${FLEUR_USE_ELPA}")

25
#Now check for version of elpa
26
if (FLEUR_USE_ELPA)
Uliana Alekseeva's avatar
Uliana Alekseeva committed
27
    set(FLEUR_USE_ELPA false)
28 29 30 31 32
    try_compile(FLEUR_USE_ELPA_OLD ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_OLD.f90
LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_NEW ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_NEW.f90
LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_201605003 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_201605003.f90
Daniel Wortmann's avatar
Daniel Wortmann committed
33 34
LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_201605004 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_201605004.f90
35 36 37 38 39
LINK_LIBRARIES ${FLEUR_LIBRARIES})
    message("Version check for ELPA:")
    message("OLD ELPA      : ${FLEUR_USE_ELPA_OLD}")
    message("NEW ELPA      : ${FLEUR_USE_ELPA_NEW}")
    message("201605003 ELPA: ${FLEUR_USE_ELPA_201605003}")
Daniel Wortmann's avatar
Daniel Wortmann committed
40
    message("201605004 ELPA: ${FLEUR_USE_ELPA_201605004}")
41 42
#Set preprocessor switches
   if (FLEUR_USE_ELPA_OLD)
43
       set(FLEUR_USE_ELPA TRUE)
44 45 46
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2")
   endif()
   if (FLEUR_USE_ELPA_NEW)
47
       set(FLEUR_USE_ELPA TRUE)
48 49 50
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_NEW")
   endif()
   if (FLEUR_USE_ELPA_201605003)
51
       set(FLEUR_USE_ELPA TRUE)
52 53
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_201605003")
   endif()
Daniel Wortmann's avatar
Daniel Wortmann committed
54 55 56 57
   if (FLEUR_USE_ELPA_201605004)
       set(FLEUR_USE_ELPA TRUE)
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_201605004")
   endif()
58
endif()