-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConstruct
More file actions
1045 lines (895 loc) · 49.3 KB
/
SConstruct
File metadata and controls
1045 lines (895 loc) · 49.3 KB
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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
import os, sys
import re
from datetime import datetime
######################################################################
#
# general (default) settings
#
######################################################################
BUILD_TYPES = [ 'debug', 'dbg', 'release', 'rel', 'release-debug', 'reldbg' ]
fullmsg = False
buildtype = 'debug'
warn = False
color = True
# cache file storing SCons settings
opts_file = '.scons.options'
CXX = 'g++'
CXXFLAGS = '-std=c++23'
CPUFLAGS = 'cpuflags'
ARCHFLAGS = '-march=native'
DBGFLAGS = '-g -frounding-math'
RELDBGFLAGS = '-g -O2'
RELFLAGS = '-O3 -fomit-frame-pointer -ffast-math -funroll-loops'
OPTFLAGS = RELFLAGS
WARNFLAGS = '' # '-Wall'
LINKFLAGS = '-g'
DEFINES = 'TBB_PREVIEW_GLOBAL_CONTROL __TBB_show_deprecation_message_task_H'
# directories for the various external libraries
HPRO_DIR = '/'
MKL_DIR = '/'
TBB_DIR = '/'
TASKFLOW_DIR = '/'
HPX_DIR = '/'
GPI2_DIR = '/'
CUDA_DIR = '/'
eigen = 0
EIGEN_DIR = '/'
hdf5 = 0
hdf5_dir = '/'
# general allocators
JEMALLOC_DIR = '/'
MIMALLOC_DIR = '/'
TCMALLOC_DIR = '/'
# tracing
likwid = False
LIKWID_DIR = '/'
scorep = False
SCOREP_DIR = '/'
# compressors
zfp = False
ZFP_DIR = '/'
sz = False
SZ_DIR = '/'
sz3 = False
SZ3_DIR = '/'
mgard = False
MGARD_DIR = '/'
universal = False
UNIVERSAL_DIR = '/'
blosc = False
BLOSC_DIR = '/'
zblas = True
# default values for programs and frameworks
programs = ''
frameworks = 'seq,tbb'
# set of frameworks to use: seq, openmp, tbb, tf, hpx, mpi, gpi2 (or 'all')
FRAMEWORKS = [ 'help', # print help
'seq',
'omp',
'tbb',
'tf',
'hpx',
'mpi',
'gpi2',
'cuda' ]
FRAMEWORK_HELP = { 'seq' : 'uses sequential execution',
'omp' : 'uses OpenMP',
'tbb' : 'uses Threading Building Blocks (see also {0}tbb_dir{1})',
'tf' : 'uses C++-Taskflow (see also {0}tf_dir{1})',
'hpx' : 'uses HPX (see also {0}hpx_dir{1})',
'mpi' : 'uses MPI; can be combined with other framework',
'gpi2' : 'uses GPI-2/GASPI (see also {0}gpi2_dir{1})',
'cuda' : 'uses CUDA (addon framework)' }
# supported lapack libraries
LAPACKLIBS = [ 'help', # print help
'default', # default system implementation, e.g., -llapack -lblas
'none', # do not use any LAPACK library
'user', # use user defined LAPACK library (see "--lapack-flags")
'mkl', # use parallel Intel MKL (should be OpenMP version)
'mklomp', # use OpenMP based Intel MKL
'mkltbb', # use TBB based Intel MKL
'mklseq', # use sequential Intel MKL
'mklomp64', # use OpenMP based Intel MKL (ILP64)
'mkltbb64', # use TBB based Intel MKL (ILP64)
'mklseq64', # use sequential Intel MKL (ILP64)
'accelerate' ] # Accelerate framework on MacOS
LAPACKLIBS_HELP = { 'default' : 'system default, e.g. {0}-llapack -lblas{1} (Linux) or {0}accelerate{1} (MacOS)',
'none' : 'do not use BLAS/LAPACK',
'user' : 'user defined BLAS/LAPACK (needs {0}lapackflags{1})',
'mkl' : 'use MKL using 32 bit integer (default version (see also {0}mkl_dir{1})',
'mklomp' : 'use MKL based on OpenMP using 32 bit integer',
'mkltbb' : 'use MKL based on TBB using 32 bit integer',
'mklseq' : 'use sequential MKL using 32 bit integer ({0}recommended{1})',
'mklomp64' : 'use MKL based on OpenMP using 64bit integer (ILP64)',
'mkltbb64' : 'use MKL based on TBB using 64bit integer (ILP64)',
'mklseq64' : 'use sequential MKL using 64bit integer (ILP64) ({0}recommended{1})',
'accelerate' : 'use Accelerate framework ({0}only MacOS{1})' }
# user defined linking flags for LAPACK
LAPACK_FLAGS = '-llapack -lblas'
# malloc libraries (also depends on directories above)
MALLOCS = [ 'help', # print help
'default',
'system',
'jemalloc',
'mimalloc',
'tbbmalloc',
'tcmalloc' ]
MALLOCS_HELP = { 'default' : 'default malloc, i.e., no overwrite',
'system' : 'same as {0}default{1}',
'jemalloc' : 'use jemalloc (see also {0}jemalloc_dir{1})',
'mimalloc' : 'use mimalloc (see also {0}mimalloc_dir{1})',
'tbbmalloc' : 'use tbbmalloc',
'tcmalloc' : 'use tcmalloc (see also {0}tcmalloc_dir{1})' }
# supported and active compressor
COMPRESSORS = [ 'help', # print help
'none', # numeric ID:
'fp32', # 1
'afl', # 2
'aflp', # 3
'fpx', # 4
'zfp', # 5
'sz', # 6
'sz3', # 7
'mgard', # 8
'blosc', # 9
'posits', # 10
'cfloat', # 11
'bfp', # 12
]
compressor = 'none'
COMPRESSORS_HELP = { 'none' : 'no compression used',
'fp32' : 'use FP32 for storage',
'afl' : 'use AFL',
'aflp' : 'use AFLP',
'fpx' : 'use extended float',
'zfp' : 'use ZFP (see also {0}zfp_dir{1})',
'posits' : 'use Posits (see also {0}universal_dir{1})',
'cfloat' : 'use CFloats (see also {0}universal_dir{1})',
'sz' : 'use SZ (see also {0}sz_dir{1})',
'sz3' : 'use SZ3 (see also {0}sz3_dir{1})',
'mgard' : 'use MGARD (see also {0}mgard_dir{1})',
'blosc' : 'use Blosc (see also {0}blosc_dir{1})',
'bfp' : 'use block floating point',
}
######################################################################
#
# helper functions
#
######################################################################
#
# return first line of output of given program
#
def readln ( prog ):
text = ''
try :
file = os.popen( prog, 'r' )
text = file.readline()
file.close()
except :
pass
return text
#
# compose actual path of program source
#
def path ( program, source ) :
if SUBDIRS[ program ] != '' :
return os.path.join( 'programs', SUBDIRS[ program ], source );
else :
return os.path.join( 'programs', source );
######################################################################
#
# preinitialization with known defaults
#
######################################################################
# # MKL should define MKLROOT
# if MKL_DIR == None and 'MKLROOT' in os.environ :
# MKL_DIR = os.environ['MKLROOT']
# else :
# MKL_DIR = '/' # to prevent error below due to invalid path
######################################################################
#
# collect all programs from "programs" sub directory
#
######################################################################
def scan_programs () :
cc_file = re.compile( r'.*\.(cc|CC|cpp|c\+\+)\Z' )
scanned_programs = []
scanned_subdirs = {}
for root, dirs, files in os.walk( "programs", topdown = False ) :
for filename in files :
if cc_file.search( filename ) != None :
# look for any framework
for fwork in FRAMEWORKS :
fstr = '-' + fwork
pos = filename.find( fstr )
if pos != -1 :
prog = filename[:pos]
if not prog in scanned_programs :
scanned_programs.append( prog )
if root == 'programs' : scanned_subdirs[prog] = ''
else : scanned_subdirs[prog] = root.replace( 'programs/', '' )
# print( root, filename[:pos], fwork )
return scanned_programs, scanned_subdirs
tic = datetime.now()
PROGRAMS, SUBDIRS = scan_programs()
toc = datetime.now()
# print( "scanned programs in %.3es" % ( toc - tic ).total_seconds() )
######################################################################
#
# colorization
#
######################################################################
# default color codes
colors = { 'reset' : '\033[0m',
'bold' : '\033[1m',
'italic' : '\033[3m',
'red' : '\033[31m',
'green' : '\033[32m',
'yellow' : '\033[33m',
'blue' : '\033[34m',
'purple' : '\033[35m',
'cyan' : '\033[36m',
'gray' : '\033[37m' }
# no colors if wanted or output is not a terminal ('dumb' is for emacs)
if not color or not sys.stdout.isatty() or os.environ['TERM'] == 'dumb' :
for key in colors.keys() :
colors[key] = ''
else :
# try to handle above codes on non-supported systems
try:
import colorama
colorama.init()
except :
pass
######################################################################
#
# eval options
#
######################################################################
# set up command line parameters
opts = Variables( opts_file )
opts.Add( ListVariable( 'programs', 'programs to build', programs, PROGRAMS ) )
opts.Add( ListVariable( 'addprograms', 'add programs to build', '', PROGRAMS ) )
opts.Add( ListVariable( 'remprograms', 'remove programs to build', '', PROGRAMS ) )
opts.Add( ListVariable( 'frameworks', 'parallelization frameworks to use', frameworks, FRAMEWORKS ) )
opts.Add( ListVariable( 'addframeworks', 'add parallelization frameworks', '', FRAMEWORKS ) )
opts.Add( ListVariable( 'remframeworks', 'remove parallelization frameworks', '', FRAMEWORKS ) )
opts.Add( 'cxx', 'C++ compiler to use', CXX )
opts.Add( 'cxxflags', 'C++ compiler flags', CXXFLAGS )
opts.Add( 'optflags', 'compiler optimization flags', OPTFLAGS )
opts.Add( 'cpuflags', 'path to cpuflags', CPUFLAGS )
opts.Add( 'defines', 'preprocessor defines', DEFINES )
opts.Add( PathVariable( 'hpro_dir', 'base directory of hlibpro', HPRO_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'tbb_dir', 'base directory of TBB', TBB_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'tf_dir', 'base directory of C++TaskFlow', TASKFLOW_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'hpx_dir', 'base directory of HPX', HPX_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'gpi2_dir', 'base directory of GPI2', GPI2_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'mkl_dir', 'base directory of MKL', MKL_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'cuda_dir', 'base directory of CUDA', CUDA_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'jemalloc_dir', 'base directory of jemalloc', JEMALLOC_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'mimalloc_dir', 'base directory of mimalloc', MIMALLOC_DIR, PathVariable.PathIsDir ) )
opts.Add( PathVariable( 'tcmalloc_dir', 'base directory of tcmalloc', TCMALLOC_DIR, PathVariable.PathIsDir ) )
opts.Add( EnumVariable( 'lapack', 'lapack library to use', 'default', allowed_values = LAPACKLIBS , ignorecase = 2 ) )
opts.Add( 'lapackflags', 'user defined link flags for lapack', default = LAPACK_FLAGS )
opts.Add( EnumVariable( 'malloc', 'malloc library to use', 'default', allowed_values = MALLOCS, ignorecase = 2 ) )
opts.Add( BoolVariable( 'eigen', 'use Eigen library', eigen ) )
opts.Add( PathVariable( 'eigen_dir', 'Eigen installation directory', EIGEN_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'hdf5', 'use HDF5 library', hdf5 ) )
opts.Add( PathVariable( 'hdf5_dir', 'HDF5 installation directory', hdf5_dir, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'likwid', 'use likwid library', likwid ) )
opts.Add( PathVariable( 'likwid_dir', 'likwid installation directory', LIKWID_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'scorep', 'use Score-P library', scorep ) )
opts.Add( PathVariable( 'scorep_dir', 'Score-P installation directory', SCOREP_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'zfp', 'use ZFP compression library', zfp ) )
opts.Add( PathVariable( 'zfp_dir', 'ZFP installation directory', ZFP_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'sz', 'use SZ compression library', sz ) )
opts.Add( PathVariable( 'sz_dir', 'SZ installation directory', SZ_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'sz3', 'use SZ3 compression library', sz3 ) )
opts.Add( PathVariable( 'sz3_dir', 'SZ3 installation directory', SZ3_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'mgard', 'use MGARD compression library', mgard ) )
opts.Add( PathVariable( 'mgard_dir', 'MGARD installation directory', MGARD_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'universal', 'use universal number library', universal ) )
opts.Add( PathVariable( 'universal_dir', 'universal installation directory', UNIVERSAL_DIR, PathVariable.PathIsDir ) )
opts.Add( BoolVariable( 'blosc', 'use blosc compression library', blosc ) )
opts.Add( PathVariable( 'blosc_dir', 'blosc installation directory', BLOSC_DIR, PathVariable.PathIsDir ) )
opts.Add( EnumVariable( 'compressor', 'defined compressor', 'none', allowed_values = COMPRESSORS, ignorecase = 2 ) )
opts.Add( BoolVariable( 'zblas', 'activate/deactivate compressed BLAS', zblas ) )
opts.Add( BoolVariable( 'fullmsg', 'enable full command line output', fullmsg ) )
opts.Add( EnumVariable( 'buildtype', 'how to build the binaries (debug/release)', buildtype, allowed_values = BUILD_TYPES, ignorecase = 2 ) )
opts.Add( BoolVariable( 'warn', 'enable building with compiler warnings', warn ) )
opts.Add( BoolVariable( 'color', 'use colored output during compilation', color ) )
# read options from options file
opt_env = Environment( options = opts )
# apply modifiers
for opt in Split( opt_env['addprograms'] ) :
if opt not in opt_env['programs'] :
opt_env['programs'].append( opt )
for opt in Split( opt_env['remprograms'] ) :
if opt in opt_env['programs'] :
opt_env['programs'].remove( opt )
for opt in Split( opt_env['addframeworks'] ) :
if opt not in opt_env['frameworks'] :
opt_env['frameworks'].append( opt )
for opt in Split( opt_env['remframeworks'] ) :
if opt in opt_env['frameworks'] :
opt_env['frameworks'].remove( opt )
programs = Split( opt_env['programs'] )
frameworks = Split( opt_env['frameworks'] )
if 'all' in programs : programs = PROGRAMS
if 'all' in frameworks : frameworks = FRAMEWORKS
CXX = opt_env['cxx']
CXXFLAGS = opt_env['cxxflags']
OPTFLAGS = opt_env['optflags']
CPUFLAGS = opt_env['cpuflags']
DEFINES = opt_env['defines']
HPRO_DIR = opt_env['hpro_dir']
TBB_DIR = opt_env['tbb_dir']
TASKFLOW_DIR = opt_env['tf_dir']
HPX_DIR = opt_env['hpx_dir']
GPI2_DIR = opt_env['gpi2_dir']
MKL_DIR = opt_env['mkl_dir']
CUDA_DIR = opt_env['cuda_dir']
JEMALLOC_DIR = opt_env['jemalloc_dir']
MIMALLOC_DIR = opt_env['mimalloc_dir']
TCMALLOC_DIR = opt_env['tcmalloc_dir']
malloc = opt_env['malloc']
lapack = opt_env['lapack']
LAPACK_FLAGS = opt_env['lapackflags']
eigen = opt_env['eigen']
EIGEN_DIR = opt_env['eigen_dir']
hdf5 = opt_env['hdf5']
HDF5_DIR = opt_env['hdf5_dir']
likwid = opt_env['likwid']
LIKWID_DIR = opt_env['likwid_dir']
scorep = opt_env['scorep']
SCOREP_DIR = opt_env['scorep_dir']
zfp = opt_env['zfp']
ZFP_DIR = opt_env['zfp_dir']
sz = opt_env['sz']
SZ_DIR = opt_env['sz_dir']
sz3 = opt_env['sz3']
SZ3_DIR = opt_env['sz3_dir']
mgard = opt_env['mgard']
MGARD_DIR = opt_env['mgard_dir']
universal = opt_env['universal']
UNIVERSAL_DIR = opt_env['universal_dir']
blosc = opt_env['blosc']
BLOSC_DIR = opt_env['blosc_dir']
compressor = opt_env['compressor']
# valr = opt_env['valr']
zblas = opt_env['zblas']
buildtype = opt_env['buildtype']
fullmsg = opt_env['fullmsg']
warn = opt_env['warn']
color = opt_env['color']
# remove entries to prevent saving
del opt_env['addprograms']
del opt_env['remprograms']
del opt_env['addframeworks']
del opt_env['remframeworks']
# handle 'help' requests to avoid saving
if 'help' in frameworks :
print( "supported {0}framework{1} options: ".format( colors['bold'], colors['reset'] ) )
for opt in FRAMEWORKS :
if opt != 'help' :
print( ' {0}{1:<11s}{2} : '.format( colors['bold'], opt, colors['reset'] ) + FRAMEWORK_HELP[opt].format( colors['italic'], colors['reset'] ) )
sys.exit( 1 )
if lapack == 'help' :
print( "supported {0}lapack{1} options: ".format( colors['bold'], colors['reset'] ) )
for opt in LAPACKLIBS :
if opt != 'help' :
print( ' {0}{1:<11s}{2} : '.format( colors['bold'], opt, colors['reset'] ) + LAPACKLIBS_HELP[opt].format( colors['italic'], colors['reset'] ) )
sys.exit( 1 )
if malloc == 'help' :
print( 'supported {0}malloc{1} options: '.format( colors['bold'], colors['reset'] ) )
for opt in MALLOCS :
if opt != 'help' :
print( ' {0}{1:<11s}{2} : '.format( colors['bold'], opt, colors['reset'] ) + MALLOCS_HELP[opt].format( colors['italic'], colors['reset'] ) )
sys.exit( 1 )
if compressor == 'help' :
print( 'supported {0}compressor{1} options: '.format( colors['bold'], colors['reset'] ) )
for opt in COMPRESSORS :
if opt != 'help' :
print( ' {0}{1:<11s}{2} : '.format( colors['bold'], opt, colors['reset'] ) + COMPRESSORS_HELP[opt].format( colors['italic'], colors['reset'] ) )
sys.exit( 1 )
opts.Save( opts_file, opt_env )
######################################################################
#
# apply known defaults in case no user provided value is set
#
######################################################################
# MKL should define MKLROOT
if MKL_DIR == None or MKL_DIR == '/' :
if 'MKLROOT' in os.environ :
MKL_DIR = os.environ['MKLROOT']
else :
MKL_DIR = '/' # to prevent error below due to invalid path
# CUDA should define CUDA_ROOT or CUDA_HOME
if CUDA_DIR == None or CUDA_DIR == '/' :
if 'CUDA_ROOT' in os.environ :
CUDA_DIR = os.environ['CUDA_ROOT']
elif 'CUDA_HOME' in os.environ :
CUDA_DIR = os.environ['CUDA_HOME']
else :
CUDA_DIR = '/' # to prevent error below due to invalid path
######################################################################
#
# set up compilation environment
#
######################################################################
if buildtype in [ 'debug', 'dbg' ] :
OPTFLAGS = DBGFLAGS
LINKFLAGS = '-g'
DEFINES = ''
elif buildtype in [ 'release-debug', 'reldbg' ] :
OPTFLAGS = RELDBGFLAGS
LINKFLAGS = '-g'
DEFINES = ''
elif buildtype in [ 'release', 'rel' ] :
OPTFLAGS = RELFLAGS
DEFINES = DEFINES + ' NDEBUG'
LINKFLAGS = ''
if warn :
WARNFLAGS = readln( '%s --comp %s --warn' % ( CPUFLAGS, CXX ) )
# Thread Sanitizer
# CXXFLAGS = CXXFLAGS + ' -fsanitize=thread'
# LINKFLAGS = LINKFLAGS + ' -fsanitize=thread'
env = Environment( options = opts, # TODO: <- check without
ENV = os.environ,
CXX = CXX,
CXXFLAGS = Split( CXXFLAGS + ' ' + ARCHFLAGS + ' ' + OPTFLAGS + ' ' + WARNFLAGS ),
LINKFLAGS = Split( LINKFLAGS ),
CPPDEFINES = Split( DEFINES ) )
# include HLIBpro library
env.ParseConfig( os.path.join( HPRO_DIR, 'bin', 'hpro-config' ) + ' --cflags --lflags' )
# decative full compiler/linker output
if not fullmsg :
env.Replace( CCCOMSTR = ' %sCC%s $SOURCES' % ( colors['green'] + colors['bold'], colors['reset'] ) )
env.Replace( CXXCOMSTR = ' %sC++%s $SOURCES' % ( colors['green'] + colors['bold'], colors['reset'] ) )
env.Replace( LINKCOMSTR = ' %sLink%s %s$TARGET%s' % ( colors['cyan'] + colors['bold'], colors['reset'], colors['bold'], colors['reset'] ) )
env.Replace( ARCOMSTR = ' %sAR%s %s$TARGET%s' % ( colors['yellow'] + colors['bold'], colors['reset'], colors['bold'], colors['reset'] ) )
env.Replace( RANLIBCOMSTR = ' %sIndex%s %s$TARGET%s' % ( colors['yellow'] + colors['bold'], colors['reset'], colors['bold'], colors['reset'] ) )
# add internal paths and libraries
env.Append( CPPPATH = [ '#include' ] )
env.Append( CPPPATH = [ '#programs/common' ] )
env.Prepend( LIBS = [ 'hlr' ] )
env.Prepend( LIBPATH = [ '.' ] )
# add LAPACK library
if lapack == 'default' :
env.Append( LIBS = [ 'lapack', 'blas' ] )
elif lapack == 'user' :
flags = env.ParseFlags( LAPACK_FLAGS )
env.MergeFlags( flags )
elif lapack in [ 'mkl', 'mkl64', 'mklomp', 'mklomp64' ] :
env.Append( CPPPATH = os.path.join( MKL_DIR, 'include' ) )
env.Append( CPPPATH = os.path.join( MKL_DIR, 'include', 'mkl' ) )
env.Append( LIBPATH = os.path.join( MKL_DIR, 'lib', 'intel64_lin' ) ) # standard MKL
env.Append( LIBPATH = os.path.join( MKL_DIR, 'lib', 'intel64' ) ) # oneMKL
if lapack in [ 'mkl', 'mklomp' ] :
env.Append( LIBS = [ 'mkl_gf_lp64' , 'mkl_gnu_thread', 'mkl_core', 'gomp' ] )
else :
env.Append( LIBS = [ 'mkl_gf_ilp64' , 'mkl_gnu_thread', 'mkl_core', 'gomp' ] )
elif lapack in [ 'mkltbb', 'mkltbb64' ] :
env.Append( CPPPATH = os.path.join( MKL_DIR, 'include' ) )
env.Append( CPPPATH = os.path.join( MKL_DIR, 'include', 'mkl' ) )
env.Append( LIBPATH = os.path.join( MKL_DIR, 'lib', 'intel64_lin' ) ) # standard MKL
env.Append( LIBPATH = os.path.join( MKL_DIR, 'lib', 'intel64' ) ) # oneMKL
if lapack in [ 'mkl', 'mklomp' ] :
env.Append( LIBS = [ 'mkl_gf_lp64' , 'mkl_tbb_thread', 'mkl_core', 'gomp' ] )
else :
env.Append( LIBS = [ 'mkl_gf_ilp64' , 'mkl_tbb_thread', 'mkl_core', 'gomp' ] )
elif lapack in [ 'mklseq', 'mklseq64' ] :
env.Append( CPPPATH = os.path.join( MKL_DIR, 'include' ) )
env.Append( CPPPATH = os.path.join( MKL_DIR, 'include', 'mkl' ) )
env.Append( LIBPATH = os.path.join( MKL_DIR, 'lib', 'intel64_lin' ) ) # standard MKL
env.Append( LIBPATH = os.path.join( MKL_DIR, 'lib', 'intel64' ) ) # oneMKL
if lapack in [ 'mkl', 'mklomp' ] :
env.Append( LIBS = [ 'mkl_gf_lp64' , 'mkl_sequential', 'mkl_core' ] )
else :
env.Append( LIBS = [ 'mkl_gf_ilp64' , 'mkl_sequential', 'mkl_core' ] )
elif lapack == 'accelerate' :
env.MergeFlags( '-Wl,-framework,Accelerate' )
# include malloc library
if JEMALLOC_DIR != None and malloc == 'jemalloc' :
env.MergeFlags( os.path.join( JEMALLOC_DIR, 'lib', 'libjemalloc.a' ) )
env.Append( LIBS = [ 'dl', 'pthread' ] )
elif MIMALLOC_DIR != None and malloc == 'mimalloc' :
env.MergeFlags( os.path.join( MIMALLOC_DIR, 'lib', 'libmimalloc.a' ) )
elif malloc == 'tbbmalloc' :
env.Append( LIBPATH = os.path.join( TBB_DIR, 'lib' ) )
env.Append( LIBS = 'tbbmalloc' )
elif malloc == 'tcmalloc' :
env.Append( LIBPATH = os.path.join( TCMALLOC_DIR, 'lib' ) )
env.Append( LIBS = 'tcmalloc' )
# include Eigen
if eigen and EIGEN_DIR != None :
env.Append( CPPDEFINES = 'HLR_USE_EIGEN' )
env.Append( CPPPATH = os.path.join( EIGEN_DIR, 'include/eigen3' ) )
# include HDF5
if hdf5 and HDF5_DIR != None :
env.Append( CPPDEFINES = 'HLR_USE_HDF5' )
env.ParseConfig( 'PKG_CONFIG_PATH=%s pkg-config --cflags hdf5-serial' % os.path.join( HDF5_DIR, 'lib', 'pkgconfig' ) )
env.ParseConfig( 'PKG_CONFIG_PATH=%s pkg-config --libs hdf5-serial' % os.path.join( HDF5_DIR, 'lib', 'pkgconfig' ) )
env.Append( LIBS = 'hdf5_cpp' )
# include likwid performance monitoring library
if likwid and LIKWID_DIR != None :
env.Append( CPPDEFINES = 'HLR_USE_LIKWID' )
env.Append( CPPPATH = os.path.join( LIKWID_DIR, 'include' ) )
env.Append( LIBPATH = os.path.join( LIKWID_DIR, 'lib' ) )
env.Append( LIBS = 'likwid' )
# include Score-P tracing library
if scorep and SCOREP_DIR != None :
env.Replace( CXX = os.path.join( SCOREP_DIR, 'bin', 'scorep' ) + ' --user --thread=pthread --mpp=none ' + CXX )
env.Append( LIBPATH = os.path.join( SCOREP_DIR, 'lib' ) )
env.Append( CPPDEFINES = 'HLR_USE_SCOREP' )
# add CUDA
if 'cuda' in frameworks :
env.Append( CPPPATH = os.path.join( CUDA_DIR, 'include' ) )
env.Append( LIBPATH = os.path.join( CUDA_DIR, 'lib64' ) )
env.Append( LIBS = [ 'cudart', 'cublasLt', 'cublas', 'cusolver' ] )
if zfp :
env.Append( CPPDEFINES = 'HLR_HAS_ZFP' )
env.Append( CPPPATH = os.path.join( ZFP_DIR, 'include' ) )
env.Append( LIBPATH = os.path.join( ZFP_DIR, 'lib' ) )
env.Append( LIBS = [ 'zfp', 'gomp' ] ) # in case ZFP comes with OpenMP support
if compressor == 'none' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=0' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=0' )
elif compressor == 'fp32' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=1' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=1' )
elif compressor == 'afl' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=2' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=2' )
elif compressor == 'aflp' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=3' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=3' )
elif compressor == 'fpx' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=4' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=4' )
elif compressor == 'zfp' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=5' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=5' )
elif compressor == 'sz' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=6' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=6' )
env.Append( CPPDEFINES = 'HLR_HAS_SZ' )
env.Append( CPPPATH = os.path.join( SZ_DIR, 'include' ) )
env.Append( LIBPATH = os.path.join( SZ_DIR, 'lib' ) )
env.Append( LIBS = [ 'SZ' ] )
elif compressor == 'sz3' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=7' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=7' )
env.Append( CPPDEFINES = 'HLR_HAS_SZ3' )
env.Append( CPPPATH = os.path.join( SZ3_DIR, 'include' ) )
env.Append( LIBPATH = os.path.join( SZ3_DIR, 'lib' ) )
env.Append( LIBS = [ 'zstd' ] )
elif compressor == 'mgard' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=8' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=8' )
env.Append( CPPDEFINES = 'HLR_HAS_MGARD' )
env.Append( CPPPATH = os.path.join( MGARD_DIR, 'include' ) )
env.Append( LIBPATH = os.path.join( MGARD_DIR, 'lib' ) )
env.Append( LIBS = [ 'mgard' ] )
elif compressor == 'blosc' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=9' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=9' )
env.Append( CPPDEFINES = 'HLR_HAS_BLOSC' )
env.Append( CPPPATH = os.path.join( BLOSC_DIR, 'include' ) )
env.Append( LIBPATH = os.path.join( BLOSC_DIR, 'lib' ) )
env.Append( LIBS = [ 'blosc2' ] )
elif compressor == 'posits' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=10' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=10' )
env.Append( CPPDEFINES = 'HLR_HAS_UNIVERSAL' )
env.Append( CPPPATH = os.path.join( UNIVERSAL_DIR, 'include' ) )
elif compressor == 'cfloat' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=11' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=11' )
env.Append( CPPDEFINES = 'HLR_HAS_UNIVERSAL' )
env.Append( CPPPATH = os.path.join( UNIVERSAL_DIR, 'include' ) )
elif compressor == 'bfp' :
env.Append( CPPDEFINES = 'HLR_COMPRESSOR=12' )
env.Append( CPPDEFINES = 'HLR_VALR_COMPRESSOR=12' )
if zblas :
env.Append( CPPDEFINES = 'HLR_USE_ZBLAS=1' )
else :
env.Append( CPPDEFINES = 'HLR_USE_ZBLAS=0' )
######################################################################
#
# target 'help'
#
######################################################################
#
# split array of strings for pretty printing in table
#
def split_str_array ( arr, n ) :
parts = []
line = ''
for i in range( len( arr ) ) :
if i == len(arr)-1 : line = line + arr[i]
else : line = line + arr[i] + ', '
if len( line ) > 40 :
parts.append( line )
line = ''
if line != '' :
parts.append( line )
return parts
#
# helper for printing paths
#
def pathstr ( path ) :
if path != '' : return '(' + path + ')'
else : return ''
#
# show output of "scons help"
#
def show_help ( target, source, env ):
bool_str = { False : colors['bold'] + colors['red'] + '✘' + colors['reset'],
True : colors['bold'] + colors['green'] + '✔' + colors['reset'] }
print()
print( 'Type \'scons <option>=<value> ...\' where <option> is one of' )
print()
print( ' {0}Option{1} │ {0}Description{1} │ {0}Values{1}'.format( colors['bold'], colors['reset'] ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
parts = split_str_array( PROGRAMS, 40 )
print( ' {0}programs{1} │ programs to build │'.format( colors['bold'], colors['reset'] ), parts[0] )
for i in range( 1, len(parts) ) :
print( ' │ │', parts[i] )
print( ' {0}frameworks{1} │ software frameworks to use │'.format( colors['bold'], colors['reset'] ), ', '.join( FRAMEWORKS ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}hpro_dir{1} │ base directory of HLIBpro │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}tbb_dir{1} │ base directory of TBB │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}tf_dir{1} │ base directory of C++TaskFlow │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}hpx_dir{1} │ base directory of HPX │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}gpi2_dir{1} │ base directory of GPI2 │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}cuda_dir{1} │ base directory of CUDA │'.format( colors['bold'], colors['reset'] ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}lapack{1} │ BLAS/LAPACK library to use │'.format( colors['bold'], colors['reset'] ), ', '.join( LAPACKLIBS ) )
print( ' {0}lapackflags{1} │ user provided link flags │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}mkl_dir{1} │ base directory of MKL │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}hdf5{1} │ use HDF5 library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}hdf5_dir{1} │ path to HDF5 library │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}likwid{1} │ use LikWid library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}likwid_dir{1} │ path to LikWid library │'.format( colors['bold'], colors['reset'] ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}malloc{1} │ malloc library to use │'.format( colors['bold'], colors['reset'] ), ', '.join( MALLOCS ) )
print( ' {0}jemalloc{1} │ use jemalloc │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}jemalloc_dir{1} │ path to jemalloc │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}mimalloc{1} │ use mimalloc │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}mimalloc_dir{1} │ path to mimalloc │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}tcmalloc{1} │ use tcmalloc │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}tcmalloc_dir{1} │ path to tcmalloc │'.format( colors['bold'], colors['reset'] ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}compressor{1} │ compression method to use │ {2}'.format( colors['bold'], colors['reset'], ', '.join( COMPRESSORS ) ) )
print( ' {0}zblas{1} │ use compressed BLAS │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}zfp{1} │ use ZFP library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}zfp_dir{1} │ path to ZFP library │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}sz{1} │ use SZ library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}sz_dir{1} │ path to SZ library │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}sz3{1} │ use SZ3 library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}sz3_dir{1} │ path to SZ3 library │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}universal{1} │ use Universal number library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}universal_dir{1}│ path to Universal library │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}mgard{1} │ use MGARD library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}mgard_dir{1} │ path to MGARD library │'.format( colors['bold'], colors['reset'] ) )
print( ' {0}blosc{1} │ use Blosc2 library │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}blosc_dir{1} │ path to Blosc2 library │'.format( colors['bold'], colors['reset'] ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}buildtype{1} │ how to build the binaries │'.format( colors['bold'], colors['reset'] ), ', '.join( BUILD_TYPES ) )
print( ' {0}warn{1} │ enable compiler warnings │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}fullmsg{1} │ full command line output │'.format( colors['bold'], colors['reset'] ), '0/1' )
print( ' {0}color{1} │ use colored output │'.format( colors['bold'], colors['reset'] ), '0/1' )
print()
print( 'The parameters {0}programs{1} and {0}frameworks{1} can get comma separated values:'.format( colors['bold'], colors['reset'] ) )
print()
print( ' scons {0}programs{2}={1}dag-lu,dag-inv{2} {0}frameworks{2}={1}seq,tbb,omp{2}'.format( colors['bold'], colors['italic'], colors['reset'] ) )
print()
print( 'For {0}malloc{1} only a single value is valid:'.format( colors['bold'], colors['reset'] ) )
print()
print( ' scons {0}malloc{2}={1}jemalloc{2}'.format( colors['bold'], colors['italic'], colors['reset'] ) )
print()
help_cmd = env.Command( 'phony-target-help', None, show_help )
env.Alias( 'help', help_cmd )
######################################################################
#
# target 'options'
#
######################################################################
def show_options ( target, source, env ):
bool_str = { False : colors['bold'] + colors['red'] + '✘' + colors['reset'],
True : colors['bold'] + colors['green'] + '✔' + colors['reset'] }
print()
print( 'Type \'scons <option>=<value> ...\' where <option> is one of' )
print()
print( ' {0}Option{1} │ {0}Description{1} │ {0}Value/Directory{1}'.format( colors['bold'], colors['reset'] ) )
print( ' ──────────────┼───────────────────────────────┼─────────────────' )
print( ' {0}cxx{1} │ C++ compiler │'.format( colors['bold'], colors['reset'] ), CXX )
print( ' {0}cxxflags{1} │ C++ compiler flags │'.format( colors['bold'], colors['reset'] ), CXXFLAGS )
print( ' {0}optflags{1} │ compiler optimization flags │'.format( colors['bold'], colors['reset'] ), OPTFLAGS )
print( ' ──────────────┼───────────────────────────────┼──────────' )
# split "programs" into smaller pieces
parts = split_str_array( programs, 40 )
print( ' {0}programs{1} │ programs to build │'.format( colors['bold'], colors['reset'] ), parts[0] )
for i in range( 1, len(parts) ) :
print( ' │ │', parts[i] )
print( ' {0}frameworks{1} │ software frameworks to use │'.format( colors['bold'], colors['reset'] ), ', '.join( frameworks ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}hpro_dir{1} │ base directory of HLIBpro │'.format( colors['bold'], colors['reset'] ), HPRO_DIR )
print( ' {0}tbb_dir{1} │ base directory of TBB │'.format( colors['bold'], colors['reset'] ), TBB_DIR )
print( ' {0}tf_dir{1} │ base directory of C++TaskFlow │'.format( colors['bold'], colors['reset'] ), TASKFLOW_DIR )
print( ' {0}hpx_dir{1} │ base directory of HPX │'.format( colors['bold'], colors['reset'] ), HPX_DIR )
print( ' {0}gpi2_dir{1} │ base directory of GPI2 │'.format( colors['bold'], colors['reset'] ), GPI2_DIR )
print( ' {0}cuda_dir{1} │ base directory of CUDA │'.format( colors['bold'], colors['reset'] ), CUDA_DIR )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}lapack{1} │ BLAS/LAPACK library to use │'.format( colors['bold'], colors['reset'] ), lapack )
if lapack == 'user' :
print( ' {0}lapackflags{1} │ user provided link flags │ {2}'.format( colors['bold'], colors['reset'], LAPACK_FLAGS ) )
print( ' {0}malloc{1} │ malloc library to use │ {2}'.format( colors['bold'], colors['reset'], malloc ),
pathstr( JEMALLOC_DIR if malloc == 'jemalloc' else MIMALLOC_DIR if malloc == 'mimalloc' else TCMALLOC_DIR if malloc == 'tcmalloc' else '' ) )
print( ' {0}mkl_dir{1} │ base directory of Intel MKL │'.format( colors['bold'], colors['reset'] ), MKL_DIR )
print( ' {0}hdf5{1} │ use HDF5 library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ hdf5 ] ), pathstr( HDF5_DIR if hdf5 else '' ) )
print( ' {0}likwid{1} │ use LikWid library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ likwid ] ), pathstr( LIKWID_DIR if likwid else '' ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}compressor{1} │ compression method to use │ {2}'.format( colors['bold'], colors['reset'], compressor ) )
print( ' {0}zblas{1} │ use compressed BLAS │ {2}'.format( colors['bold'], colors['reset'], bool_str[ zblas ] ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}zfp{1} │ use ZFP compression library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ zfp ] ), pathstr( ZFP_DIR if zfp else '' ) )
print( ' {0}sz{1} │ use SZ compression library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ sz ] ), pathstr( SZ_DIR if sz else '' ) )
print( ' {0}sz3{1} │ use SZ3 compression library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ sz3 ] ), pathstr( SZ3_DIR if sz3 else '' ) )
print( ' {0}mgard{1} │ use MGARD compression library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ mgard ] ), pathstr( MGARD_DIR if mgard else '' ) )
print( ' {0}universal{1} │ use Universal number library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ universal ] ), pathstr( UNIVERSAL_DIR if universal else '' ) )
print( ' {0}blosc{1} │ use BLOSC2 library │ {2}'.format( colors['bold'], colors['reset'], bool_str[ blosc ] ), pathstr( BLOSC_DIR if blosc else '' ) )
print( ' ──────────────┼───────────────────────────────┼──────────' )
print( ' {0}buildtype{1} │ how to build the binaries │'.format( colors['bold'], colors['reset'] ), buildtype )
print( ' {0}warn{1} │ enable compiler warnings │'.format( colors['bold'], colors['reset'] ), bool_str[ warn ] )
print( ' {0}fullmsg{1} │ full command line output │'.format( colors['bold'], colors['reset'] ), bool_str[ fullmsg ] )
print( ' {0}color{1} │ use colored output │'.format( colors['bold'], colors['reset'] ), bool_str[ color ] )
print()
options_cmd = env.Command( 'phony-target-options', None, show_options )
env.Alias( 'options', options_cmd )
######################################################################
#
# HLR library and framework dependent targets
#
######################################################################
sources = [ 'src/apps/exp.cc',
'src/apps/helmholtz.cc',
'src/apps/laplace.cc',
'src/apps/log_kernel.cc',
'src/apps/radial.cc',
'src/cluster/distr.cc',
'src/cluster/h.cc',
'src/cluster/hodlr.cc',
'src/cluster/mblr.cc',
'src/cluster/sfc.cc',
'src/cluster/tileh.cc',
'src/cluster/tlr.cc',
'src/dag/graph.cc',
'src/dag/local_graph.cc',
'src/dag/node.cc',
# 'src/dag/solve.cc',
# 'src/matrix/level_matrix.cc',
'src/matrix/print.cc',
'src/seq/dag.cc',
# 'src/seq/solve.cc',
'src/utils/compare.cc',
'src/utils/eps_printer.cc',
'src/utils/log.cc',
'src/utils/mach.cc',
'src/utils/term.cc',
'src/utils/text.cc' ]
# add when needed
if 'dag-lu' in programs :
sources += [ 'src/dag/gauss_elim.cc',
'src/dag/invert.cc',
'src/dag/lu.cc',
'src/dag/lu_coarse.cc',
'src/dag/lu_hodlr_tiled.cc',
'src/dag/lu_hodlr_tiled_lazy.cc',
'src/dag/lu_lvl.cc',
'src/dag/lu_oop.cc',
'src/dag/lu_oop_accu.cc',
'src/dag/lu_oop_accu_sep.cc',
'src/dag/lu_oop_auto.cc',
'src/dag/lu_tileh.cc' ]
libhlr = env.StaticLibrary( 'hlr', sources )
Default( None )
program_list = []
#
# default sequential environment
#
if 'seq' in frameworks :
seq = env.Clone()
for program in programs :
name = program + '-seq'
source = path( program, name + '.cc' )
if os.path.exists( source ) and os.path.isfile( source ) :
program_list.append( seq.Program( path( program, name ), [ source ] ) )
#
# OpenMP
#
if 'omp' in frameworks :
omp = env.Clone()
omp.Append( CXXFLAGS = '-fopenmp' )
omp.Append( LINKFLAGS = '-fopenmp' )
for program in programs :
name = program + '-omp'
source = path( program, name + '.cc' )
if os.path.exists( source ) and os.path.isfile( source ) :
program_list.append( omp.Program( path( program, name ), [ source, 'src/omp/dag.cc' ] ) )
#
# TBB
#
if 'tbb' in frameworks :
tbb = env.Clone()
# tbb.ParseConfig( 'PKG_CONFIG_PATH=%s pkg-config --cflags tbb' % os.path.join( TBB_DIR, 'lib', 'pkgconfig' ) )
# tbb.ParseConfig( 'PKG_CONFIG_PATH=%s pkg-config --libs tbb' % os.path.join( TBB_DIR, 'lib', 'pkgconfig' ) )
tbb.Append( CPPPATH = os.path.join( TBB_DIR, 'include' ) )
tbb.Append( LIBPATH = os.path.join( TBB_DIR, 'lib' ) )
tbb.Append( LIBS = [ 'tbb' ] )
for program in programs :
name = program + '-tbb'
source = path( program, name + '.cc' )
if os.path.exists( source ) and os.path.isfile( source ) :
program_list.append( tbb.Program( path( program, name ), [ source, 'src/tbb/dag.cc' ] ) )
#
# TaskFlow
#
if 'tf' in frameworks :
tf = env.Clone()
tf.MergeFlags( '-isystem ' + os.path.join( TASKFLOW_DIR, 'include' ) )
tf.Append( LIBS = [ 'pthread' ] )
# tf.ParseConfig( 'PKG_CONFIG_PATH=/opt/local/magma-2.5.3/lib/pkgconfig pkg-config --cflags magma' )
# tf.ParseConfig( 'PKG_CONFIG_PATH=/opt/local/magma-2.5.3/lib/pkgconfig pkg-config --libs magma' )
for program in programs :
name = program + '-tf'
source = path( program, name + '.cc' )
# special case TF+CUDA
if program == 'cuda' and not 'cuda' in frameworks :
continue
if os.path.exists( source ) and os.path.isfile( source ) :
program_list.append( tf.Program( path( program, name ), [ source, 'src/tf/dag.cc' ] ) )
# program_list.append( tf.Program( 'programs/magma', [ 'programs/magma.cc' ] ) )
#
# HPX
#
if 'hpx' in frameworks :
hpx = env.Clone()
hpx.ParseConfig( 'PKG_CONFIG_PATH=%s pkg-config --cflags hpx_application' % ( os.path.join( HPX_DIR, 'lib', 'pkgconfig' ) ) )