forked from fwyzard/soa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (63 loc) · 3.21 KB
/
Makefile
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
SRC=$(wildcard *.cc *.cu)
OBJ=$(SRC:%=.tmp/%.o)
DEP=$(SRC:%=.tmp/%.d)
TEST=test_v0 test_v1 test_v2 test_v3 test_v4 test_v5
CPPUNIT_TEST=test_v5 test_v6
CUDA_TEST=test_v7 test_v8 test_v9 test_v10
# Test v7: a variable size SoA implementation keeping track of columns via pointers
# Test v8: same as v7, keeping track of columns via offsets.
# Test v9: back to v7, adding support for Eigen types.
# Can be overridden on the command line with CXX=/opt/rh/devtoolset-10/root/bin/g++
# on Centos7 (with package devtools-10).
CXX=g++-9
LD=g++-9
# Piggy back on CVMFS for external dependencies
EXTERNAL_BASE=/cvmfs/cms.cern.ch/cc8_amd64_gcc9/external
BOOST=$(EXTERNAL_BASE)/boost/1.75.0/include
CPPUNIT=$(EXTERNAL_BASE)/cppunit/1.15.x-cc43a055582fbd2170ba53a421bc6433/include
EIGEN=$(EXTERNAL_BASE)/eigen/011e0db31d1bed8b7f73662be6d57d9f30fa457a-llifpc/include/eigen3
LIBS=/cvmfs/cms.cern.ch/cc8_amd64_gcc9/cms/cmssw/CMSSW_11_3_2/external/cc8_amd64_gcc9/lib
CLANG_FORMAT=clang-format
NVCC=/usr/local/cuda/bin/nvcc
CUDA_INCLUDE=/usr/local/cuda/include
CXXFLAGS=-std=c++17 -g -O3 -Wall -Wno-attributes -pedantic -fPIC -MMD -march=native -mtune=native -I$(CUDA_INCLUDE) -I$(BOOST) -I$(CPPUNIT) -I$(EIGEN)
# Code generated by nvcc for the system compiler does not pass pedantic checks and
# is a temporary file that should not be added to dependencies.
NVCC_CXXFLAGS=--compiler-options '$(filter-out -pedantic -MMD, $(CXXFLAGS))'
NVCCARCH= -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_70,code=[sm_70,compute_70] -gencode arch=compute_75,code=[sm_75,compute_75]
NVCCFLAGS=-std=c++17 -O3 --generate-line-info -MMD --restrict --compiler-bindir $(CXX)
# Silent Eigen warnings.
NVCCFLAGS+= -Xcudafe "--display_error_number --diag_suppress=177 --diag_suppress=20012 --diag_suppress=20013 --diag_suppress=20014 --diag_suppress=20015 " --compiler-bindir $(CXX)
LDFLAGS=-lrt -lcppunit -lcuda -L$(LIBS)
.PHONY: all clean distclean dump
CPPUNIT_EXECUTABLES=$(patsubst %, %_cppunit, $(CPPUNIT_TEST))
CUDA_EXECUTABLES=$(patsubst %, %_cuda, $(CUDA_TEST))
all: $(TEST) $(CPPUNIT_EXECUTABLES) $(CUDA_EXECUTABLES)
clean:
rm -rf .tmp/ $(TEST) $(CPPUNIT_EXECUTABLES) $(CUDA_EXECUTABLES)
distclean: clean
rm -f $(TEST)
$(TEST): %: .tmp/%.cc.o Makefile
$(CXX) $(CXXFLAGS) $< $(LDFLAGS) -o $@
$(CPPUNIT_EXECUTABLES): %: .tmp/%.cc.o .tmp/cppunit_runner.cc.o Makefile
$(CXX) $(CXXFLAGS) $(filter-out Makefile, $+) $(LDFLAGS) -o $@
$(CUDA_EXECUTABLES): %: .tmp/%.cc.o .tmp/%.cu.o .tmp/cppunit_runner.cc.o Makefile
echo Deps: $+
$(NVCC) $(NVCCFLAGS) $(NVCCARCH) $(LDFLAGS) $(filter-out Makefile, $+) -o $@
.tmp/%.cc.o: %.cc Makefile
@mkdir -p .tmp
$(CXX) $(CXXFLAGS) -c $< -o $@
.tmp/%.cu.o: %.cu Makefile
@mkdir -p .tmp
$(NVCC) -dc $(NVCCFLAGS) $(NVCCARCH) $(NVCC_CXXFLAGS) --verbose -c $< -o $@
.tmp/%.cu.ptx: %.cu Makefile
@mkdir -p .tmp
$(NVCC) $(NVCCFLAGS) --ptx --source-in-ptx -gencode arch=compute_75,code=[sm_75,compute_75] $(NVCC_CXXFLAGS) $< -o $@
.tmp/%.cc.i: %.cc Makefile
@mkdir -p .tmp
$(CXX) $(CXXFLAGS) -E $< | grep -v ^# | $(CLANG_FORMAT) > $@
.tmp/%.cu.i: %.cu Makefile
@mkdir -p .tmp
$(NVCC) $(filter-out -MMD, $(NVCCFLAGS)) $(NVCC_CXXFLAGS) -E $< | grep -v ^# \
| $(CLANG_FORMAT) --style="{ColumnLimit: 200}" > $@
-include $(DEP)