-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.gcc-openblas
161 lines (121 loc) · 5.33 KB
/
Makefile.gcc-openblas
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#===============================================================================
# Variable Definitions
#===============================================================================
NC_ROOT = /opt/cray/pe/netcdf/4.6.1.3/INTEL/16.0
H5_ROOT = /opt/cray/pe/hdf5/1.10.2.0/INTEL/16.0
OPENBLAS_ROOT = /home/Christopher.Dupuis/openblergs
FFTW_ROOT = /opt/cray/pe/fftw/3.3.8.1/broadwell/
NC_LIBDIR = ${NC_ROOT}/lib
NC_INCDIR = ${NC_ROOT}/include
H5_LIBDIR = ${H5_ROOT}/lib
H5_INCDIR = ${H5_ROOT}/include
OPENBLAS_LIBDIR = ${OPENBLAS_ROOT}/lib
OPENBLAS_INCDIR = ${OPENBLAS_ROOT}/include
FFTW_LIBDIR = ${FFTW_ROOT}/lib
FFTW_INCDIR = ${FFTW_ROOT}/include
CXX := g++
OPENMP_FLAG := -fopenmp
OPENMP_LIB := -lgomp
LDLIBS := \
-L${NC_LIBDIR} \
-L${H5_LIBDIR} \
-L${OPENBLAS_LIBDIR} \
-L${FFTW_LIBDIR}
LDFLAGS := \
-Wl,-rpath=${NC_LIBDIR} \
-Wl,-rpath=${H5_LIBDIR} \
-Wl,-rpath=${OPENBLAS_LIBDIR} \
-Wl,-rpath=${FFTW_LIBDIR}
LINALG_FLAGS := \
-I${OPENBLAS_INCDIR}
OPENBLAS_LIBS := \
-L${OPENBLAS_LIBDIR} \
-lopenblas
ifdef with_plasma
LINALG_FLAGS += \
-I${PLASMA_INCDIR} \
-L${PLASMA_LIBDIR}
LDLIBS += \
-L${PLASMA_LIBDIR}
PLASMA_LIBS := \
-lplasma \
-lcoreblasqw \
-lcoreblas
LINALG_LIBS := \
${PLASMA_LIBS} \
${OPENBLAS_LIBS} \
-lquark \
CMP_FLAG := \
-DWITH_PLASMA
else
PLASMA_LIBS :=
LINALG_LIBS += \
${OPENBLAS_LIBS} \
CMP_FLAG := \
-DWITH_OPENBLAS
endif
FFTW_FLAGS := \
-I${FFTW_INCDIR} \
-L${FFTW_LIBDIR}
FFTW_LIBS := \
-lfftw3f \
-lm
NC_FLAGS := \
-I${NC_INCDIR} \
-L${NC_LIBDIR}
NETCDF_FLAGS := \
${NC_FLAGS}
NETCDF_LIBS := \
-lnetcdf
FLAGS := ${CXXFLAGS} -Wall -Wextra -std=c++11 -Isrc/ -Isrc/linalg ${LDFLAGS} ${NETCDF_FLAGS} ${OPENMP_FLAG} ${LINALG_FLAGS} ${FFTW_FLAGS} ${CMP_FLAG}
LIBS := ${LDLIBS} ${NETCDF_LIBS} ${LINALG_LIBS} ${FFTW_LIBS} ${OPENMP_LIB}
PROD := -O2
DB := ${DBFLAGS} -O0 -g -DDEBUG
HPP_SOURCE := src/*.hpp
CPP_SOURCE := src/*.cpp main.cpp
TPP_SOURCE := src/*.tpp
ifdef with_plasma
LINALG_HPP_SOURCE := linalg/plasma_svd.hpp
LINALG_TPP_SOURCE := linalg/plasma_svd.tpp
else
LINALG_HPP_SOURCE := linalg/openblas_svd.hpp
LINALG_TPP_SOURCE := linalg/openblas_svd.tpp
endif
ALL_SOURCE := ${HPP_SOURCE} ${LINALG_HPP_SOURCE} ${CPP_SOURCE} ${TPP_SOURCE} ${LINALG_TPP_SOURCE}
BIN_MAIN := bin/main.x
BIN_DEBUG := bin/debug.x
#===============================================================================
# Target Definitions
#===============================================================================
.PHONY: build
build: ${BIN_MAIN}
cp ${BIN_MAIN} edgi
${BIN_MAIN}: ${ALL_SOURCE}
${CXX} ${PROD} ${FLAGS} -o ${BIN_MAIN} ${CPP_SOURCE} ${LIBS}
.PHONY: debug
debug: ${BIN_DEBUG}
cp ${BIN_DEBUG} edgi_debug
${BIN_DEBUG}: ${ALL_SOURCE}
${CXX} ${DB} ${FLAGS} -o ${BIN_DEBUG} ${CPP_SOURCE} ${LIBS}
.PHONY: clean
clean:
rm -f bin/*.x bin/*.o edgi edgi_debug
.PHONY: load
load:
@echo ''
@echo 'This makefile includes recipes for four builds using the GCC compiler.'
@echo ''
@echo 'Requirements:'
@echo ' GCC compiler supporting C++11'
@echo ' OpenBLAS library compiled with GCC'
@echo ' HDF5 library compiled with GCC (for NetCDF)'
@echo ' NetCDF library compiled with GCC'
@echo ' FFTW library compiled with GCC'
@echo ' (Optional) Plasma linear algebra library (must be version 2.8.0)'
@echo ''
@echo 'Builds:'
@echo ' make build -> production mode with OpenBLAS'
@echo ' make debug -> debug mode with OpenBLAS'
@echo ' make with_plasma=1 build -> production mode with PLASMA'
@echo ' make with_plasma=1 debug -> debug mode with PLASMA'
@echo ''