Commit ff41dc65 authored by Daniel Wortmann's avatar Daniel Wortmann
Browse files

Major change in cmake configuration

configure.sh script is doing part of the job now
more details should be found in README (later :-) )
parent dcbd4869
cmake_minimum_required(VERSION 2.8)
project(FLEUR LANGUAGES NONE)
project(FLEUR LANGUAGES C Fortran)
#some variables might be set in the environment
set(FLEUR_LIBRARIES ${FLEUR_LIBRARIES} $ENV{FLEUR_LIBRARIES})
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} $ENV{CMAKE_Fortran_FLAGS}")
if (DEFINED ENV{FLEUR_NO_SERIAL})
set(FLEUR_USE_SERIAL false)
else()
set(FLEUR_USE_SERIAL true)
endif()
include("cmake/CompilerConfig.txt")
include("cmake/Architectures.txt")
include("cmake/ReportConfig.txt")
#Here the targets and the files are defined
include("cmake/Files_and_Targets.txt")
#install(TARGETS fleur inpgen DESTINATION bin)
......
set(FLEUR_DEFINITIONS "CPP_DOUBLE")
set(FLEUR_MPI_DEFINITIONS "CPP_DOUBLE")
include("cmake/compilerflags.cmake")
include("cmake/tests/test_XML.cmake")
include("cmake/tests/test_LAPACK.cmake")
include("cmake/tests/test_HDF5.cmake")
include("cmake/tests/test_MPI.cmake")
if (FLEUR_USE_MPI)
include("cmake/tests/test_SCALAPACK.cmake")
include("cmake/tests/test_ELPA.cmake")
endif()
......@@ -30,7 +30,7 @@ include(vgen/CMakeLists.txt)
include(inpgen/CMakeLists.txt)
include(docs/CMakeLists.txt)
include(tests/CMakeLists.txt)
if (${Fleur_uses_MPI})
if (${FLEUR_USE_MPI})
include(mpi/CMakeLists.txt)
endif()
......@@ -59,47 +59,35 @@ set_source_files_properties(${fleur_F77} PROPERTIES Fortran_FORMAT FIXED)
set_source_files_properties(${inpgen_F90} PROPERTIES Fortran_FORMAT FREE)
set_source_files_properties(${inpgen_F77} PROPERTIES Fortran_FORMAT FIXED)
if (${Fleur_uses_serial})
#Serial executables
add_executable(fleur ${fleur_SRC} ${c_filesFleur})
target_link_libraries(fleur ${HDF5_LIBS} ${LAPACK_LIBS})
set_target_properties(fleur PROPERTIES Fortran_MODULE_DIRECTORY fleur_modules COMPILE_OPTIONS -Ifleur_modules)
if (${FLEUR_USE_SERIAL})
#Serial executables
add_executable(fleur ${fleur_SRC} ${c_filesFleur})
target_compile_definitions(fleur PUBLIC ${FLEUR_DEFINITIONS})
target_link_libraries(fleur ${FLEUR_LIBRARIES})
set_target_properties(fleur PROPERTIES Fortran_MODULE_DIRECTORY fleur_modules COMPILE_OPTIONS -Ifleur_modules)
#inpgen executable
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_filesInpgen})
target_compile_definitions(inpgen PUBLIC ${FLEUR_DEFINITIONS})
target_link_libraries(inpgen ${FLEUR_LIBRARIES})
set_target_properties(inpgen PROPERTIES Fortran_MODULE_DIRECTORY inpgen_modules COMPILE_OPTIONS -Iinpgen_modules)
endif()
#parallel executables
if(${Fleur_uses_MPI})
#Preprocessor switches
if (${Fleur_uses_ELEMENTAL})
set(MPI_DEFINITIONS ${MPI_DEFINITION} -DCPP_ELEMENTAL)
endif()
if (${Fleur_uses_SCALAPACK})
set(MPI_DEFINITIONS ${MPI_DEFINITION} -DCPP_SCALAPACK )
endif()
if (${Fleur_uses_ELPA})
set(MPI_DEFINITIONS ${MPI_DEFINITION} -DCPP_ELPA -DCPP_ELPA2 )
endif()
set(MPI_DEFINITIONS -DCPP_MPI -DCPP_EVP ${MPI_DEFINITIONS})
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 ${MPI_DEFINITIONS})
target_link_libraries(fleur_MPI ${HDF5_LIBS} ${LAPACK_LIBS})
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})
set_target_properties(fleur_MPI PROPERTIES Fortran_MODULE_DIRECTORY fleur_MPI_modules COMPILE_OPTIONS -Ifleur_MPI_modules)
endif ()
#inpgen executable
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_filesInpgen})
set_target_properties(inpgen PROPERTIES Fortran_MODULE_DIRECTORY inpgen_modules COMPILE_OPTIONS -Iinpgen_modules)
if (${Fleur_uses_serial})
install(TARGETS fleur
if (${FLEUR_USE_SERIAL})
install(TARGETS fleur inpgen
CONFIGURATIONS Release
DESTINATION bin)
endif()
if (${Fleur_uses_MPI})
if (${FLEUR_USE_MPI})
install(TARGETS fleur_MPI
CONFIGURATIONS Release
DESTINATION bin)
......
message("************Summary***************")
message("Configuration file used:${configfile}")
if (${Fleur_uses_HDF5})
message("Compiling with HDF support")
message("HDF linking:${HDF5_LIBS}")
else()
message("No HDF5 support found:You might want to specify HDF5_ROOT before calling cmake")
endif ()
if(${Fleur_uses_MPI})
message("Including targets for parallel compilation")
if (${Fleur_uses_SCALAPACK})
message("Parallel eigenvalue solver using SCALAPACK")
endif()
if (${Fleur_uses_ELPA})
message("Parallel eigenvalue-solver using ELPA")
endif()
else()
message("No MPI found for parallel compilation")
message("Compiler: ${CMAKE_Fortran_COMPILER}")
message("Flags: ${CMAKE_Fortran_FLAGS}")
message("Libraries:${FLEUR_LIBRARIES}")
message("\nThese Libraries are required:")
message("XML Library found:${FLEUR_USE_XML}")
message("LAPACK Library found:${FLEUR_USE_LAPACK}")
message("\nThese Libraries are optional:")
message("HDF5 Library found:${FLEUR_USE_HDF5}")
message("MPI Library found:${FLEUR_USE_MPI}")
if (FLEUR_USE_MPI)
message("SCALAPACK Library found:${FLEUR_USE_SCALAPACK}")
message("ELPA Library found:${FLEUR_USE_ELPA}")
endif()
message("Compiler:${CMAKE_Fortran_COMPILER}")
message("Git describe:${git_describe}")
message("Git hash:${git_hash}")
message("************-------***************")
#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.*")
message("Intel Fortran detected")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mkl -r8 -qopenmp")
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.*")
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.*")
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.*")
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")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -g")
endif()
#This file contains the defaults for compiling FLEUR on known machines
#please add further definitions here and also add code below!
read -r -d '' known_machines << EOM
IFF -- cluster @ PGI of FZJ
JURECA -- @JSC
JUQUEEN -- @JSC
CLAIX -- @RWTH
MARCONI -- @CINECA
EOM
function configure_machine(){
if [ "$machine" = "JURECA" ]
then
echo "JURECA configuration used"
if module list 2>&1 |grep -q intel-para
then
echo "Intel toolchain used"
if module list 2>&1| grep -q Python/2.7.12
then
echo "Python module loaded for XML (OK)"
else
echo "You have to load the Python module"
echo "module load Python/2.7.12"
exit
fi
module load ELPA/2016.05.003-hybrid
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"
elif module list 2>&1 |grep -q PGI
then
echo "PGI toolchain used"
echo "Needs to be configured"
exit
else
echo "You have to load the correct modules for compiling"
echo " a) intel-para, python/1.7.12"
echo " or"
echo " b) PGI"
exit
fi
# JUQUEEN
elif [ "$machine" = "JUQUEEN" ]
then
echo "JUQUEEN configuration used"
module load hdf5/1.8.15_BGQ
module load scalapack/2.0.2_elpa_simd
export CC=mpixlc
export FC=mpixlf2008_r
export CMAKE_Fortran_FLAGS="$CMAKE_Fortran_FLAGS -I${HDF5_DIR}/include -I${ELPA_INCLUDE}"
export FLEUR_LIBRARIES="$FLEUR_LIBRARIES;-L$SCALAPACK_ROOT/lib;-lelpa;-lscalapack;-L/bgsys/local/lapack/3.3.0_g/lib;-llapack;-L/bgsys/local/lib;-qessl;-lesslsmpbg;-L$XML2LIB;-lxml2;-L${HDF5_DIR}/lib;-lhdf5_fortran;-lhdf5;-L/bgsys/local/zlib/lib/;-lz;-L/bgsys/local/szip/lib/;-lsz"
#IFF linux cluster
elif [ "$machine" = "IFF" ]
then
echo "IFF cluster configuration used"
export FC=mpiifort
export FLEUR_LIBRARIES="$FLEUR_LIBRARIES;-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64"
#RWTH cluster
elif [ "$machine" = "CLAIX" ]
then
echo "CLAIX@RWTH configuration used"
if ! module list 2>&1| grep -q intelmpi
then
echo "Please use intelmpi, e.g. do a module switch openmpi intelmpi"
exit
fi
module load LIBRARIES
module load hdf5
export FC=mpiifort
export FLEUR_LIBRARIES="$FLEUR_LIBRARIES;-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64"
elif [ "$machine" = "MARCONI" ]
then
if ! module list 2>&1| grep -q " intel\/" || ! module list 2>&1| grep -q " intelmpi" ||! module list 2>&1| grep -q cmake
then
echo "Load the modules needed to compile: intel,intelmpi,cmake"
exit
fi
export FC=mpif90
export FLEUR_LIBRARIES="$FLEUR_LIBRARIES;-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64"
elif [ "$machine" = "AUTO" ]
then
echo "No machine specific settings used"
echo "GOOD LUCK!"
else
echo "No valid machine configuration specified"
exit
fi
}
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