test_ELPA.cmake 2.78 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
if (NOT FLEUR_USE_ELPA)
5 6 7 8
   if (DEFINED CLI_ELPA_OPENMP)
      set(TEST_LIBRARIES "${FLEUR_LIBRARIES};-lelpa_openmp")
   else()
      set(TEST_LIBRARIES "${FLEUR_LIBRARIES};-lelpa")
9 10 11 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}")
   endif()
endif()


18 19
message("ELPA Library found:${FLEUR_USE_ELPA}")

20
#Now check for version of elpa
21
if (FLEUR_USE_ELPA)
Uliana Alekseeva's avatar
Uliana Alekseeva committed
22
    set(FLEUR_USE_ELPA false)
23 24 25 26 27
    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
28 29
LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_201605004 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_201605004.f90
30 31
LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_201705003 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_201705003.f90
32 33
LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_20180525 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_20180525.f90
34 35 36 37 38
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
39
    message("201605004 ELPA: ${FLEUR_USE_ELPA_201605004}")
40
    message("201705003 ELPA: ${FLEUR_USE_ELPA_201705003}")
41
    message("20180525  ELPA: ${FLEUR_USE_ELPA_20180525}")
42 43
#Set preprocessor switches
   if (FLEUR_USE_ELPA_OLD)
44
       set(FLEUR_USE_ELPA TRUE)
45 46 47
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2")
   endif()
   if (FLEUR_USE_ELPA_NEW)
48
       set(FLEUR_USE_ELPA TRUE)
49 50 51
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_NEW")
   endif()
   if (FLEUR_USE_ELPA_201605003)
52
       set(FLEUR_USE_ELPA TRUE)
53 54
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_201605003")
   endif()
Daniel Wortmann's avatar
Daniel Wortmann committed
55 56 57 58
   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()
59 60 61 62
   if (FLEUR_USE_ELPA_201705003)
       set(FLEUR_USE_ELPA TRUE)
       set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_201705003")
   endif()
63
endif()