diff --git a/config/common/buildSettings.mk b/config/common/buildSettings.mk index 8842e47b4a2565b457c500f6c6b18117bd0c974d..243b565daec08d7a4dd51ee01a14a6ae930add47 100644 --- a/config/common/buildSettings.mk +++ b/config/common/buildSettings.mk @@ -84,29 +84,37 @@ endif # if Linux ##################################################################### # -# Linux specific sys vars and ext libs +# CUDA specific sys vars and ext libs # ##################################################################### -# CUDA library +# CUDA/nvcc compiler options ifneq ($(shell which nvcc), ) + + # TODO Allow override, don't + # assume CUDADIR=FSLDIR NVCC = nvcc CUDAVER = $(shell nvcc --version | grep -Po "release \K[0-9\.]+") GENCODE_FLAGS = $(shell ${FSLDIR}/config/common/supportedGencodes.sh ${CUDAVER}) CUDADIR = ${FSLDIR} - CUDACXXFLAGS = -I${CUDADIR}/include \ - ${GENCODE_FLAGS} \ - --compiler-options \ - "-fexpensive-optimizations -Wall -Wno-long-long -fPIC" \ - -DARMA_ALLOW_FAKE_GCC - CUDALDFLAGS = -L${CUDADIR}/lib -lcuda -lcurand -lcudart - - $(info "GPU enable") + # nvcc-specific tweaks: + # - Define ARMA_ALLOW_FAKE_GCC, otherwise byte-alignment issues + # may occur with armadillo datatypes (see compiler_setup.hpp + # from the armadillo project) + # - Do not use -pedantic, otherwise *every single line* of + # transpiled cuda code will trigger "warning: style of line + # directive is a GCC extension". + CUDACXXFLAGS = -I${CUDADIR}/include \ + ${GENCODE_FLAGS} \ + -DARMA_ALLOW_FAKE_GCC \ + --compiler-options \ + "$(filter-out -pedantic, ${ARCHCXXFLAGS})" + CUDALDFLAGS = -lcurand -lcudart ifeq ($(SYSTYPE), Darwin) - #Project specific variables + # Project specific variables EDDYBUILDPARAMETERS = "cuda=1 CUDAVER=7.5" "cpu=1" FDT_COMPILE_GPU = 0 PTX2_COMPILE_GPU = 0 @@ -120,8 +128,4 @@ ifneq ($(shell which nvcc), ) FDT_COMPILE_GPU = 1 PTX2_COMPILE_GPU = 1 endif # if Linux -else - $(info "GPU disable") - FDT_COMPILE_GPU = 0 - PTX2_COMPILE_GPU = 0 endif diff --git a/config/common/rules.mk b/config/common/rules.mk index 0554fa1689dbcb0fc05f65088544165b95322564..bc62e0d5624760b146f4d8888ce05f886aab983b 100644 --- a/config/common/rules.mk +++ b/config/common/rules.mk @@ -6,7 +6,8 @@ help: @echo " make install Install into your local FSLDEVDIR"; clean: - ${RM} -f *.o *.a *.so *.exe depend.mk ${XFILES} ${TESTXFILES} + ${RM} -f *.o *.a *.so *.exe depend.mk \ + ${XFILES} ${FXFILES} ${SOFILES} ${AFILES} ${TESTXFILES} install: @${MAKE} "DESTDIR=${FSLDEVDIR}" master-install-script diff --git a/config/common/vars.mk b/config/common/vars.mk index c7e97701b8a7122b6f08d7c610ec1595cef765c6..f84da98402490f7d175de4b7b35b5136001b1581 100644 --- a/config/common/vars.mk +++ b/config/common/vars.mk @@ -54,6 +54,7 @@ INCFLAGS = ${USRINCFLAGS} -I. -I${DEVINCDIR} -I${INCDIR} # Ignore flags provided by the environment CFLAGS = CXXFLAGS = +CPPFLAGS = LDFLAGS = # All projects must use these flags for @@ -64,8 +65,9 @@ LDFLAGS = # # LDFLAGS *must* come at the end, to ensure proper linking. -LDFLAGS += ${ARCHLDFLAGS} ${USRLDFLAGS} \ - -L. -L${DEVLIBDIR} -L${LIBDIR} \ - ${LIBS} ${ARCHLIBS} -CFLAGS += ${ARCHCFLAGS} ${USRCFLAGS} ${INCFLAGS} -CXXFLAGS += ${ARCHCXXFLAGS} ${USRCXXFLAGS} ${INCFLAGS} +LDFLAGS += ${ARCHLDFLAGS} ${USRLDFLAGS} \ + -L. -L${DEVLIBDIR} -L${LIBDIR} \ + ${LIBS} ${ARCHLIBS} +CFLAGS += ${ARCHCFLAGS} ${USRCFLAGS} ${INCFLAGS} +CXXFLAGS += ${ARCHCXXFLAGS} ${USRCXXFLAGS} ${INCFLAGS} +CUDACXXFLAGS += ${INCFLAGS}