1#Common commandline argument interpreter for compilation with lammpscuda (USER-CUDA) installed 2 3# make options: 4# emu=1 switch to cuda emulation mode (otherwise: use gpu) 5# dbg=1 print a lot of debugging output during runtime 6# verbose=1 output nvcc command line during compilation 7# keep=1 do not delete temporary compilation files (.ii, .cubin, ...) 8# cufft=1 use cuda's fast fourier transformation lib "cufft" where possible (otherwise: use cpu fftw) 9# binning=1 create virtual particle grid (neighbor-lists otherwise); currently this is not supported 10# precision=1 single precision (global setting) 11# precision=2 double precision (global setting) 12 13SHELL = /bin/sh 14 15# System-specific settings 16 17CUDA_INSTALL_PATH = /usr/local/cuda 18#CUDA_INSTALL_PATH = /home/crtrott/lib/cuda 19# e.g. in Gentoo 20# CUDA_INSTALL_PATH = /opt/cuda 21 22#////////////////////////////////////////////////////////////////////////////////////////////// 23# no need to change anything below this line 24#////////////////////////////////////////////////////////////////////////////////////////////// 25 26#use CPU FFT if cufft=0 is requested. 27FALLBACK_FFT = 1 28 29#default settings for compiler switches 30ifdef COMPILELIB 31include Makefile.defaults 32else 33include ../../lib/cuda/Makefile.defaults 34endif 35 36#shell echo "Compiling with precision = " ${precision} ", arch = " ${arch} ", cufft = " ${cufft} ", dbg = " ${dbg} ", prec_timer = " ${prec_timer} 37 38CUDA_FLAGS := -I${CUDA_INSTALL_PATH}/include -DUNIX 39CUDA_USRLIB_CONDITIONAL := -L${CUDA_INSTALL_PATH}/lib -L${CUDA_INSTALL_PATH}/lib64 40 41# debug setting 42ifeq ($(strip $(dbg)), 1) 43 CUDA_FLAGS += -D_DEBUG -g 44 NVCC_FLAGS += -g -G 45else 46 NVCC_FLAGS += --compiler-options -fno-strict-aliasing -O3 47endif 48 49# skip timing on Mac and Windows manually 50ifeq ($(strip $(prec_timer)), 0) 51 CUDA_FLAGS += -DNO_PREC_TIMING 52endif 53 54# set fft routine 55ifeq ($(strip $(cufft)), 0) 56 ifneq ($(FALLBACK_FFT), 1) 57 FFT_INC = -DFFT_NONE 58 FFT_PATH = 59 FFT_LIB = 60 CUDA_FLAGS += -DFFT_NONE 61 endif 62else 63 CUDA_FLAGS += -DFFT_CUFFT 64 CUDA_USRLIB_CONDITIONAL += -lcufft 65endif 66 67# make global precision setting 68 69ifeq ($(strip $(precision)), 1) 70 CUDA_FLAGS += -DCUDA_PRECISION=1 71else 72 ifeq ($(strip $(precision)), 3) 73 CUDA_FLAGS += -DCUDA_PRECISION=1 -DX_PRECISION=2 74 else 75 ifeq ($(strip $(precision)), 4) 76 CUDA_FLAGS += -DCUDA_PRECISION=1 -DX_PRECISION=2 -DV_PRECISION=2 77 else 78 CUDA_FLAGS += -DCUDA_PRECISION=2 79 endif 80 endif 81endif 82 83# make architecture settings 84ifeq ($(strip $(arch)), 13) 85 CUDA_FLAGS += -DCUDA_ARCH=13 86 SMVERSIONFLAGS := -arch sm_13 87else 88 ifeq ($(strip $(arch)), 20) 89 CUDA_FLAGS += -DCUDA_ARCH=20 90 #NVCC_FLAGS += -ftz=false -prec-div=true -prec-sqrt=true 91 NVCC_FLAGS += -ftz=true -prec-div=false -prec-sqrt=false 92 SMVERSIONFLAGS := -arch sm_20 93 else 94 ifeq ($(strip $(arch)), 21) 95 CUDA_FLAGS += -DCUDA_ARCH=20 96 #NVCC_FLAGS += -ftz=false -prec-div=true -prec-sqrt=true 97 NVCC_FLAGS += -ftz=true -prec-div=false -prec-sqrt=false 98 SMVERSIONFLAGS := -arch sm_21 99 else 100 ifeq ($(strip $(arch)), 30) 101 CUDA_FLAGS += -DCUDA_ARCH=20 102 #NVCC_FLAGS += -ftz=false -prec-div=true -prec-sqrt=true 103 NVCC_FLAGS += -ftz=true -prec-div=false -prec-sqrt=false 104 SMVERSIONFLAGS := -arch sm_30 105 else 106 ifeq ($(strip $(arch)), 35) 107 CUDA_FLAGS += -DCUDA_ARCH=20 108 #NVCC_FLAGS += -ftz=false -prec-div=true -prec-sqrt=true 109 NVCC_FLAGS += -ftz=true -prec-div=false -prec-sqrt=false 110 SMVERSIONFLAGS := -arch sm_35 111 else 112 CUDA_FLAGS += -DCUDA_ARCH=99 113 SMVERSIONFLAGS := -arch sm_13 114 endif 115 endif 116 endif 117 endif 118endif 119 120 121 122CCFLAGS := $(CCFLAGS) $(CUDA_FLAGS) \ 123 -I$(CUDA_INSTALL_PATH)/include 124