-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.intel-mkl
173 lines (133 loc) · 6.28 KB
/
Makefile.intel-mkl
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
161
162
163
164
165
166
167
168
169
170
171
172
#===============================================================================
# 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
MKL_ROOT = /opt/intel/compilers_and_libraries_2018.3.222/linux/mkl
NC_LIBDIR = ${NC_ROOT}/lib
NC_INCDIR = ${NC_ROOT}/include
H5_LIBDIR = ${H5_ROOT}/lib
H5_INCDIR = ${H5_ROOT}/include
MKL_LIBDIR = ${MKL_ROOT}/lib/intel64
MKL_INCDIR = ${MKL_ROOT}/include
FFTW_LIBDIR = ${MKL_LIBDIR}
FFTW_INCDIR = ${MKL_INCDIR}/fftw
CXX := icpc
OPENMP_FLAG := -qopenmp
OPENMP_LIB := -liomp5
LDLIBS := \
-L${NC_LIBDIR} \
-L${H5_LIBDIR} \
-L${MKL_LIBDIR} \
-L${FFTW_LIBDIR}
LDFLAGS := \
-Wl,-rpath=${NC_LIBDIR} \
-Wl,-rpath=${H5_LIBDIR} \
-Wl,-rpath=${MKL_LIBDIR} \
-Wl,-rpath=${FFTW_LIBDIR}
LINALG_FLAGS := \
-I${MKL_INCDIR}
MKL_LIBS := \
-lmkl_intel_lp64 \
-lmkl_intel_thread \
-lmkl_core
ifdef with_plasma
LINALG_FLAGS += \
-I${PLASMA_INCDIR} \
-L${PLASMA_LIBDIR}
PLASMA_LIBS := \
-lplasma \
-lcoreblasqw \
-lcoreblas
LINALG_LIBS := \
${PLASMA_LIBS} \
${MKL_LIBS} \
-lquark # \
# -lifport \
# -lifcoremt \
# -limf \
# -lsvml \
# -lirc
CMP_FLAG := \
-DWITH_PLASMA
else
LINALG_FLAGS += \
-DMKL_Complex8="std::complex<float>" \
-DMKL_Complex16="std::complex<double>"
PLASMA_LIBS :=
LINALG_LIBS := \
${MKL_LIBS} # \
# -lifport \
# -lifcoremt \
# -limf \
# -lsvml \
# -lirc
CMP_FLAG := \
-DWITH_MKL
endif
FFTW_FLAGS := \
-I${FFTW_INCDIR} \
-L${FFTW_LIBDIR}
FFTW_LIBS := \
# -lfftw3f \
# -lm
NC_FLAGS := \
-I${NC_INCDIR} \
-L${NC_LIBDIR} \
-I${H5_INCDIR} \
-L${H5_LIBDIR}
NETCDF_FLAGS := \
${NC_FLAGS}
NETCDF_LIBS := \
-lhdf5 -lhdf5_hl -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/mkl_svd.hpp
LINALG_TPP_SOURCE := linalg/mkl_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 Intel compiler.'
@echo ''
@echo 'Requirements:'
@echo ' Intel compiler supporting C++11'
@echo ' Intel MKL library'
@echo ' HDF5 library compiled with Intel (for NetCDF)'
@echo ' NetCDF library compiled with Intel'
@echo ' (Optional) Plasma linear algebra library (must be version 2.8.0)'
@echo ''
@echo 'Builds:'
@echo ' make build -> production mode with MKL'
@echo ' make debug -> debug mode with MKL'
@echo ' make with_plasma=1 build -> production mode with PLASMA'
@echo ' make with_plasma=1 debug -> debug mode with PLASMA'
@echo ''