| 1 |
#! \file DissectionSolver.hpp |
| 2 |
# \brief task mangemanet of dissection algorithm |
| 3 |
# \author Atsushi Suzuki, Laboratoire Jacques-Louis Lions |
| 4 |
# \date Mar. 30th 2012 |
| 5 |
# \date Jul. 12th 2015 |
| 6 |
# \date Nov. 30th 2016 |
| 7 |
|
| 8 |
# This file is part of Dissection |
| 9 |
# |
| 10 |
# Dissection is free software: you can redistribute it and/or modify |
| 11 |
# it under the terms of the GNU General Public License as published by |
| 12 |
# the Free Software Foundation, either version 3 of the License, or |
| 13 |
# (at your option) any later version. |
| 14 |
# |
| 15 |
# Linking Dissection statically or dynamically with other modules is making |
| 16 |
# a combined work based on Disssection. Thus, the terms and conditions of |
| 17 |
# the GNU General Public License cover the whole combination. |
| 18 |
# |
| 19 |
# As a special exception, the copyright holders of Dissection give you |
| 20 |
# permission to combine Dissection program with free software programs or |
| 21 |
# libraries that are released under the GNU LGPL and with independent modules |
| 22 |
# that communicate with Dissection solely through the Dissection-fortran |
| 23 |
# interface. You may copy and distribute such a system following the terms of |
| 24 |
# the GNU GPL for Dissection and the licenses of the other code concerned, |
| 25 |
# provided that you include the source code of that other code when and as |
| 26 |
# the GNU GPL requires distribution of source code and provided that you do |
| 27 |
# not modify the Dissection-fortran interface. |
| 28 |
# |
| 29 |
# Note that people who make modified versions of Dissection are not obligated |
| 30 |
# to grant this special exception for their modified versions; it is their |
| 31 |
# choice whether to do so. The GNU General Public License gives permission to |
| 32 |
# release a modified version without this exception; this exception also makes |
| 33 |
# it possible to release a modified version which carries forward this |
| 34 |
# exception. If you modify the Dissection-fortran interface, this exception |
| 35 |
# does not apply to your modified version of Dissection, and you must remove |
| 36 |
# this exception when you distribute your modified version. |
| 37 |
# |
| 38 |
# This exception is an additional permission under section 7 of the GNU |
| 39 |
# General Public License, version 3 ("GPLv3") |
| 40 |
# |
| 41 |
# Dissection is distributed in the hope that it will be useful, |
| 42 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 43 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 44 |
# GNU General Public License for more details. |
| 45 |
# |
| 46 |
# You should have received a copy of the GNU General Public License |
| 47 |
# along with Dissection. If not, see <http://www.gnu.org/licenses/>. |
| 48 |
# |
| 49 |
|
| 50 |
WORK_DIR = $(HOME)/work/Linux |
| 51 |
PROJ_DIR = $(WORK_DIR)/dissection |
| 52 |
|
| 53 |
PROJ_SRC = $(PROJ_DIR)/src |
| 54 |
PROJ_LIBDIR = $(PROJ_DIR)/lib |
| 55 |
UNAME := $(shell uname -s) |
| 56 |
# define BLAS MKL or ATLAS : be careful with no space after the name of variable |
| 57 |
# QUAD specifies 128bit floating point arithmetic : DD_REAL by qd library |
| 58 |
# LOND_DOUBLE on Intel specifies 80bit floating point, which may be enough |
| 59 |
ifeq ($(UNAME), Darwin) |
| 60 |
EXT_SHAREDLIB = dylib |
| 61 |
# BLAS = VECLIB |
| 62 |
BLAS = MKL |
| 63 |
COMPILER=LLVM |
| 64 |
QUAD = DD_REAL |
| 65 |
endif |
| 66 |
ifeq ($(UNAME), Linux) |
| 67 |
EXT_SHAREDLIB = so |
| 68 |
BLAS = MKL |
| 69 |
# BLAS = GENERIC |
| 70 |
COMPILER = INTEL17 |
| 71 |
# QUAD = FLOAT128 |
| 72 |
QUAD = DD_REAL |
| 73 |
endif |
| 74 |
PARALLEL = NONE |
| 75 |
MAKE = make -j 8 |
| 76 |
# |
| 77 |
DEBUGFLAG = -g -O3 |
| 78 |
DISSECTION = |
| 79 |
#DISSECTION = NO_METIS |
| 80 |
#DISSECTION = NO_SCOTCH |
| 81 |
# |
| 82 |
COMPILERBASE = $(COMPILER) |
| 83 |
VER = $(subst INTEL,,$(COMPILER)) |
| 84 |
ifneq ($(VER), $(COMPILER)) |
| 85 |
COMPILERBASE=$(subst $(VER),,$(COMPILER)) |
| 86 |
endif |
| 87 |
# |
| 88 |
ifeq ($(COMPILERBASE), INTEL) |
| 89 |
CXX = icpc -std=gnu++98 -restrict -fPIC -pthread |
| 90 |
LD = $(CXX) |
| 91 |
else |
| 92 |
ifeq ($(COMPILERBASE), GNU) |
| 93 |
CXX = g++ -std=c++98 -fPIC -pthread -Drestrict=__restrict |
| 94 |
LD = $(CXX) |
| 95 |
LDOPT = $(DEBUGFLAG) -shared |
| 96 |
MAKE_DEP_OPT = -MM |
| 97 |
DEBUGFLAG += #-pg -fno-omit-frame-pointer |
| 98 |
ifeq ($(UNAME), Darwin) |
| 99 |
SHARED_COMPILER = -framework Accelerate |
| 100 |
else |
| 101 |
SHARED_COMPILER = |
| 102 |
endif |
| 103 |
else |
| 104 |
ifeq ($(COMPILERBASE), LLVM) |
| 105 |
ifeq ($(UNAME), Linux) |
| 106 |
CXX = clang++-3.9 -std=c++03 -pthread -stdlib=libc++ -fPIC -Drestrict=__restrict |
| 107 |
LD = $(CXX) |
| 108 |
else |
| 109 |
CXX = clang -x c++ -std=c++03 -pthread -stdlib=libc++ -fPIC -Drestrict=__restrict |
| 110 |
LD = clang -fPIC -Drestrict=__restrict |
| 111 |
endif |
| 112 |
MAKE_DEP_OPT = -MM |
| 113 |
ifeq ($(UNAME), Darwin) |
| 114 |
LDOPT = $(DEBUGFLAG) -dynamiclib -install_name '$(PROJ_LIBDIR)/libDissection.dylib' -current_version 1.0 |
| 115 |
else |
| 116 |
LDOPT = $(DEBUGFLAG) -shared |
| 117 |
SHARED_COMPILER = |
| 118 |
endif |
| 119 |
VER = 17 |
| 120 |
else |
| 121 |
$(error COMPILER should be specified as one of INTEL14, GNU, LLVM) |
| 122 |
endif |
| 123 |
endif |
| 124 |
endif |
| 125 |
ifeq ($(UNAME), Darwin) |
| 126 |
# LDOPT = $(DEBUGFLAG) -dynamiclib -install_name '$(PROJ_LIBDIR)/libDissection.dylib' |
| 127 |
endif |
| 128 |
ifeq ($(UNAME), Linux) |
| 129 |
LDOPT = $(DEBUGFLAG) -shared |
| 130 |
endif |
| 131 |
MAKE_DEP_OPT = -MM |
| 132 |
# |
| 133 |
# metis and scotch are assumed to be compiled as shared library |
| 134 |
METIS_INC = $(WORK_DIR)/metis-5.1.0/include |
| 135 |
SCOTCH_INC = $(WORK_DIR)/scotch_6.0.4/include |
| 136 |
QD_INC = $(WORK_DIR)/include |
| 137 |
ifeq ($(UNAME), Darwin) |
| 138 |
LIB_DIR_METIS = $(WORK_DIR)/metis-5.1.0/build/Darwin-x86_64/libmetis |
| 139 |
endif |
| 140 |
ifeq ($(UNAME), Linux) |
| 141 |
LIB_DIR_METIS = $(WORK_DIR)/metis-5.1.0/build/Linux-x86_64/libmetis |
| 142 |
endif |
| 143 |
LIB_DIR_SCOTCH = $(WORK_DIR)/scotch_6.0.4/lib |
| 144 |
LIB_DIR_QD = $(WORK_DIR)/lib |
| 145 |
# |
| 146 |
ifeq ($(BLAS), MKL) |
| 147 |
# BLAS_DEF = -DBLAS_MKL -DMKL_ILP64 # 64bit (long long) int for CSR data |
| 148 |
BLAS_DEF = -DBLAS_MKL # 32bit int |
| 149 |
ifeq ($(VER), 18) |
| 150 |
ifeq ($(UNAME), Linux) |
| 151 |
BLAS_INC = /opt/intel/compilers_and_libraries_2018/linux/mkl/include/ |
| 152 |
LIB_DIR_MKL = /opt/intel/compilers_and_libraries_2018/linux/mkl/lib/intel64 |
| 153 |
LIB_DIR_INTEL = /opt/intel/compilers_and_libraries_2018/linux/compiler/lib/intel64 |
| 154 |
endif |
| 155 |
else |
| 156 |
ifeq ($(VER), 17) |
| 157 |
ifeq ($(UNAME), Linux) |
| 158 |
BLAS_INC = /opt/intel/compilers_and_libraries_2017/linux/mkl/include/ |
| 159 |
LIB_DIR_MKL = /opt/intel/compilers_and_libraries_2017/linux/mkl/lib/intel64 |
| 160 |
LIB_DIR_INTEL = /opt/intel/compilers_and_libraries_2017/linux/compiler/lib/intel64 |
| 161 |
endif |
| 162 |
ifeq ($(UNAME), Darwin) |
| 163 |
BLAS_INC = /opt/intel/compilers_and_libraries_2017/mac/mkl/include/ |
| 164 |
LIB_DIR_MKL = /opt/intel/compilers_and_libraries_2017/mac/mkl/lib |
| 165 |
LIB_DIR_INTEL = /opt/intel/compilers_and_libraries_2017/mac/lib |
| 166 |
endif |
| 167 |
else |
| 168 |
ifeq ($(VER), 16) |
| 169 |
ifeq ($(UNAME), Linux) |
| 170 |
BLAS_INC = /opt/intel/compilers_and_libraries/linux/mkl/include/ |
| 171 |
LIB_DIR_MKL = /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64 |
| 172 |
LIB_DIR_INTEL = /opt/intel/compilers_and_libraries/linux/compiler/lib/intel64 |
| 173 |
endif |
| 174 |
else |
| 175 |
ifeq ($(VER), 15) |
| 176 |
BLAS_INC = /opt/intel/composer_xe_2015/mkl/include |
| 177 |
ifeq ($(UNAME), Linux) |
| 178 |
LIB_DIR_MKL = /opt/intel/composer_xe_2015/mkl/lib/intel64 |
| 179 |
LIB_DIR_INTEL = /opt/intel/composer_xe_2015/compiler/lib/intel64 |
| 180 |
else |
| 181 |
ifeq ($(UNAME), Darwin) |
| 182 |
LIB_DIR_MKL = /opt/intel/composer_xe_2015/mkl/lib |
| 183 |
LIB_DIR_INTEL = /opt/intel/composer_xe_2015/lib |
| 184 |
endif |
| 185 |
endif |
| 186 |
else |
| 187 |
ifeq ($(VER), 14) |
| 188 |
BLAS_INC = /opt/intel/composer_xe_2013_sp1/mkl/include |
| 189 |
ifeq ($(UNAME), Linux) |
| 190 |
LIB_DIR_MKL = /opt/intel/composer_xe_2013_sp1/mkl/lib/intel64 |
| 191 |
LIB_DIR_INTEL = /opt/intel/composer_xe_2013_sp1/compiler/lib/intel64 |
| 192 |
else |
| 193 |
ifeq ($(UNAME), Darwin) |
| 194 |
LIB_DIR_MKL = /opt/intel/composer_xe_2013_sp1/mkl/lib |
| 195 |
LIB_DIR_INTEL = /opt/intel/composer_xe_2013_sp1/lib |
| 196 |
endif |
| 197 |
endif |
| 198 |
else |
| 199 |
$(error MKLverion should be 14, 15, 16, 17 or 18) |
| 200 |
endif |
| 201 |
endif |
| 202 |
endif |
| 203 |
endif |
| 204 |
endif |
| 205 |
# |
| 206 |
ifeq ($(UNAME), Linux) |
| 207 |
SHARED_COMPILER = -L$(LIB_DIR_INTEL) -lpthread -lrt |
| 208 |
SHARED_BLAS = -L$(LIB_DIR_MKL) -lmkl_intel_lp64 -lmkl_sequential -lmkl_core |
| 209 |
# SHARED_BLAS = -L$(LIB_DIR_MKL) -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core ## for 64bit integer |
| 210 |
else |
| 211 |
ifeq ($(UNAME), Darwin) |
| 212 |
SHARED_COMPILER = -L$(LIB_DIR_INTEL) -lc++ -lm #-lintlc -lsvml -lc++ -lm |
| 213 |
SHARED_BLAS = -Wl,-rpath,$(LIB_DIR_MKL) -L$(LIB_DIR_MKL) -lmkl_intel_lp64 -lmkl_sequential -lmkl_core |
| 214 |
endif |
| 215 |
endif |
| 216 |
# |
| 217 |
else |
| 218 |
ifeq ($(BLAS), ATLAS) |
| 219 |
BLAS_DEF = -DBLAS_ATLAS |
| 220 |
# for ATLAS BLAS |
| 221 |
ifeq ($(COMPILER), INTEL) |
| 222 |
BLAS_INC = /usr/local/atlas/intel/include |
| 223 |
else |
| 224 |
BLAS_INC = /usr/local/atlas/include |
| 225 |
endif |
| 226 |
else |
| 227 |
ifeq ($(BLAS), OPENBLAS) |
| 228 |
BLAS_DEF = -DOPENBLAS |
| 229 |
OPENBLAS_DIR = $(WORK_DIR)/OpenBLAS-0.2.14 |
| 230 |
BLAS_INC = $(OPENBLAS_DIR) |
| 231 |
SHARED_BLAS = -L$(OPENBLAS_DIR) -lopenblas |
| 232 |
else |
| 233 |
ifeq ($(BLAS), VECLIB) |
| 234 |
ifeq ($(UNAME), Darwin) |
| 235 |
BLAS_DEF = -DVECLIB |
| 236 |
BLAS_INC = /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers |
| 237 |
SHARED_COMPILER = -framework Accelerate -lc++ -lm |
| 238 |
endif |
| 239 |
else |
| 240 |
ifeq ($(BLAS), GENERIC) |
| 241 |
BLAS_DEF = -DBLAS_GENERIC |
| 242 |
BLAS_INC = .. |
| 243 |
SHARED_BLAS = |
| 244 |
SHARED_COMPILER = -lc++ -lm |
| 245 |
else |
| 246 |
$(error BLAS should be specified as one of MKL, VECLIB, OpenBLAS, GENERIC) |
| 247 |
endif |
| 248 |
endif |
| 249 |
endif |
| 250 |
endif |
| 251 |
endif |
| 252 |
# |
| 253 |
CCFLAGS = $(DEBUGFLAG) -I$(SCOTCH_INC) $(BLAS_DEF) -I$(BLAS_INC) -I$(PROJ_SRC) |
| 254 |
# to use pthread.h in case of C++03 |
| 255 |
CCFLAGS += -DPOSIX_THREADS |
| 256 |
# -DNO_TO_STRING for C++ compiler without to_string() defined in C++11 |
| 257 |
ifeq ($(COMPILERBASE), INTEL) |
| 258 |
CCFLAGS += -DNO_TO_STRING |
| 259 |
endif |
| 260 |
ifeq ($(DISSECTION), NO_METIS) |
| 261 |
CCFLAGS += -DNO_METIS |
| 262 |
LIB_METIS = |
| 263 |
else |
| 264 |
CCFLAGS += -I$(METIS_INC) |
| 265 |
ifeq ($(UNAME), Linux) |
| 266 |
LIB_METIS = -Xlinker -rpath=$(LIB_DIR_METIS) -L$(LIB_DIR_METIS) -lmetis |
| 267 |
else |
| 268 |
LIB_METIS = -L$(LIB_DIR_METIS) -lmetis |
| 269 |
endif |
| 270 |
endif |
| 271 |
# |
| 272 |
ifeq ($(QUAD), DD_REAL) |
| 273 |
CCFLAGS += -D$(QUAD) -I$(QD_INC) |
| 274 |
ifeq ($(UNAME), Linux) |
| 275 |
LIB_QD = -Xlinker -rpath=$(LIB_DIR_QD) -L$(LIB_DIR_QD) -lqd |
| 276 |
else |
| 277 |
LIB_QD = -L$(LIB_DIR_QD) -lqd |
| 278 |
endif |
| 279 |
endif |
| 280 |
ifeq ($(QUAD), LONG_DOUBLE) |
| 281 |
CCFLAGS += -D$(QUAD) -DNO_OCTRUPLE |
| 282 |
endif |
| 283 |
ifeq ($(QUAD), FLOAT128) |
| 284 |
CCFLAGS += -DNO_OCTRUPLE |
| 285 |
LIB_QD = -lquadmath |
| 286 |
endif |
| 287 |
# |
| 288 |
# |
| 289 |
ifeq ($(UNAME), Darwin) |
| 290 |
CCFLAGS += #-DGETRUSAGE |
| 291 |
LIB_SCOTCH = -L$(LIB_DIR_SCOTCH) -lscotch -lscotcherr |
| 292 |
endif |
| 293 |
ifeq ($(UNAME), Linux) |
| 294 |
CCFLAGS += -DCLOCK_GETTIME |
| 295 |
LIB_SCOTCH = -Xlinker -rpath=$(LIB_DIR_SCOTCH) -L$(LIB_DIR_SCOTCH) -lscotch -lscotcherr |
| 296 |
endif |