-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwscript
498 lines (424 loc) · 22.6 KB
/
wscript
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
import sys, os, logging, subprocess, types, copy, waflib
def configure(ctx):
""" Set compilers """
if ctx.env.with_gui:
ctx.env["COMPILER_CXX"] = ctx.env["CXX"]
ctx.load("compiler_cxx qt5")
else:
ctx.load("compiler_cxx")
detect_intel_oneapi_compiler(ctx)
detect_nvcpp_compiler(ctx)
if ctx.options.static:
ctx.env.append_unique("LIB", [ "dl" ])
""" Set default compilers flags"""
if ctx.env.COMPILER_CXX == "g++":
ctx.env.append_unique("CXXFLAGS", [ "-fopenmp", "-Wno-psabi" ])
ctx.env.append_unique("LINKFLAGS", [ "-fopenmp" ])
if ctx.env.COMPILER_CXX == "icpc":
ctx.env.append_unique("CXXFLAGS", [ "-qopenmp", "-diag-disable=10441" ])
ctx.env.append_unique("LINKFLAGS", [ "-qopenmp", "-diag-disable=10441" ])
if ctx.env.COMPILER_CXX == "clang++":
ctx.env.append_unique("CXXFLAGS", [ "-fopenmp" ])
ctx.env.append_unique("LINKFLAGS", [ "-fopenmp" ])
if ctx.env.COMPILER_CXX == "icpx":
ctx.env.append_unique("CXXFLAGS", [ "-qopenmp" ])
ctx.env.append_unique("LINKFLAGS", [ "-qopenmp" ])
if ctx.env.COMPILER_CXX == "nvc++":
ctx.env.append_unique("CXXFLAGS", [ "-fopenmp", "--diag_suppress initialization_not_reachable", "--diag_suppress code_is_unreachable" ])
ctx.env.append_unique("LINKFLAGS", [ "-fopenmp", "-fortranlibs" ])
if ctx.options.flavor == "fujitsu":
ctx.env.append_unique("CXXFLAGS" , [ "-Kopenmp", "-SSL2" ])
ctx.env.append_unique("LINKFLAGS", [ "-Kopenmp", "-SSL2" ])
if ctx.options.intwidth == "32":
ctx.env.append_unique("DEFINES", [ "esint=int" ])
ctx.env.append_unique("DEFINES_API", [ "FETI4I_INT_WIDTH=32", "MESIO_INT_WIDTH=32" ])
if ctx.options.intwidth == "64":
ctx.env.append_unique("DEFINES", [ "esint=long" ])
ctx.env.append_unique("DEFINES_API", [ "FETI4I_INT_WIDTH=64", "MESIO_INT_WIDTH=64" ])
if ctx.options.simd_off:
ctx.env.append_unique("DEFINES", [ "SIMD_OFF" ])
ctx.env.append_unique("CXXFLAGS", [ "-std=c++17", "-Wall" ])
ctx.env.append_unique("CXXFLAGS", ctx.options.cxxflags.split())
if ctx.options.mode == "release":
ctx.env.append_unique("CXXFLAGS", [ "-O3", "-g" ])
if ctx.options.mode == "devel":
ctx.env.append_unique("CXXFLAGS", [ "-O2", "-g" ])
if ctx.options.mode == "debug":
ctx.env.append_unique("CXXFLAGS", [ "-O0", "-g" ])
if ctx.options.mode == "profile":
ctx.env.append_unique("CXXFLAGS", [ "-O3" ])
ctx.env.append_unique("INCLUDES", "src")
ctx.env.append_unique("DEFINES", [ "__ESMODE__="+ctx.options.mode.upper() ])
""" Recurse to third party libraries wrappers"""
recurse(ctx)
# check wrappers and setup defines
def setup_wrapper(wrapper_name, requested_lib, all_libs):
if requested_lib == "auto":
for lib in all_libs:
if ctx.env["HAVE_" + lib.upper()]:
requested_lib = lib
break
else:
requested_lib = "empty"
if requested_lib != "empty":
if not ctx.env["HAVE_" + requested_lib.upper()]:
raise waflib.Errors.ConfigurationError("Requested library " + requested_lib + " for wrapper " + wrapper_name + " is not available")
define_string = "ESPRESO_USE_WRAPPER_" + wrapper_name.upper() + "_" + requested_lib.upper() + "=1"
if requested_lib != "empty":
ctx.env.append_unique("DEFINES_WRAPPERS", [ define_string ] )
setup_wrapper("dnblas", ctx.options.wrapper_dnblas, ["mkl", "blas"])
setup_wrapper("dnsolver", ctx.options.wrapper_dnsolver, ["mkl", "lapack"])
setup_wrapper("lapack", ctx.options.wrapper_lapack, ["mkl", "lapack"])
setup_wrapper("spblas", ctx.options.wrapper_spblas, ["mkl", "suitesparse"])
setup_wrapper("spsolver", ctx.options.wrapper_spsolver, ["mkl", "suitesparse"])
setup_wrapper("scsolver", ctx.options.wrapper_scsolver, ["mkl", "suitesparse"])
setup_wrapper("gpu", ctx.options.wrapper_gpu, ["cuda", "rocm", "oneapi"])
ctx.env.intwidth = ctx.options.intwidth
ctx.env.mode = ctx.options.mode
settings(ctx)
def build(ctx):
ctx.env.append_unique("DEFINES_INFO", [ '__ESCOMMIT__=\"{0}\"'.format(get_commit()) ])
ctx.env.append_unique("DEFINES_INFO", [ '__ESCXX__=\"{0}\"'.format(ctx.env.CXX[0]) ])
ctx.env.append_unique("DEFINES_INFO", [ '__ESBUILDPATH__=\"{0}\"'.format(ctx.bldnode.abspath()) ])
ctx.env.append_unique("DEFINES_INFO", [ '__ESCXXFLAGS__=\"{0}\"'.format(" ".join(ctx.env.CXXFLAGS)) ])
# dirty hack
# find better solution by waf
ctx.env["STLIB_MARKER"] = ["-Wl,-Bstatic,--start-group"]
ctx.env.prepend_value("SHLIB_MARKER", "-Wl,--end-group")
features = "cxx cxxshlib"
ctx.lib = ctx.shlib
if ctx.env.static or ctx.options.static:
features = "cxx"
ctx.lib = ctx.stlib
prefix = "es"
ctx.checker = []
ctx.mesio = []
ctx.espreso = []
def build_checker(files, target, use=[]):
ctx(features=features, source=files,target=prefix+target, use=use)
ctx.checker += [ prefix+target ] + use
def build_mesio(files, target, use=[]):
ctx(features=features, source=files,target=prefix+target, use=use)
ctx.mesio += [ prefix+target ] + use
def build_espreso(files, target, use=[]):
ctx(features=features, source=files,target=prefix+target, use=use)
ctx.espreso += [ prefix+target ] + use
ctx.build_checker = build_checker
ctx.build_mesio = build_mesio
ctx.build_espreso = build_espreso
ctx.build_checker(ctx.path.ant_glob('src/esinfo/**/*.cpp'), "esinfo", [ "INFO" ])
ctx.build_checker(ctx.path.ant_glob('src/config/**/*.cpp'), "config")
ctx.build_checker(ctx.path.ant_glob('src/basis/**/*.cpp'), "basis")
ctx.build_checker(ctx.path.ant_glob('src/wrappers/exprtk/**/*.cpp'), "wexprtk")
ctx.build_checker(ctx.path.ant_glob('src/wrappers/backward-cpp/**/*.cpp'), "wbackward", [ "BACKWARD" ])
ctx.build_checker(ctx.path.ant_glob('src/wrappers/mpi/**/*.cpp'), "wmpi")
ctx.build_checker(ctx.path.ant_glob('src/wrappers/papi/**/*.cpp'), "wpapi", [ "PAPI" ])
ctx.build_mesio(ctx.path.ant_glob('src/mesh/**/*.cpp'), "mesh")
ctx.build_mesio(ctx.path.ant_glob('src/input/**/*.cpp'), "input")
ctx.build_mesio(ctx.path.ant_glob('src/output/**/*.cpp'), "output", [ "wpthread" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/pthread/**/*.cpp'), "wpthread", [ "PTHREAD" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/catalyst/**/*.cpp'), "wcatalyst", [ "CATALYST" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/hdf5/**/*.cpp'), "whdf5", [ "HDF5" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/gmsh/**/*.cpp'), "wgmsh", [ "GMSH" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/nglib/**/*.cpp'), "wnglib", [ "NGLIB" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/metis/**/*.cpp'), "wmetis", [ "METIS" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/parmetis/**/*.cpp'), "wparmetis", [ "PARMETIS" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/scotch/**/*.cpp'), "wscotch", [ "SCOTCH" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/ptscotch/**/*.cpp'), "wptscotch", [ "PTSCOTCH" ])
ctx.build_mesio(ctx.path.ant_glob('src/wrappers/kahip/**/*.cpp'), "wkahip", [ "KAHIP" ])
ctx.lib(source="src/api/wrapper.mesio.cpp", target="mesioapi", includes="include", use=ctx.checker + ctx.mesio + ["API"], stlib=ctx.options.stlibs, lib=ctx.options.libs)
ctx.program(source=["src/api/api.mesio.cpp"], target="test.mesio", includes="include", use=ctx.checker + ctx.mesio + ["API", "mesioapi"], stlib=ctx.options.stlibs, lib=ctx.options.libs)
ctx.build_espreso(ctx.path.ant_glob('src/analysis/**/*.cpp'), "analysis")
ctx.build_espreso(ctx.path.ant_glob('src/morphing/**/*.cpp'), "devel")
ctx.build_espreso(ctx.path.ant_glob('src/math/**/*.cpp'), "math", [ "WRAPPERS", "BLAS", "LAPACK", "MKL", "SUITESPARSE" ])
ctx.build_espreso(ctx.path.ant_glob('src/autoopt/**/*.cpp'), "autoopt")
ctx.build_espreso(ctx.path.ant_glob('src/feti/**/*.cpp'), "feti")
ctx.build_espreso(ctx.path.ant_glob('src/gpu/**/*.cpp'), "gpu", [ "WRAPPERS", "CUDA", "ROCM", "ONEAPI" ])
# ctx.build_espreso(ctx.path.ant_glob('src/wrappers/simd/**/*.cpp'), "simd")
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/blas/**/*.cpp'), "wblas", [ "WRAPPERS", "BLAS", "MKL" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/lapack/**/*.cpp'), "wlapack", [ "WRAPPERS", "LAPACK", "MKL" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/mkl/**/*.cpp'), "wmkl", [ "WRAPPERS", "MKL" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/precice/**/*.cpp'), "wprecice", [ "PRECICE" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/precice-dummy/**/*.cpp'), "wprecicedummy", [ "PRECICE" ])
if ctx.env.HAVE_CUDA:
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/cuda/**/*.(cu|cpp)'), "wcuda", [ "WRAPPERS", "CUDA" ])
# ctx.build_espreso(ctx.path.ant_glob('src/wrappers/hypre/**/*.cpp'), "whypre", [ "HYPRE" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/mklpdss/**/*.cpp'), "wmklpdss", [ "WRAPPERS", "MKLPDSS", "MKL" ])
# ctx.build_espreso(ctx.path.ant_glob('src/wrappers/pardiso/**/*.cpp'), "wpardiso", [ "PARDISO" ])
# ctx.build_espreso(ctx.path.ant_glob('src/wrappers/superlu/**/*.cpp'), "wsuperlu", [ "SUPERLU" ])
# ctx.build_espreso(ctx.path.ant_glob('src/wrappers/wsmp/**/*.cpp'), "wwsmp", [ "WSMP" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/suitesparse/**/*.cpp'), "wsuitesparse", [ "WRAPPERS", "SUITESPARSE", "MKL" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/openlb/**/*.cpp'), "wopenlb", [ "OPENLB" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/bem/**/*.cpp'), "wbem",)
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/nvtx/**/*.cpp'), "wnvtx", [ "NVTX" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/oneapi/**/*.cpp'), "woneapi", [ "WRAPPERS", "ONEAPI" ])
ctx.build_espreso(ctx.path.ant_glob('src/wrappers/rocm/**/*.cpp'), "wrocm", [ "WRAPPERS", "ROCM" ])
ctx.program(source="src/app/ecfchecker.cpp", target="ecfchecker", use=ctx.checker, stlib=ctx.options.stlibs, lib=ctx.options.libs)
ctx.program(source="src/app/mesio.cpp", target="mesio", use=ctx.checker + ctx.mesio, stlib=ctx.options.stlibs, lib=ctx.options.libs)
ctx.program(source="src/app/espreso.cpp",target="espreso", rpath=["$ORIGIN/"], use=ctx.checker + ctx.mesio + ctx.espreso, stlib=ctx.options.stlibs, lib=ctx.options.libs)
ctx.program(source="src/app/dummycoupler.cpp",target="dummycoupler", rpath=["$ORIGIN/"], use=ctx.checker + ctx.mesio + ctx.espreso, stlib=ctx.options.stlibs, lib=ctx.options.libs)
# ctx.lib(source="src/api/wrapper.feti4i.cpp", target="feti4i", includes="include", use=ctx.checker + ctx.mesio + ctx.espreso + ["API"], stlib=ctx.options.stlibs, lib=ctx.options.libs)
# ctx.program(source=["src/api/api.feti4i.cpp", "src/api/api.feti4i.dataprovider.cpp"], target="test.feti4i", includes="include", use=ctx.checker + ctx.mesio + ctx.espreso + ["API", "feti4i"], stlib=ctx.options.stlibs, lib=ctx.options.libs)
# ctx.program(source="src/api/example.feti4i.cpp", target="example.feti4i", includes="include", use=ctx.checker + ctx.mesio + ctx.espreso + ["API", "feti4i"], stlib=ctx.options.stlibs, lib=ctx.options.libs)
if ctx.env.with_gui:
ctx.objects(source=ctx.path.ant_glob("**/*.ui"), target="ui")
ctx(
features = "qt5 cxx cxxprogram",
source = ctx.path.ant_glob(["src/gui/**/*.cpp", "src/app/gui.cpp"]),
moc = ctx.path.ant_glob("src/gui/**/*.h"),
use = [ "ui" ] + ctx.checker + ctx.mesio + ctx.espreso,
uselib = "QT5CORE QT5GUI QT5WIDGETS QT5OPENGL",
target = "espresogui"
)
def options(opt):
opt.load("compiler_cxx")
opt.compiler = opt.add_option_group("Compiler options")
opt.wrappers = opt.add_option_group("Selection of implementation")
opt.decomposers = opt.add_option_group("Third party graph partition tools")
opt.math = opt.add_option_group("Third party math libraries")
opt.solvers = opt.add_option_group("Third party sparse solvers")
opt.other = opt.add_option_group("Other third party libraries")
opt.compiler.add_option("--cxx",
action="store",
type="string",
metavar="CXX",
default=os.getenv("CXX") or [ "mpic++" ],
help="Command to be used for compilation.")
opt.compiler.add_option("--cxxflags",
action="store",
type="string",
metavar="CXXFLAGS",
default="",
help="C++ compiler flags (space separated list)")
flavor=["gnu", "intel", "fujitsu"]
opt.compiler.add_option("--flavor",
action="store",
default="gnu",
choices=flavor,
help="C++ compiler flavor: " + ", ".join(flavor) + " [default: %default]")
opt.compiler.add_option("--stlibs",
action="store",
type="string",
default="",
help="Additional static libraries")
opt.compiler.add_option("--libs",
action="store",
type="string",
default=os.getenv("LIBRARIES"),
help="Additional dynamic libraries")
opt.compiler.add_option("--intwidth",
action="store",
default=os.getenv("ES_INT_WIDTH") or "32",
choices=["32", "64"],
metavar="$ES_INT_WIDTH",
help="ESPRESO integer datatype width [default: %default]")
opt.compiler.add_option("--simd-off",
action="store_true",
default=False,
help="Build ESPRESO without SIMD version of assembler.")
modes=["release", "devel", "debug", "profile"]
opt.compiler.add_option("-m", "--mode",
action="store",
default="release",
choices=modes,
help="ESPRESO build mode: " + ", ".join(modes) + " [default: %default]")
opt.compiler.add_option("--static",
action="store_true",
default=False,
help="ESPRESO executable file does not contain dynamic libraries.")
opt.compiler.add_option("--with-gui",
action="store_true",
default=False,
help="Build ESPRESO with GUI (Qt5 is needed).")
opt.wrappers.add_option("--wrapper-dnblas",
action="store",
default=os.getenv("ESPRESO_USE_WRAPPER_DNBLAS") or "auto",
help="Implementation of dense blas: {mkl,blas,auto,empty}")
opt.wrappers.add_option("--wrapper-dnsolver",
action="store",
default=os.getenv("ESPRESO_USE_WRAPPER_DNSOLVER") or "auto",
help="Implementation of dense solver: {mkl,lapack,auto,empty}")
opt.wrappers.add_option("--wrapper-lapack",
action="store",
default=os.getenv("ESPRESO_USE_WRAPPER_LAPACK") or "auto",
help="Implementation of lapack: {mkl,lapack,auto,empty}")
opt.wrappers.add_option("--wrapper-spblas",
action="store",
default=os.getenv("ESPRESO_USE_WRAPPER_SPBLAS") or "auto",
help="Implementation of sparse blas: {mkl,suitesparse,auto,empty}")
opt.wrappers.add_option("--wrapper-spsolver",
action="store",
default=os.getenv("ESPRESO_USE_WRAPPER_SPSOLVER") or "auto",
help="Implementation of sparse solver: {mkl,suitesparse,auto,empty}")
opt.wrappers.add_option("--wrapper-scsolver",
action="store",
default=os.getenv("ESPRESO_USE_WRAPPER_SCSOLVER") or "auto",
help="Implementation of solver for Schur complement of sparse matrices: {mkl,suitesparse,auto,empty}")
opt.wrappers.add_option("--wrapper-gpu",
action="store",
default=os.getenv("ESPRESO_USE_WRAPPER_GPU") or "auto",
help="Implementation of GPU functionality: {cuda,rocm,oneapi,auto,empty}")
opt.other.add_option("--use-cusparse-legacy",
action="store_true",
default=os.getenv("ESPRESO_USE_CUSPARSE_LEGACY"),
help="Use legacy cusparse API. For CUDA < 12 only")
opt.other.add_option("--rank-to-gpu-map",
action="store",
type="string",
default=os.getenv("ESPRESO_RANK_TO_GPU_MAP") or "0",
help="Map from node-local MPI rank to GPU index, if the process can see multiple GPUs")
recurse(opt)
def settings(ctx):
libraries = { x.lstrip("HAVE_").split("=")[0].lower() for x in ctx.env if x.startswith("HAVE_") }
def libsmsg(msg, libs):
libs = [ lib for lib in libs if lib in libraries ]
ctx.start_msg(msg)
ctx.end_msg("[ " + ", ".join(libs) + " ]", color="BLUE")
def wraper_msg(wrapper_name):
prefix = "ESPRESO_USE_WRAPPER_" + wrapper_name.upper() + "_"
defines = [ x for x in ctx.env["DEFINES"] if x.startswith(prefix) ]
if len(defines) == 0:
lib = " "
elif len(defines) == 1:
lib = defines[0].replace(prefix, "").split("=")[0].replace("EMPTY", " ").lower()
else:
raise waflib.Errors.ConfigurationError("Unexpected wrapper use defines: " + ",".join(libs))
ctx.start_msg(wrapper_name.rjust(40))
ctx.end_msg(lib, color="BLUE")
ctx.msg(" CXXFLAGS", ctx.env.CXXFLAGS)
ctx.msg(" LINKFLAGS", ctx.env.LINKFLAGS)
if ctx.env.HAVE_CUDA:
ctx.msg(" NVCC", ctx.env.NVCC)
ctx.msg(" NVCCFLAGS", ctx.env.NVCCFLAGS)
ctx.msg(" int width", ctx.env.intwidth)
ctx.msg(" mode", ctx.env.mode)
ctx.msg(" SIMD", ctx.env.SIMD)
ctx.msg(" ASSEMBLER", ctx.env.SIMD_ASSEMBLER)
ctx.msg(" DETECTED LIBRARIES -------------------", "--------------------------", color="NORMAL")
# libsmsg(" mesh generators", [ "gmsh", "nglib" ])
libsmsg(" graph partitioners", [ "metis", "scotch", "kahip"])
libsmsg(" distributed graph partitioners", [ "parmetis", "ptscotch" ])
libsmsg(" BLAS libraries", [ "mkl", "blas" ])
libsmsg(" SpBLAS libraries", [ "mkl", "suitesparse" ])
libsmsg(" LAPACK libraries", [ "mkl", "lapack" ])
libsmsg(" sparse solvers", [ "mkl", "suitesparse" ])
libsmsg(" distributed sparse solvers", [ "mklpdss", "hypre", "superlu", "wsmp" ])
libsmsg(" GPU libraries", [ "cuda", "rocm", "oneapi" ])
libsmsg(" coupling", [ "precice" ])
ctx.msg(" USED WRAPPERS ------------------------", "--------------------------", color="NORMAL")
wraper_msg("dnblas")
wraper_msg("dnsolver")
wraper_msg("lapack")
wraper_msg("spblas")
wraper_msg("spsolver")
wraper_msg("scsolver")
wraper_msg("gpu")
""" Recurse to third party libraries wrappers"""
def recurse(ctx):
""" Accelerators """
ctx.recurse("src/wrappers/rocm")
ctx.recurse("src/wrappers/cuda")
ctx.recurse("src/wrappers/oneapi")
""" Graph partition tools """
ctx.recurse("src/wrappers/metis")
ctx.recurse("src/wrappers/parmetis")
ctx.recurse("src/wrappers/scotch")
ctx.recurse("src/wrappers/ptscotch")
ctx.recurse("src/wrappers/kahip")
""" Math libraries"""
ctx.recurse("src/wrappers/blas")
ctx.recurse("src/wrappers/lapack")
ctx.recurse("src/wrappers/pardiso")
ctx.recurse("src/wrappers/mkl")
ctx.recurse("src/wrappers/suitesparse")
""" Solvers """
ctx.recurse("src/wrappers/mklpdss")
# ctx.recurse("src/wrappers/hypre")
# ctx.recurse("src/wrappers/superlu")
# ctx.recurse("src/wrappers/wsmp")
ctx.recurse("src/wrappers/openlb")
""" Other """
ctx.recurse("src/wrappers/simd")
ctx.recurse("src/wrappers/exprtk")
ctx.recurse("src/wrappers/backward-cpp")
ctx.recurse("src/wrappers/pthread")
ctx.recurse("src/wrappers/hdf5")
# ctx.recurse("src/wrappers/gmsh")
# ctx.recurse("src/wrappers/nglib")
# ctx.recurse("src/wrappers/bem")
# ctx.recurse("src/wrappers/catalyst")
# ctx.recurse("src/wrappers/nvtx")
ctx.recurse("src/wrappers/papi")
ctx.recurse("src/wrappers/precice")
def get_commit():
def is_git_directory(path = '.'):
return subprocess.call(['git', '-C', path, 'status'], stderr=subprocess.STDOUT, stdout = open(os.devnull, 'w')) == 0
if is_git_directory():
commit = subprocess.check_output(["git", "rev-parse", "HEAD"]).rstrip().decode()
changed = subprocess.call(['git', 'diff', "--quiet", 'HEAD'], stderr=subprocess.STDOUT, stdout = open(os.devnull, 'w')) == 1
if changed:
return commit + "+"
else:
return commit
else:
return "unknown"
from waflib import Logs
from waflib.Build import BuildContext
class ShowConfiguration(BuildContext):
cmd = "show"
fun = "show"
class ShowEnv(BuildContext):
cmd = "env"
fun = "env"
def show(ctx):
ctx.logger = logging.getLogger('show')
ctx.logger.handlers = Logs.log_handler()
settings(ctx)
def env(ctx):
print(ctx.env)
from waflib.TaskGen import after_method, feature
@feature('cxx')
@after_method('apply_link')
def reorder_libs(ctx):
def myorder(lib):
if lib == "parmetis":
return 1
if lib == "metis":
return 2
if lib == "pardiso":
return 3
if lib.startswith("mkl"):
return 4
return 0
ctx.env["LIB"].sort(key=myorder)
from waflib.TaskGen import feature, before_method, after_method
@feature('qt5')
@after_method('process_source')
@before_method('apply_incpaths')
def add_includes_paths(self):
incs = set(self.to_list(getattr(self, 'includes', '')))
for x in self.compiled_tasks:
incs.add(x.inputs[0].parent.path_from(self.path))
self.includes = sorted(incs)
from waflib import TaskGen,Task
from waflib.Tools import c_preproc
class cuda(Task.Task):
run_str = '${NVCC} ${NVCCFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F} ${TGT}'
color = 'GREEN'
ext_in = ['.h']
vars = ['CCDEPS']
scan = c_preproc.scan
shell = False
@TaskGen.extension(".cu", ".cuda")
def cxx_hook(self, node):
return self.create_compiled_task("cuda", node)
def detect_intel_oneapi_compiler(ctx):
ec = os.system("which " + ctx.env.CXX[0] + " > /dev/null 2>/dev/null")
if ec != 0: return
ec = os.system(ctx.env.CXX[0] + " --version 2>/dev/null | grep -q \"oneAPI DPC++/C++ Compiler\"")
if ec != 0: return
ctx.env.COMPILER_CXX = "icpx"
def detect_nvcpp_compiler(ctx):
ec = os.system(ctx.env.CXX[0] + " --version | grep -q nvc++")
if ec != 0: return
ctx.env.COMPILER_CXX = "nvc++"