-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
186 lines (167 loc) · 6.03 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
NAME = ExaTensor
#ADJUST THE FOLLOWING ENVIRONMENT VARIABLES ACCORDINGLY (choices are given)
#until you see "YOU ARE DONE!". The comments will guide you through (read them).
#Alternatively you can export all relevant environment variables such that this
#Makefile will pick their values, so you will not need to update anything here.
#However you will still need to read the meaning of those variables below.
#Cray cross-compiling wrappers (only for Cray): [WRAP|NOWRAP]:
export WRAP ?= NOWRAP
#Compiler: [GNU|INTEL|CRAY|IBM|PGI]:
export TOOLKIT ?= GNU
#Optimization: [DEV|OPT|PRF]:
export BUILD_TYPE ?= OPT
#MPI library base: [MPICH|OPENMPI]:
export MPILIB ?= MPICH
#BLAS: [ATLAS|MKL|OPENBLAS|ACML|LIBSCI|ESSL|NONE]:
export BLASLIB ?= OPENBLAS
#NVIDIA GPU via CUDA: [CUDA|NOCUDA]:
export GPU_CUDA ?= CUDA
#NVIDIA GPU architecture (two digits, >=35):
export GPU_SM_ARCH ?= 86
#Operating system: [LINUX|NO_LINUX]:
export EXA_OS ?= LINUX
#Only for Linux DEV builds with GNU: [YES|NO]:
export LINUX_GNU_ASAN ?= NO
#ADJUST EXTRAS (optional):
#LAPACK: [YES|NO]:
export WITH_LAPACK ?= YES
#Fast GPU tensor transpose (cuTT library): [YES|NO]:
export WITH_CUTT ?= NO
#In-place GPU tensor contraction (cuTensor library): [YES|NO]:
export WITH_CUTENSOR ?= NO
#ADJUST PARTIAL BUILD OPTIONS:
#Disable actual build completely (debug): [YES|NO]:
export EXA_NO_BUILD ?= NO
#Only enable TAL-SH build ($EXA_NO_BUILD must be NO): [YES|NO]:
export EXA_TALSH_ONLY ?= NO
#The build is part of the ExaTN library build: [YES|NO]:
export EXATN_SERVICE ?= NO
#SET YOUR LOCAL PATHS (for direct builds without Cray compiler wrappers):
#MPI library base (whichever you have, set one):
# Set this if you use MPICH or its derivative (e.g. Cray-MPICH):
export PATH_MPICH ?= /usr/local/mpi/mpich/3.4.1
# Only reset these if MPICH files are spread in system directories:
export PATH_MPICH_INC ?= $(PATH_MPICH)/include
export PATH_MPICH_LIB ?= $(PATH_MPICH)/lib
export PATH_MPICH_BIN ?= $(PATH_MPICH)/bin
# Set this if you use OPENMPI or its derivative (e.g. IBM Spectrum MPI):
export PATH_OPENMPI ?= /usr/local/mpi/openmpi/3.1.0
# Only reset these if OPENMPI files are spread in system directories:
export PATH_OPENMPI_INC ?= $(PATH_OPENMPI)/include
export PATH_OPENMPI_LIB ?= $(PATH_OPENMPI)/lib
export PATH_OPENMPI_BIN ?= $(PATH_OPENMPI)/bin
#BLAS library (whichever you have chosen above):
# Set this path if you have chosen ATLAS (any default Linux BLAS):
export PATH_BLAS_ATLAS ?= /usr/lib/x86_64-linux-gnu
# Set this path to Intel root directory if you have chosen Intel MKL:
export PATH_INTEL ?= /opt/intel
# Only reset these if Intel MKL libraries are spread in system directories:
export PATH_BLAS_MKL ?= $(PATH_INTEL)/mkl/lib/intel64
export PATH_BLAS_MKL_DEP ?= $(PATH_INTEL)/compilers_and_libraries/linux/lib/intel64_lin
export PATH_BLAS_MKL_INC ?= $(PATH_INTEL)/mkl/include/intel64/lp64
# Set this path if you have chosen OpenBLAS:
export PATH_BLAS_OPENBLAS ?= /usr/local/blas/openblas/develop/lib
# Set this path if you have chosen ACML:
export PATH_BLAS_ACML ?= /opt/acml/5.3.1/gfortran64_fma4_mp/lib
# Set this path if you have chosen Cray LibSci:
export PATH_BLAS_LIBSCI ?= /opt/cray/pe/libsci/19.06.1/CRAY/8.5/x86_64/lib
# Set this path if you have chosen ESSL (also set PATH_IBM_XL_CPP, PATH_IBM_XL_FOR, PATH_IBM_XL_SMP below):
export PATH_BLAS_ESSL ?= /sw/summit/essl/6.1.0-2/essl/6.1/lib64
#IBM XL (only set these if you use IBM XL compiler and/or ESSL library):
export PATH_IBM_XL_CPP ?= /sw/summit/xl/16.1.1-3/xlC/16.1.1/lib
export PATH_IBM_XL_FOR ?= /sw/summit/xl/16.1.1-3/xlf/16.1.1/lib
export PATH_IBM_XL_SMP ?= /sw/summit/xl/16.1.1-3/xlsmp/5.1.1/lib
#LAPACK (only set these if you have chosen WITH_LAPACK=YES above):
export PATH_LAPACK_LIB ?= $(PATH_BLAS_OPENBLAS)
export LAPACK_LIBS ?= -L.
#CUDA (set these only if you build with CUDA):
export PATH_CUDA ?= /usr/local/cuda
# Only reset these if CUDA files are spread in system directories:
export PATH_CUDA_INC ?= $(PATH_CUDA)/include
export PATH_CUDA_LIB ?= $(PATH_CUDA)/lib64
export PATH_CUDA_BIN ?= $(PATH_CUDA)/bin
# Reset your CUDA Host compiler if needed:
export CUDA_HOST_COMPILER ?= /usr/bin/g++
# cuTT path (only if you use cuTT library):
export PATH_CUTT ?= /home/dima/src/cutt
# cuTensor path (only if you use cuTensor library):
export PATH_CUTENSOR ?= /home/dima/src/cutensor
#YOU ARE DONE! MAKE IT!
$(NAME):
ifeq ($(EXA_NO_BUILD),NO)
ifeq ($(EXA_TALSH_ONLY),NO)
$(MAKE) -C ./UTILITY
$(MAKE) -C ./GFC
$(MAKE) -C ./DDSS
endif
$(MAKE) -C ./TALSH
ifeq ($(EXA_TALSH_ONLY),NO)
$(MAKE) -C ./DSVP
$(MAKE) -C ./INTRAVIRT
$(MAKE) -C ./INTERVIRT
$(MAKE) -C ./QFORCE
endif
#Gather headers, modules and libraries:
rm -f ./include/*
rm -f ./lib/*
rm -f ./bin/*
ifeq ($(EXA_OS),LINUX)
ifeq ($(TOOLKIT),CRAY)
cp -u ./[A-Z]*/OBJ/*.mod ./include/
else
cp -u ./[A-Z]*/*.mod ./include/
endif
cp -u ./TALSH/*.h ./include/
cp -u ./TALSH/*.hpp ./include/
else
ifeq ($(TOOLKIT),CRAY)
cp ./[A-Z]*/OBJ/*.mod ./include/
else
cp ./[A-Z]*/*.mod ./include/
endif
cp ./TALSH/*.h ./include/
cp ./TALSH/*.hpp ./include/
endif
cp ./[A-Z]*/*.a ./lib/
cp ./[A-Z]*/*.x ./bin/
ifeq ($(EXA_TALSH_ONLY),NO)
cp ./QFORCE/Qforce.x ./
#Create static and shared libraries:
ar x ./lib/libintervirt.a
ar x ./lib/libintravirt.a
ar x ./lib/libdsvp.a
ar x ./lib/libddss.a
ar x ./lib/libtalsh.a
ar x ./lib/libgfc.a
ar x ./lib/libutility.a
mv ./*.o ./lib/
ar cr libexatensor.a ./lib/*.o
ifeq ($(EXA_OS),LINUX)
ifeq ($(WRAP),WRAP)
CC -shared -o libexatensor.so ./lib/*.o
else
ifeq ($(TOOLKIT),IBM)
$(PATH_$(MPILIB)_BIN)/mpicxx -qmkshrobj -o libexatensor.so ./lib/*.o
else
$(PATH_$(MPILIB)_BIN)/mpicxx -shared -o libexatensor.so ./lib/*.o
endif
endif
cp -u ./libexatensor.so ./lib/
cp -u ./libexatensor.a ./lib/
cp -u ./TALSH/libtalsh.so ./
cp -u ./TALSH/libtalsh.so ./lib/
else
cp ./libexatensor.a ./lib/
endif
rm -f ./lib/*.o
else
ifeq ($(EXA_OS),LINUX)
cp -u ./TALSH/libtalsh.so ./
cp -u ./TALSH/libtalsh.so ./lib/
endif
endif
endif
echo "Finished successfully!"
.PHONY: clean
clean:
rm -f ./*.x ./*.a ./*.so ./*.mod ./*/*.x ./*/*.a ./*/*.so ./*/*.mod ./*/OBJ/* ./bin/* ./lib/* ./include/*