Skip to content

Commit

Permalink
Merge branch 'develop' into one-WaveFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
markdewing authored May 14, 2018
2 parents bc8faa7 + a9aafcb commit c86195d
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 481 deletions.
21 changes: 3 additions & 18 deletions CMake/ClangCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,26 @@ IF ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3 )
MESSAGE(FATAL_ERROR "Requires clang 3.3 or higher ")
ENDIF()

# Set the std
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")

# Enable OpenMP
IF(QMC_OMP)
SET(ENABLE_OPENMP 1)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(QMC_OMP)

# Set clang specfic flags (which we always want)
ADD_DEFINITIONS( -Drestrict=__restrict__ )

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -fstrict-aliasing -D__forceinline=inline")
SET( HAVE_POSIX_MEMALIGN 0 ) # Clang doesn't support -malign-double

# Suppress compile warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated -Wno-unused-value")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-unused-value")
IF ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.8 )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-var-template")
ENDIF()

# Set extra optimization specific flags
SET( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math" )
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math" )
SET( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math" )
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math" )

#--------------------------------------
Expand All @@ -40,17 +32,11 @@ SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-ma
IF((NOT $ENV{CRAYPE_VERSION} MATCHES ".") AND (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64"))

#check if the user has already specified -march=XXXX option for cross-compiling.
if(CMAKE_CXX_FLAGS MATCHES "-march=" OR CMAKE_C_FLAGS MATCHES "-march=")
# make sure that the user specifies -march= for both CMAKE_CXX_FLAGS and CMAKE_C_FLAGS.
if(CMAKE_CXX_FLAGS MATCHES "-march=" AND CMAKE_C_FLAGS MATCHES "-march=")
else() #(CMAKE_CXX_FLAGS MATCHES "-march=" AND CMAKE_C_FLAGS MATCHES "-march=")
MESSAGE(FATAL_ERROR "if -march=ARCH is specified by the user, it should be added in both CMAKE_CXX_FLAGS and CMAKE_C_FLAGS!")
endif() #(CMAKE_CXX_FLAGS MATCHES "-march=" AND CMAKE_C_FLAGS MATCHES "-march=")
else() #(CMAKE_CXX_FLAGS MATCHES "-march=" OR CMAKE_C_FLAGS MATCHES "-march=")
if(CMAKE_CXX_FLAGS MATCHES "-march=")
else() #(CMAKE_CXX_FLAGS MATCHES "-march=")
# use -march=native
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif() #(CMAKE_CXX_FLAGS MATCHES "-march=" OR CMAKE_C_FLAGS MATCHES "-march=")
endif() #(CMAKE_CXX_FLAGS MATCHES "-march=")

ENDIF((NOT $ENV{CRAYPE_VERSION} MATCHES ".") AND (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64"))

Expand All @@ -63,7 +49,6 @@ ENDIF(QMC_BUILD_STATIC)
IF (ENABLE_GCOV)
SET(GCOV_COVERAGE TRUE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
ENDIF(ENABLE_GCOV)
Expand Down
29 changes: 0 additions & 29 deletions CMake/FindFFTW.cmake

This file was deleted.

57 changes: 0 additions & 57 deletions CMake/FindLibxml2QMC.cmake

This file was deleted.

103 changes: 73 additions & 30 deletions CMake/FindMKL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,85 @@
# This needs a lot of work to make it robust
INCLUDE( CheckCXXSourceCompiles )

if ( NOT CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
# Extremely Basic Support of common mkl module environment variables
# or -DMKLROOT/-DMKL_HOME instead of prefered -DMKL_ROOT
if (NOT MKL_ROOT)
find_path(MKL_ROOT "mkl.h"
HINTS ${MKLROOT} ${MKL_HOME} $ENV{MKLROOT} $ENV{MKL_ROOT} $ENV{MKL_HOME}
PATH_SUFFIXES include)
string(REPLACE "/include" "" MKL_ROOT ${MKL_ROOT})
endif (NOT MKL_ROOT)
if (NOT MKL_ROOT)
message (FATAL_ERROR "ENABLE_MKL is TRUE and mkl not found. Set MKL_ROOT." )
endif (NOT MKL_ROOT)

# Finding and setting the MKL_LINK_DIRECTORIES
# the directory organization varies with platform and targets
# these suffixes are not exhaustive
set(MKL_FIND_LIB "libmkl_intel_lp64${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(SUFFIXES lib lib/intel64)
find_path(MKL_LINK_DIRECTORIES name "${MKL_FIND_LIB}" HINTS ${MKL_ROOT}
PATH_SUFFIXES ${SUFFIXES})
if (MKL_LINK_DIRECTORIES-NOTFOUND)
message(FATAL_ERROR "MKL_LINK_DIRECTORIES not set. ${MKL_FIND_LIB} "
"not found in MKL_ROOT/(${SUFFIXES})")
endif (MKL_LINK_DIRECTORIES-NOTFOUND)
message("MKL_LINK_DIRECTORIES: ${MKL_LINK_DIRECTORIES}")

# Finding and setting the MKL_INCLUDE_DIRECTORIES
set(SUFFIXES include)
find_path(MKL_INCLUDE_DIRECTORIES name "mkl.h" HINTS ${MKL_ROOT}
PATH_SUFFIXES ${SUFFIXES})
if (MKL_INCLUDE_DIRECTORIES-NOTFOUND)
message(FATAL_ERROR "MKL_INCLUDE_DIRECTORIES not set. \"mkl.h\" not found in MKL_ROOT/(${SUFFIXES})")
endif (MKL_INCLUDE_DIRECTORIES-NOTFOUND)
message("MKL_INCLUDE_DIRECTORIES: ${MKL_INCLUDE_DIRECTORIES}")

set(MKL_LINKER_FLAGS "-L${MKL_LINK_DIRECTORIES} -Wl,-rpath,${MKL_LINK_DIRECTORIES}")
set(MKL_FLAGS "-I${MKL_INCLUDE_DIRECTORIES}")
set(MKL_LIBRARIES "-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl")
else ( NOT CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
# this takes away build control for intel but is convenient
set(MKL_FLAGS "-mkl")
set(MKL_COMPILE_DEFINITIONS "-mkl")
endif (NOT CMAKE_CXX_COMPILER_ID MATCHES "Intel" )

# Check for mkl.h
FILE( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl.cxx"
"#include <iostream>\n #include <mkl.h>\n int main() { return 0; }\n" )
"#include <iostream>\n #include <mkl.h>\n int main() { return 0; }\n" )
try_compile(HAVE_MKL ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl.cxx
COMPILE_DEFINITIONS "-mkl" )
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl.cxx
CMAKE_FLAGS ${MKL_FLAGS}
"-DINCLUDE_DIRECTORIES=${MKL_INCLUDE_DIRECTORIES} "
"-DLINK_DIRECTORIES=${MKL_LINK_DIRECTORIES}"
LINK_LIBRARIES "${MKL_LIBRARIES}"
COMPILE_DEFINITIONS "${MKL_COMPILE_DEFINITIONS}"
OUTPUT_VARIABLE MKL_OUT)

if ( NOT HAVE_MKL )
MESSAGE( "${MKL_OUT}" )
endif ( NOT HAVE_MKL )

# Check for mkl_vml_functions.h
FILE( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_vml.cxx"
"#include <iostream>\n #include <mkl_vml_functions.h>\n int main() { return 0; }\n" )
"#include <iostream>\n #include <mkl_vml_functions.h>\n int main() { return 0; }\n" )
try_compile(HAVE_MKL_VML ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_vml.cxx
COMPILE_DEFINITIONS "-mkl" )

# Check for fftw3
FILE( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_fftw3.cxx"
"#include <iostream>\n #include <fftw/fftw3.h>\n int main() { return 0; }\n" )
try_compile(HAVE_MKL_FFTW3 ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_fftw3.cxx
COMPILE_DEFINITIONS "-mkl" )
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_vml.cxx
CMAKE_FLAGS ${MKL_FLAGS}
"-DINCLUDE_DIRECTORIES=${MKL_INCLUDE_DIRECTORIES} "
"-DLINK_DIRECTORIES=${MKL_LINK_DIRECTORIES}"
COMPILE_DEFINITIONS "${MKL_COMPILE_DEFINITIONS}"
OUTPUT_VARIABLE MKL_OUT)

IF ( HAVE_MKL )
SET( MKL_FOUND 1 )
SET( MKL_FLAGS -mkl )
SET( MKL_LIBRARIES )
SET( MKL_LINKER_FLAGS -mkl )
IF ( HAVE_MKL_FFTW3 )
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/fftw3.h" "#include <fftw/fftw3.h>\n" )
INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_BINARY_DIR}/include" )
ENDIF()
MESSAGE(STATUS "MKL found: HAVE_MKL=${HAVE_MKL}, HAVE_MKL_VML=${HAVE_MKL_VML}, HAVE_MKL_FFTW3=${HAVE_MKL_FFTW3}")
ELSE()
SET( MKL_FOUND 0 )
SET( MKL_FLAGS )
SET( MKL_LIBRARIES )
SET( MKL_LINKER_FLAGS )
MESSAGE(STATUS "MKL not found")
ENDIF()

SET( MKL_FOUND 1 )
SET( MKL_FLAGS ${MKL_FLAGS} )
MESSAGE(STATUS "MKL found: HAVE_MKL=${HAVE_MKL}, HAVE_MKL_VML=${HAVE_MKL_VML}")
ELSE( HAVE_MKL )
SET( MKL_FOUND 0 )
SET( MKL_FLAGS )
SET( MKL_LIBRARIES )
SET( MKL_LINKER_FLAGS )
MESSAGE("MKL not found")
ENDIF( HAVE_MKL )
21 changes: 3 additions & 18 deletions CMake/GNUCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,22 @@ IF ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8 )
MESSAGE(FATAL_ERROR "Requires gcc 4.8 or higher ")
ENDIF()

# Set the std
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")

# Enable OpenMP
IF(QMC_OMP)
SET(ENABLE_OPENMP 1)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(QMC_OMP)

# Set gnu specfic flags (which we always want)
ADD_DEFINITIONS( -Drestrict=__restrict__ )

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -finline-limit=1000 -fstrict-aliasing -funroll-all-loops")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-limit=1000 -fstrict-aliasing -funroll-all-loops -D__forceinline=inline")

# Suppress compile warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")

# Set extra optimization specific flags
SET( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math" )
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math" )
SET( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math" )
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math" )

#--------------------------------------
Expand All @@ -35,17 +27,11 @@ SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-ma
IF((NOT $ENV{CRAYPE_VERSION} MATCHES ".") AND (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64"))

#check if the user has already specified -march=XXXX option for cross-compiling.
if(CMAKE_CXX_FLAGS MATCHES "-march=" OR CMAKE_C_FLAGS MATCHES "-march=")
# make sure that the user specifies -march= for both CMAKE_CXX_FLAGS and CMAKE_C_FLAGS.
if(CMAKE_CXX_FLAGS MATCHES "-march=" AND CMAKE_C_FLAGS MATCHES "-march=")
else() #(CMAKE_CXX_FLAGS MATCHES "-march=" AND CMAKE_C_FLAGS MATCHES "-march=")
MESSAGE(FATAL_ERROR "if -march=ARCH is specified by the user, it should be added in both CMAKE_CXX_FLAGS and CMAKE_C_FLAGS!")
endif() #(CMAKE_CXX_FLAGS MATCHES "-march=" AND CMAKE_C_FLAGS MATCHES "-march=")
else() #(CMAKE_CXX_FLAGS MATCHES "-march=" OR CMAKE_C_FLAGS MATCHES "-march=")
if(CMAKE_CXX_FLAGS MATCHES "-march=")
else() #(CMAKE_CXX_FLAGS MATCHES "-march=")
# use -march=native
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif() #(CMAKE_CXX_FLAGS MATCHES "-march=" OR CMAKE_C_FLAGS MATCHES "-march=")
endif() #(CMAKE_CXX_FLAGS MATCHES "-march=")

ENDIF((NOT $ENV{CRAYPE_VERSION} MATCHES ".") AND (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64"))

Expand All @@ -58,7 +44,6 @@ ENDIF(QMC_BUILD_STATIC)
IF (ENABLE_GCOV)
SET(GCOV_SUPPORTED TRUE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
ENDIF(ENABLE_GCOV)
Expand Down
10 changes: 1 addition & 9 deletions CMake/IBMCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,21 @@ MESSAGE(STATUS "Power8+ system using xlC/xlc/xlf")
ADD_DEFINITIONS( -Drestrict=__restrict__ )

# Clean up flags

IF(CMAKE_C_FLAGS MATCHES "-qhalt=e")
SET(CMAKE_C_FLAGS "")
ENDIF()
IF(CMAKE_CXX_FLAGS MATCHES "-qhalt=e")
SET(CMAKE_CXX_FLAGS "")
ENDIF()

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__forceinline=inline")

# Suppress compile warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated -Wno-unused-value")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-unused-value")

# Set extra optimization specific flags
SET( CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" )
SET( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" )
SET( CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3" )
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3" )

# Set language standardards
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -qnoxlcompatmacros")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qnoxlcompatmacros")

IF(QMC_OMP)
SET(ENABLE_OPENMP 1)
Expand Down
Loading

0 comments on commit c86195d

Please sign in to comment.