forked from DualSPHysics/DualSPHysics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (149 loc) · 6.23 KB
/
Makefile
File metadata and controls
176 lines (149 loc) · 6.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#DualSPHysics GPU/CPU v4.4.024 16-09-2019
#=============== Compilation Options ===============
USE_GCC5=NO
USE_DEBUG=NO
USE_FAST_MATH=YES
USE_NATIVE_CPU_OPTIMIZATIONS=NO
COMPILE_CHRONO=YES
COMPILE_RZ_MLPISTONS=YES
LIBS_DIRECTORIES=-L./
LIBS_DIRECTORIES:=$(LIBS_DIRECTORIES) -L../lib/linux_gcc
EXECNAME=DualSPHysics4.4_linux64
EXECS_DIRECTORY=../../bin/linux
ifeq ($(USE_DEBUG), YES)
CCFLAGS=-c -O0 -g -Wall -fopenmp -D_WITHGPU
else
CCFLAGS=-c -O3 -fopenmp -D_WITHGPU
ifeq ($(USE_FAST_MATH), YES)
CCFLAGS+= -ffast-math
endif
ifeq ($(USE_NATIVE_CPU_OPTIMIZATIONS), YES)
CCFLAGS+= -march=native
endif
endif
CC=g++
CCLINKFLAGS=-fopenmp -lgomp
#Required for GCC versions >=5.0
ifeq ($(USE_GCC5), YES)
CCFLAGS+=-D_GLIBCXX_USE_CXX11_ABI=0
CCLINKFLAGS+=-D_GLIBCXX_USE_CXX11_ABI=0
NCCFLAGS+=-D_GLIBCXX_USE_CXX11_ABI=0
endif
ifeq ($(COMPILE_CHRONO), NO)
CCFLAGS:=$(CCFLAGS) -DDISABLE_CHRONO
endif
ifeq ($(COMPILE_RZ_MLPISTONS), NO)
CCFLAGS:=$(CCFLAGS) -DDISABLE_RZ -DDISABLE_MLPISTONS
endif
#=============== CUDA selection ===============
CUDAVER=92
#=============== CUDA toolkit directory (make appropriate for local CUDA installation) ===============
ifeq ($(CUDAVER),00)
DIRTOOLKIT=/usr/local/cuda
endif
ifeq ($(CUDAVER),75)
DIRTOOLKIT=/exports/opt/NVIDIA/cuda-7.5
endif
ifeq ($(CUDAVER),91)
DIRTOOLKIT=/exports/opt/NVIDIA/cuda-9.1
endif
ifeq ($(CUDAVER),92)
DIRTOOLKIT=/exports/opt/NVIDIA/cuda-9.2
endif
#=============== Select GPU architectures ===============
ifeq ($(CUDAVER),00)
GENCODE:=$(GENCODE) -gencode=arch=compute_20,code=\"sm_20,compute_20\"
GENCODE:=$(GENCODE) -gencode=arch=compute_30,code=\"sm_30,compute_30\"
endif
ifeq ($(CUDAVER),75)
GENCODE:=$(GENCODE) -gencode=arch=compute_20,code=\"sm_20,compute_20\"
GENCODE:=$(GENCODE) -gencode=arch=compute_30,code=\"sm_30,compute_30\"
GENCODE:=$(GENCODE) -gencode=arch=compute_35,code=\"sm_35,compute_35\"
GENCODE:=$(GENCODE) -gencode=arch=compute_37,code=\"sm_37,compute_37\"
GENCODE:=$(GENCODE) -gencode=arch=compute_50,code=\"sm_50,compute_50\"
GENCODE:=$(GENCODE) -gencode=arch=compute_52,code=\"sm_52,compute_52\"
endif
ifeq ($(CUDAVER),91)
GENCODE:=$(GENCODE) -gencode=arch=compute_30,code=\"sm_30,compute_30\"
GENCODE:=$(GENCODE) -gencode=arch=compute_35,code=\"sm_35,compute_35\"
GENCODE:=$(GENCODE) -gencode=arch=compute_50,code=\"sm_50,compute_50\"
GENCODE:=$(GENCODE) -gencode=arch=compute_52,code=\"sm_52,compute_52\"
GENCODE:=$(GENCODE) -gencode=arch=compute_61,code=\"sm_61,compute_61\"
GENCODE:=$(GENCODE) -gencode=arch=compute_70,code=\"sm_70,compute_70\"
endif
ifeq ($(CUDAVER),92)
# module load cuda/9.2
GENCODE:=$(GENCODE) -gencode=arch=compute_30,code=\"sm_30,compute_30\"
GENCODE:=$(GENCODE) -gencode=arch=compute_35,code=\"sm_35,compute_35\"
GENCODE:=$(GENCODE) -gencode=arch=compute_50,code=\"sm_50,compute_50\"
GENCODE:=$(GENCODE) -gencode=arch=compute_52,code=\"sm_52,compute_52\"
GENCODE:=$(GENCODE) -gencode=arch=compute_61,code=\"sm_61,compute_61\"
GENCODE:=$(GENCODE) -gencode=arch=compute_70,code=\"sm_70,compute_70\"
endif
#=============== Files to compile ===============
OBJXML=JXml.o tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o
OBJSPHMOTION=JMotion.o JMotionList.o JMotionMov.o JMotionObj.o JMotionPos.o JSphMotion.o
OBCOMMON=Functions.o FunctionsGeo3d.o JAppInfo.o JBinaryData.o JDataArrays.o JException.o JLinearValue.o JLog2.o JMeanValues.o JObject.o JRadixSort.o JRangeFilter.o JReadDatafile.o JSaveCsv2.o JTimeControl.o randomc.o
OBCOMMONDSPH=JDsphConfig.o JPartDataBi4.o JPartDataHead.o JPartFloatBi4.o JPartOutBi4Save.o JSpaceCtes.o JSpaceEParms.o JSpaceParts.o JSpaceProperties.o JSpaceVtkOut.o
OBSPH=JArraysCpu.o JCellDivCpu.o JCfgRun.o JDamping.o JGaugeItem.o JGaugeSystem.o JPartsOut.o JSaveDt.o JSph.o JSphAccInput.o JSphCpu.o JSphInitialize.o JSphMk.o JSphPartsInit.o JSphDtFixed.o JSphVisco.o JTimeOut.o JWaveSpectrumGpu.o main.o
OBSPHSINGLE=JCellDivCpuSingle.o JPartsLoad4.o JSphCpuSingle.o
OBCOMMONGPU=FunctionsCuda.o JObjectGpu.o
OBSPHGPU=JArraysGpu.o JBlockSizeAuto.o JDebugSphGpu.o JCellDivGpu.o JSphGpu.o
OBSPHSINGLEGPU=JCellDivGpuSingle.o JSphGpuSingle.o
OBCUDA=JCellDivGpu_ker.o JCellDivGpuSingle_ker.o JGauge_ker.o JReduSum_ker.o JSphGpu_ker.o JWaveOrder2_ker.o
OBWAVERZ=JMLPistonsGpu.o JRelaxZonesGpu.o
OBWAVERZCUDA=JRelaxZone_ker.o
OBCHRONO=JChronoObjects.o
OBINOUT=JSphCpu_InOut.o JSphCpuSingle_InOut.o JSphBoundCorr.o JSphInOut.o JSphInOutGridData.o JSphInOutPoints.o JSimpleNeigs.o
OBINOUTGPU=JSphGpuSingle_InOut.o
OBJECTS=$(OBJXML) $(OBJSPHMOTION) $(OBCOMMON) $(OBCOMMONDSPH) $(OBSPH) $(OBSPHSINGLE)
OBJECTS:=$(OBJECTS) $(OBCOMMONGPU) $(OBSPHGPU) $(OBSPHSINGLEGPU) $(OBCUDA)
OBJECTS:=$(OBJECTS) $(OBWAVERZ) $(OBWAVERZCUDA) $(OBCHRONO) $(OBINOUT) $(OBINOUTGPU)
#=============== DualSPHysics libs to be included ===============
JLIBS=${LIBS_DIRECTORIES} -ljformatfiles2_64 -ljwavegen_64
ifeq ($(COMPILE_CHRONO), YES)
JLIBS:=$(JLIBS) -ldsphchrono -lChronoEngine
endif
ifeq ($(COMPILE_RZ_MLPISTONS), YES)
JLIBS:=$(JLIBS) -ljwave_mlp_rz_64
endif
#=============== GPU Code Compilation ===============
CCFLAGS := $(CCFLAGS) -I./ -I$(DIRTOOLKIT)/include
CCLINKFLAGS := $(CCLINKFLAGS) -L$(DIRTOOLKIT)/lib64 -lcudart_static -ldl -lrt
NCC=nvcc
ifeq ($(USE_DEBUG), NO)
NCCFLAGS+=-c $(GENCODE) -O3 -ccbin $(CC)
else
NCCFLAGS+=-c $(GENCODE) -O0 -ccbin $(CC) -g
endif
ifeq ($(USE_FAST_MATH), YES)
NCCFLAGS+= -use_fast_math
endif
all:$(EXECS_DIRECTORY)/$(EXECNAME)
rm -rf *.o
ifeq ($(USE_DEBUG), NO)
@echo " --- Compiled Release GPU version ---"
else
@echo " --- Compiled Debug GPU version ---"
mv $(EXECS_DIRECTORY)/$(EXECNAME) $(EXECNAME)_debug
endif
$(EXECS_DIRECTORY)/$(EXECNAME): $(OBJECTS)
$(CC) $(OBJECTS) $(CCLINKFLAGS) -o $@ $(JLIBS)
.cpp.o:
$(CC) $(CCFLAGS) $<
JSphGpu_ker.o: JSphGpu_ker.cu
$(NCC) $(NCCFLAGS) JSphGpu_ker.cu
JCellDivGpu_ker.o: JCellDivGpu_ker.cu
$(NCC) $(NCCFLAGS) JCellDivGpu_ker.cu
JCellDivGpuSingle_ker.o: JCellDivGpuSingle_ker.cu
$(NCC) $(NCCFLAGS) JCellDivGpuSingle_ker.cu
JGauge_ker.o: JGauge_ker.cu
$(NCC) $(NCCFLAGS) JGauge_ker.cu
JWaveOrder2_ker.o: JWaveOrder2_ker.cu
$(NCC) $(NCCFLAGS) JWaveOrder2_ker.cu
JReduSum_ker.o: JReduSum_ker.cu
$(NCC) $(NCCFLAGS) JReduSum_ker.cu
JRelaxZone_ker.o: JRelaxZone_ker.cu
$(NCC) $(NCCFLAGS) JRelaxZone_ker.cu
clean:
rm -rf *.o $(EXECNAME) $(EXECNAME)_debug