compilerflags.cmake 4.14 KB
Newer Older
1
#cmake file to set compiler flags for some of the known compilers
2
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
3
   message("Intel Fortran detected")
4
   set(FLEUR_PRECISION_OPTION "-r8")
5 6
   if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS "13.0.0.0")
      set(FLEUR_WARN_MESSAGE "You are using an old version of the Intel Fortran Compiler. Most likely FLEUR will not be build sucessfully. Consider to upgrade your compiler.")
7
      set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -openmp -assume byterecl")
8 9
      set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_OLDINTEL")
      set(FLEUR_DEFINITIONS ${FLEUR_DEFINITIONS} "CPP_OLDINTEL")   
10
   elseif (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS "14.1.0.0")
11
      set(FLEUR_WARN_MESSAGE "You are using an old version of the Intel Fortran Compiler. The execution of the fleur_MPI might fail. Consider to upgrade your compiler.")
12
      set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -openmp -assume byterecl")
13 14 15
   elseif (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS "17.0.0.0")
      set(FLEUR_WARN_MESSAGE "You are using an old version of the Intel Fortran Compiler. The execution of the fleur_MPI might fail. Consider to upgrade your compiler.")
      set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -r8 -qopenmp -assume byterecl")
16
   else()
17
      set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -qopenmp -assume byterecl")
18
   endif()     
19
   set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -xHost -O2 -g")
20 21 22 23 24
   if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS "19.0.0.0")
       set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C -traceback -O0 -g -ftrapuv -check uninit -check pointers -DCPP_DEBUG")
   else()
       set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -CB -traceback -O0 -g -ftrapuv -check uninit -check pointers -DCPP_DEBUG")
   endif()
25
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI")
26
   set(FLEUR_PRECISION_OPTION "-Mr8 -Mr8intrinsics")
27
   message("PGI Fortran detected")
Daniel Wortmann's avatar
Daniel Wortmann committed
28
   set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") #fix problem in cmake
29
   #CPU   
30
   set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}  -mp")
31
   #GPU
32 33 34
   #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mp  -Mcuda=cuda9.0,cc60 -Mcudalib=cublas")
   #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mp  -Mcuda:kepler+ -ta:tesla:cuda7.5 -DUSE_STREAMS -DNUM_STREAMS=${N_STREAMS} -Minfo=accel -acc")
   #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mp   -Mcuda:cuda9.0,cc70 -DUSE_STREAMS -DNUM_STREAMS=${N_STREAMS} -Minfo=accel -acc")
35
   #set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fast -O3")
Uliana Alekseeva's avatar
Uliana Alekseeva committed
36
   set(CMAKE_Fortran_FLAGS_RELEASE "-O1 ") # to prevent cmake from putting -fast which auses problems with PGI18.4
37
   set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C -traceback -O0 -g -Mchkstk -Mchkptr -Ktrap=fp -DCPP_DEBUG")
38
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "XL")
39
   message("IBM/BG Fortran detected")
40 41
   set(FLEUR_PRECISION_OPTION "-qrealsize=8")
   set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qsmp=omp -qnosave -qarch=qp -qtune=qp  -qfixed -qsuppress=1520-022 -qessl") 
42
   set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O4   -qsuppress=1500-036")
43
   set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}  -O0 -g -DCPP_DEBUG")
44 45 46 47
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/bgsys/local/libxml2/include/libxml2")
   set(FLEUR_DEFINITIONS ${FLEUR_DEFINITIONS} "CPP_AIX")
   set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_AIX")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
48
   message("gfortran detected")
49
   set(FLEUR_PRECISION_OPTION "-fdefault-real-8")
50
   if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS "6.1.0")
51 52
      message(FATAL_ERROR "Only modern versions of gfortran >6.3 will be able to compile FLEUR\nYou need to specify a different compiler.\nSee the docs at www.flapw.de.\n")
   endif()
53
   set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none -fopenmp ")
Matthias Redies's avatar
Matthias Redies committed
54
   set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O2")
55
   set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fdump-core -Wall -Wextra -Warray-temporaries  -fbacktrace -fcheck=all  -finit-real=nan -O0 -g -DCPP_DEBUG")
56
endif()