Commit cdae93dc authored by Daniel Wortmann's avatar Daniel Wortmann

Various fixes to cmake and build system

Added debug option to configure script
TODO:
ELPA version on JURECA can not be used. Interface of ELPA is changed :-(
parent 6dd97722
......@@ -76,7 +76,7 @@ if(${FLEUR_USE_MPI})
#fleur_MPI
add_executable(fleur_MPI ${juDFT_HDF} ${juDFT_SRC_F90} ${fleur_SRC} ${c_filesFleur} ${fleur_SRC_MPI})
target_compile_definitions(fleur_MPI PUBLIC ${FLEUR_MPI_DEFINITIONS})
target_link_libraries(fleur_MPI ${FLEUR_MPI_LIBRARIES})
target_link_libraries(fleur_MPI ${FLEUR_LIBRARIES})
set_target_properties(fleur_MPI PROPERTIES Fortran_MODULE_DIRECTORY fleur_MPI_modules COMPILE_OPTIONS -Ifleur_MPI_modules)
endif ()
......
message("************Summary***************")
message("Compiler: ${CMAKE_Fortran_COMPILER}")
message("Compiler ID:${CMAKE_Fortran_COMPILER_ID}")
message("Flags: ${CMAKE_Fortran_FLAGS}")
message("Libraries:${FLEUR_LIBRARIES}")
message("\nThese Libraries are required:")
......
#cmake file to set compiler flags for some of the known compilers
execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -v OUTPUT_VARIABLE compilerout ERROR_VARIABLE compilerout)
message(${compilerout})
if (${compilerout} MATCHES ".*ifort.*")
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
message("Intel Fortran detected")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -r8 -qopenmp")
if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS "13.0.0.0")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -r8 -openmp")
else()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -r8 -qopenmp")
endif()
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -xHost -O4")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C -traceback -O0 -g")
elseif(${compilerout} MATCHES ".*pgf.*")
elseif(${CMAKE_Fortan_COMPILER_ID} MATCHES "PGI")
message("PGI Fortran detected")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mp -Mr8 -Mr8intrinsics")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fast -O3")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C -traceback -O0 -g -Mchkstk -Mchkptr")
elseif(${compilerout} MATCHES ".*bgxlf.*")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "XL")
message("IBM/BG Fortran detected")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qsmp=omp -qnosave -qarch=qp -qtune=qp -qrealsize=8 -qfixed -qsuppress=1520-022 -qessl")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O4 -qsuppress=1500-036")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -g")
elseif(${compilerout} MATCHES ".*gfort.*")
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")
message("gfortran detected")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none -fopenmp -fdefault-real-8 ")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O4")
......
......@@ -30,8 +30,8 @@ function configure_machine(){
module load HDF5
export CC=mpicc
export FC=mpif90
export CMAKE_Fortran_FLAGS="$CMAKE_Fortran_FLAGS -I$EBROOTELPA/include/elpa_openmp-2015.11.001/modules -I$EBROOTHDF5/include -mkl"
export FLEUR_LIBRARIES="$FLEUR_LIBRARIES;-L$EBROOTELPA/lib;-lelpa_openmp;-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64;-L$EBROOTHDF5/lib;-lhdf5;-lhdf5_fortran"
export CMAKE_Fortran_FLAGS="$CMAKE_Fortran_FLAGS -I$ELPA_MODULES -I$EBROOTHDF5/include -mkl"
export FLEUR_LIBRARIES="$FLEUR_LIBRARIES;-L$ELPA_LIB;-lelpa_openmp;-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64;-L$EBROOTHDF5/lib;-lhdf5;-lhdf5_fortran"
elif module list 2>&1 |grep -q PGI
then
echo "PGI toolchain used"
......@@ -39,7 +39,7 @@ function configure_machine(){
exit
else
echo "You have to load the correct modules for compiling"
echo " a) intel-para, python/1.7.12"
echo " a) intel-para, Python/2.7.12"
echo " or"
echo " b) PGI"
exit
......@@ -59,6 +59,7 @@ function configure_machine(){
elif [ "$machine" = "IFF" ]
then
echo "IFF cluster configuration used"
export CC=mpiicc
export FC=mpiifort
export FLEUR_LIBRARIES="$FLEUR_LIBRARIES;-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64"
#RWTH cluster
......
......@@ -4,7 +4,7 @@ echo "------------ Welcome to the FLEUR configuration script -------------"
#check if -h or --help was given as argument
if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
echo "USAGE: configure.sh MACHINE"
echo "USAGE: configure.sh MACHINE [debug]"
echo "
To help the script finding a proper configuration you should
provide the name of a specific machine to compile on.
......@@ -24,6 +24,8 @@ then
CC -- name of C compiler
FLEUR_LIBRARIES -- list of linker arguments i.e. '-L/lib;-lbla'
CMAKE_Fortran_FLAGS -- list of compiler options i.e. '-r8'"
echo "
By specifying 'debug' in addition to your machine configuration you will build a debugging version"
fi
#Check if we are using the git version and ask if we want to update
if test -d .git
......@@ -57,5 +59,16 @@ fi
mkdir build
cd build
#run cmake
cmake ..
if test "debug" == "$2"
then
echo "Debug version will be build"
BUILD=Debug
else
BUILD=Release
fi
cmake -DCMAKE_BUILD_TYPE=$BUILD ..
echo "Configuration finished"
echo "If no errors occured you should change into directory 'build' "
echo "run 'make' or 'make -j4'"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment