forked from cbassa/cdmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
57 lines (40 loc) · 1.54 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
# CUDA PATH
CUDAPATH = $(shell dirname $(shell dirname $(shell which nvcc)))
# Compiling flags
CFLAGS = -I./cuda-samples/Common
CFLAGS_hdf = $(CFLAGS) -I/usr/include/hdf5/serial/
CFLAGS_udp = $(CFLAGS) -Xcompiler "-fopenmp"
# Linking flags
LFLAGS = -lm -L$(CUDAPATH)/lib64 -lcufft -lhdf5 -lcurand
LFLAGS_udp = -lm -L$(CUDAPATH)/lib64 -L./cuda-samples/Common -lcufft -lcurand -Xlinker "-lzstd -llofudpman
# Compilers
CC = gcc
CXX = g++
NVCC = $(CUDAPATH)/bin/nvcc -arch=sm_70 -O3 --use_fast_math -ccbin=$(CXX)
ifeq ($(CC), icc)
LFLAGS_udp += -L$(ONEAPI_ROOT)/compiler/latest/linux/compiler/lib/intel64_lin/ -liomp5 -lirc"
else
LFLAGS_udp += -lgomp"
endif
cdmt: git cdmt.o
$(NVCC) $(CFLAGS_hdf) -o cdmt cdmt.o $(LFLAGS)
cdmt.o: cdmt.cu
$(NVCC) $(CFLAGS_hdf) -o $@ -c $<
cdmt_udp: git cdmt_udp.o
$(NVCC) $(CFLAGS_udp) -o cdmt_udp ./cdmt_udp.o $(LFLAGS_udp)
cdmt_udp.o: cdmt_udp.cu
$(NVCC) $(CFLAGS_udp) -o $@ -c $<
cdmt_udp_stokesV: stokesVPrep cdmt_udp_stokesV.o
$(NVCC) $(CFLAGS_udp) -o cdmt_udp_stokesV ./cdmt_udp_stokesV.o $(LFLAGS_udp)
stokesVPrep:
cp ./cdmt_udp.cu ./cdmt_udp_stokesV.cu
sed -i 's/cp1\[idx1\]\.x\*cp1\[idx1\]\.x+cp1\[idx1\]\.y\*cp1\[idx1\]\.y+cp2\[idx1\]\.x\*cp2\[idx1\]\.x+cp2\[idx1\]\.y\*cp2\[idx1\]\.y/2.0 \* ((cp1\[idx1\]\.x \* cp2\[idx1\]\.y) - (cp1\[idx1\]\.y \* cp2\[idx1\]\.x))/g' cdmt_udp_stokesV.cu
cdmt_udp_stokesV.o:cdmt_udp_stokesV.cu
$(NVCC) $(CFLAGS_udp) -o $@ -c $<
all: cdmt cdmt_udp cdmt_udp_stokesV
git:
git submodule update --init --recursive --remote
clean:
rm -f *.o
rm -f *~
rm *stokesV.cu; exit 0;