-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.run
98 lines (67 loc) · 2.52 KB
/
Makefile.run
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
build:
make all
################
### OpenCL ####
################
SERGE_OCL_DIR := ~/travail/sample/OpenCL/Apriori_GPU/
SERGE_OCL_APPLI := ./AprioriPBI src/chess.dat 3000
SPECFEM_OCL_DIR := /home/kevin/final/async.ocl/ #/home/kevin/travail/sample/specfem-build
SPECFEM_OCL_APPLI := bin/xspecfem3D
OCL_DIR := $(SPECFEM_OCL_DIR)
OCL_APPLI := $(SPECFEM_OCL_APPLI)
LD_PRELOAD_ENV := $(shell make get_env_preload)
run_ocl : build
cd $(OCL_DIR) && $(MPI_RUN) $(LD_PRELOAD_ENV) $(OCL_APPLI) || echo "Failed"
debug_ocl : build
cd $(OCL_DIR) && gdb -ex 'set environment $(LD_PRELOAD_ENV)' --args $(OCL_APPLI)
##############
### CUDA ####
##############
CUDA_DIR := /home/kevin/final/async.cuda/
CUDA_APPLI := bin/xspecfem3D
CUDA_BIN := $(CUDA_DIR)$(CUDA_APPLI)
CUDA_INC := -I/usr/local/cuda-5.5/targets/x86_64-linux/include/ -I/usr/local/cuda-5.5/include
CUDA_CFLAGS := $(CUDA_INC)
NVCC := /usr/local/cuda/bin/nvcc --cudart=shared
INSTR_CFLAGS := -finstrument-functions
NV_INSTR := --compiler-options $(INSTR_CFLAGS)
NV_TEMP_CFLAGS = --keep-dir=int --keep
CUDA_EXAMPLE_CFLAGS := ${CFLAGS}
CUDA_EXAMPLE_CFLAGS := $(shell echo "${CUDA_EXAMPLE_CFLAGS}" | sed -e 's/-std=gnu99//g')
CUDA_EXAMPLE_CFLAGS := $(shell echo "${CUDA_EXAMPLE_CFLAGS}" | sed -e 's/-Werror//g')
CUDA_EXAMPLE_CFLAGS := $(shell echo "${CUDA_EXAMPLE_CFLAGS}" | sed -e 's/-Wall//g')
CUDA_EXAMPLE_CFLAGS := $(shell echo "${CUDA_EXAMPLE_CFLAGS}" | sed -e 's/-pedantic//g')
clean-cuda : clean-cuda-example
rm -rf *.i *.ii *.cudafe* *.fatbin* *.hash *.module_id *.o *.ptx *.cubin
### Cuda example ###
hello : hello.cu
$(NVCC) $(CUDA_EXAMPLE_CFLAGS) $< -o $@ $(NV_INSTR)
run_cuda : $(CUDA_SO_NAME)
cd $(CUDA_DIR) && $(MPI_RUN) $(LD_PRELOAD_ENV) $(CUDA_APPLI) || echo "Failed"
debug_cuda : $(CUDA_SO_NAME)
cd $(CUDA_DIR) && gdb -ex 'set environment $(LD_PRELOAD_ENV)' --args $(CUDA_APPLI)
clean-cuda-example :
rm -rf hello hello.tmp int/
build-keep: hello.cu
mkdir -p int
$(NVCC) $(CUDA_EXAMPLE_CFLAGS) $< -o ./hello $(NV_INSTR) $(NV_TEMP_CFLAGS)
#################################
ocl: $(OCL_SO_NAME)
cuda: $(CUDA_SO_NAME)
all_files: file_cuda.out file_ocl.out
all_heads: head_cuda.out head_ocl.out
file_%.out: %
make run_$< 1> $@ 2> $@.err
FL_DIGITS=3
head_%.out : file_%.out
head -5000 $< > $@
sed -i '/setting cuda devices/d' $@
sed -i '/image2d_t/d' $@
sed -i '/Entering directory/d' $@
sed -i '/LD_PRELOAD=/d' $@
sed -i 's/,1>/>/g' $@
sed -i 's/,1>/>/g' $@
sed -i 's/0\.000000e+00, 0\.000000e+00, 0.*/0/g' $@
new_head_%.out : %
touch file_$<.out
make head_$<.out