-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (76 loc) · 2.2 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
INC := -I$(CUDA_HOME)/include -I.
LIB := -L$(CUDA_HOME)/lib64
LIBS := -lcudart -lcudadevrt -Xcompiler -fopenmp
NVCCFLAGS := -lineinfo -rdc=true #--ptxas-options=-v #-Xptxas -dlcm=cg #--use_fast_math -lgomp #-arch=$(ARCH)
ifeq ($(DEBUG), true)
#NVCC_DEBUG := -g -G # Causes troubles with floating point numbers if uncommented
_DEBUG := -D DEBUG=true
endif
ifeq ($(HOST), yme)
ARCH := sm_70
else ifeq ($(HOST), heid)
ARCH := sm_70
else ifeq ($(HOST), idun)
ARCH := sm_60
else
ARCH := sm_75
endif
ifeq ($(ARCH), sm_60)
_ARCH := -D ARCH=pascal
endif
ifeq ($(SMEM), true)
_SMEM := -D SMEM=true
endif
ifeq ($(COOP), true)
_COOP := -D COOP=true
endif
ifneq ($(DIM),)
_DIM := -D DIM=$(DIM)
endif
ifneq ($(ITERATIONS),)
_ITERATIONS := -D ITERATIONS=$(ITERATIONS)
endif
ifneq ($(NGPUS),)
_NGPUS := -D NGPUS=$(NGPUS)
endif
ifneq ($(RADIUS),)
_RADIUS := -D RADIUS=$(RADIUS)
endif
ifneq ($(COARSEN_X),)
_COARSEN_X := -D COARSEN_X=$(COARSEN_X)
endif
ifneq ($(DIMENSIONS),)
_DIMENSIONS := -D DIMENSIONS=$(DIMENSIONS)
endif
ifneq ($(SMEM_PAD),)
_SMEM_PAD := -D SMEM_PAD=$(SMEM_PAD)
endif
ifneq ($(PADDED),)
_PADDED := -D PADDED=$(PADDED)
endif
ifneq ($(REGISTER),)
_REGISTER := -D REGISTER=$(REGISTER)
endif
ifneq ($(HEURISTIC),)
_HEURISTIC := -D HEURISTIC=$(HEURISTIC)
endif
all: stencil_$(ID)
stencil_$(ID): src/main.cu include/stencil_utils.h include/stencil_error_checker.h include/constants.h
nvcc src/main.cu -O3 -o bin/stencil_$(ID) -arch $(ARCH) \
$(NVCC_DEBUG) $(INC) $(LIB) $(NVCCFLAGS) $(LIBS) \
-D BLOCK_X=$(BLOCK_X) \
-D BLOCK_Y=$(BLOCK_Y) \
-D BLOCK_Z=$(BLOCK_Z) \
-D DIM=$(DIM) \
$(_RADIUS) $(_SMEM) $(_COOP) $(_NGPUS) $(_ITERATIONS) \
$(_DIMENSIONS) $(_COARSEN_X) $(_SMEM_PAD) \
$(_ARCH) $(_REGISTER) $(_PADDED) $(_HEURISTIC) $(_DEBUG)
stencil_cpu: include/stencil_initializer.h src/stencil_cpu.cu
gcc src/stencil_cpu.cpp -O3 -o bin/stencil_cpu -D DIM=$(DIM) $(_ITERATIONS)
profile:
sudo ncu -f -o profile bin/stencil_$(ID)
clean:
rm -f bin/stencil_*
rm -f result solution
clean_results:
rm -f results/*