-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (83 loc) · 3 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
87
88
89
90
91
92
93
94
95
96
97
DEF =
INCLUDE =
CXXFLAGS := $(CXXFLAGS) -g -Wall -O4
EXEC = swaptions
ALL_EXEC = swaptions swaptions_cpu swaptions_gpu swaptions_mpi swaptions_snucl
OBJS= CumNormalInv.o MaxFunction.o RanUnif.o nr_routines.o \
HJM_SimPath_Forward_Blocking.o HJM.o HJM_Swaption_Blocking.o \
HJM_Securities.o timers.o
ALL_OBJS= $(OBJS) HJM_Securities_cpu.o HJM_Securities_gpu.o \
HJM_Securities_mpi.o HJM_Securities_snucl.o
ifdef version
ifeq "$(version)" "pthreads"
DEF := $(DEF) -DENABLE_THREADS
CXXFLAGS := $(CXXFLAGS) -pthread
else
ifeq "$(version)" "cpu"
LDFLAGS := $(LDFLAGS) -lOpenCL
DEF := $(DEF) -DENABLE_OPENCL -DDEVICE_CPU
OBJS := CumNormalInv.o MaxFunction.o RanUnif.o nr_routines.o \
HJM_SimPath_Forward_Blocking.o HJM.o HJM_Swaption_Blocking.o \
HJM_Securities_cpu.o timers.o
EXEC := swaptions_cpu
endif
ifeq "$(version)" "gpu"
LDFLAGS := $(LDFLAGS) -lOpenCL
DEF := $(DEF) -DENABLE_OPENCL -DDEVICE_GPU
OBJS := CumNormalInv.o MaxFunction.o RanUnif.o nr_routines.o \
HJM_SimPath_Forward_Blocking.o HJM.o HJM_Swaption_Blocking.o \
HJM_Securities_gpu.o timers.o
EXEC := swaptions_gpu
endif
ifeq "$(version)" "mpi"
LDFLAGS := $(LDFLAGS) -lOpenCL
CXX := mpic++
DEF := $(DEF) -DENABLE_OPENCL -DENABLE_MPI
OBJS := CumNormalInv.o MaxFunction.o RanUnif.o nr_routines.o \
HJM_SimPath_Forward_Blocking.o HJM.o HJM_Swaption_Blocking.o \
HJM_Securities_mpi.o timers.o
EXEC := swaptions_mpi
endif
ifeq "$(version)" "snucl"
CXX := mpic++
DEF := $(DEF) -DENABLE_OPENCL -DENABLE_SNUCL
OBJS := CumNormalInv.o MaxFunction.o RanUnif.o nr_routines.o \
HJM_SimPath_Forward_Blocking.o HJM.o HJM_Swaption_Blocking.o \
HJM_Securities_snucl.o timers.o
EXEC := swaptions_snucl
INCLUDE := $(INCLUDE) -I$(SNUCLROOT)/inc
LDLIBS := $(LDLIBS) -L$(SNUCLROOT)/lib
LDFLAGS := $(LDFLAGS) -lsnucl_cluster
endif
ifeq "$(version)" "snucl_no_reduc"
CXX := mpic++
DEF := $(DEF) -DENABLE_OPENCL -DENABLE_SNUCL -DNON_REDUCTION
OBJS := CumNormalInv.o MaxFunction.o RanUnif.o nr_routines.o \
HJM_SimPath_Forward_Blocking.o HJM.o HJM_Swaption_Blocking.o \
HJM_Securities_snucl_without_reduc.o timers.o
EXEC := swaptions_snucl_no_reduc
INCLUDE := $(INCLUDE) -I$(SNUCLROOT)/inc
LDLIBS := $(LDLIBS) -L$(SNUCLROOT)/lib
LDFLAGS := $(LDFLAGS) -lsnucl_cluster
endif
endif
endif
all: $(EXEC)
$(EXEC): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEF) $(OBJS) $(INCLUDE) $(LIBS) $(LDLIBS) -o $(EXEC)
.cpp.o:
$(CXX) $(CXXFLAGS) $(DEF) -c $*.cpp -o $*.o
.c.o:
$(CXX) $(CXXFLAGS) $(DEF) -c $*.c -o $*.o
HJM_Securities_cpu.o: HJM_Securities.cpp
$(CXX) $(CXXFLAGS) $(DEF) -c $^ -o $@
HJM_Securities_gpu.o: HJM_Securities.cpp
$(CXX) $(CXXFLAGS) $(DEF) -c $^ -o $@
HJM_Securities_mpi.o: HJM_Securities.cpp
$(CXX) $(CXXFLAGS) $(DEF) -c $^ -o $@
HJM_Securities_snucl.o: HJM_Securities.cpp
$(CXX) $(CXXFLAGS) $(DEF) -c $^ -o $@
HJM_Securities_snucl_without_reduc.o: HJM_Securities.cpp
$(CXX) $(CXXFLAGS) $(DEF) -c $^ -o $@
clean:
rm -f $(ALL_OBJS) $(ALL_EXEC)