Modifying CUDA flags so they pick up debug/optimized flags based on the build type

git-svn-id: https://subversion.assembla.com/svn/qmcdev/trunk@6648 e5b18d87-469d-4833-9cc0-8cdfa06e9491
This commit is contained in:
Mark Berrill 2015-12-18 16:56:57 +00:00
parent 165095c5e3
commit 7cac7a99c3
2 changed files with 23 additions and 14 deletions

View File

@ -36,6 +36,7 @@ IF ( NOT CMAKE_BUILD_TYPE AND NOT CMAKE_TOOLCHAIN_FILE)
SET( CMAKE_BUILD_TYPE Release )
ENDIF()
STRING( TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE )
MESSAGE( STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
######################################################################
#define the paths for library and executable for out-of-soruce compilation
@ -490,25 +491,29 @@ IF(QMC_CUDA)
#set(CUDA_NVCC_FLAGS
# "-arch=sm_20;-Drestrict=__restrict__;-DNO_CUDA_MAIN;-O3;-use_fast_math")
if(CUDA_NVCC_FLAGS MATCHES "arch")
# User defined NVCC flags
MESSAGE(STATUS "Setting CUDA FLAGS=${CUDA_NVCC_FLAGS}")
else(CUDA_NVCC_FLAGS MATCHES "arch")
# Automatically set the default NVCC flags
SET(CUDA_NVCC_FLAGS "-Drestrict=__restrict__;-DNO_CUDA_MAIN")
if ( CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-g;-G")
else()
# Temporarily disable fast_math because it causes multiple test failures
# SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-O3;-use_fast_math")
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-O3")
ENDIF()
if(CUDA_VERSION VERSION_GREATER 6.5 OR CUDA_VERSION VERSION_EQUAL 6.5)
# Temporarily disable fast_math because it causes multiple test failures
# SET(CUDA_NVCC_FLAGS
# "-arch=sm_35;-Drestrict=__restrict__;-DNO_CUDA_MAIN;-O3;-use_fast_math")
SET(CUDA_NVCC_FLAGS
"-arch=sm_35;-Drestrict=__restrict__;-DNO_CUDA_MAIN;-O3")
else(CUDA_VERSION VERSION_GREATER 6.5 OR CUDA_VERSION VERSION_EQUAL 6.5)
# Temporarily disable fast_math because it causes multiple test failures
# SET(CUDA_NVCC_FLAGS
# "-arch=sm_20;-Drestrict=__restrict__;-DNO_CUDA_MAIN;-O3;-use_fast_math")#
SET(CUDA_NVCC_FLAGS
"-arch=sm_20;-Drestrict=__restrict__;-DNO_CUDA_MAIN;-O3")#
MESSAGE(WARNING "Using outdated CUDA FLAGS=${CUDA_NVCC_FLAGS}")
endif(CUDA_VERSION VERSION_GREATER 6.5 OR CUDA_VERSION VERSION_EQUAL 6.5)
SET(CUDA_NVCC_FLAGS "-arch=sm_35;${CUDA_NVCC_FLAGS}")
else()
SET(CUDA_NVCC_FLAGS "-arch=sm_20;${CUDA_NVCC_FLAGS}")
endif()
endif(CUDA_NVCC_FLAGS MATCHES "arch")
set(HAVE_CUDA 1)
MESSAGE("CUDA_PRECISION=${CUDA_PRECISION}")
MESSAGE(" CUDA_PRECISION=${CUDA_PRECISION}")
MESSAGE(" CUDA_NVCC_FLAGS}=${CUDA_NVCC_FLAGS}")
ELSE(QMC_CUDA)
MESSAGE(STATUS "Disabling CUDA")
ENDIF(QMC_CUDA)
#INCLUDE(${PROJECT_CMAKE}/FindPkgConfig.cmake)
@ -571,6 +576,9 @@ IF(FFTW_FOUND)
SET(HAVE_LIBFFTW 1)
INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIR})
SET(QMC_UTIL_LIBS ${QMC_UTIL_LIBS} ${FFTW_LIBRARIES})
MESSAGE(STATUS "Found FFTW")
ELSE(FFTW_FOUND)
MESSAGE(STATUS "Disabling FFTW")
ENDIF(FFTW_FOUND)
#include qmcpack/src build/src

1
README
View File

@ -67,6 +67,7 @@ to the configure line between the cmake command and the path to the source direc
QMC_DATA Specify data directory for QMCPACK (used for unit tests)
QMC_EXTRA_LIBS Add extra link libraries
QMC_BUILD_STATIC Add -static flags to build
QMC_CUDA Enable CUDA (1:yes, 0:no)
* libxml
Libxml2_INCLUDE_DIRS Specify include directories for libxml2