-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasyblocks_diff_cleaned.txt
1983 lines (1903 loc) · 97.7 KB
/
easyblocks_diff_cleaned.txt
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
diff --git a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/c/cgal.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/c/cgal.py
index 662796f..d2e63b5 100644
--- a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/c/cgal.py
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/c/cgal.py
@@ -62,6 +62,7 @@ class EB_CGAL(CMakeMake):
libs = [tuple(os.path.join(d, 'libCGAL%s.%s' % (l, shlib_ext)) for d in libdirs) for l in ['', '_Core']]
custom_paths = {
'files': ['bin/cgal_%s' % x for x in ['create_cmake_script', 'make_macosx_app']] + libs,
- 'dirs': ['include/CGAL', ('lib/CGAL', 'lib64/CGAL')],
+# 'dirs': ['include/CGAL', ('lib/CGAL', 'lib64/CGAL')],
+ 'dirs': ['include', ('lib', 'lib64')],
}
super(EB_CGAL, self).sanity_check_step(custom_paths=custom_paths)
diff --git a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/c/cp2k.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/c/cp2k.py
index e6f2f96..a2df30e 100644
--- a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/c/cp2k.py
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/c/cp2k.py
@@ -183,7 +183,7 @@ class EB_CP2K(EasyBlock):
raise EasyBuildError("Don't know how to tweak configuration for compiler family %s" % comp_fam)
# BLAS/LAPACK/FFTW
- if get_software_root('imkl'):
+ if get_software_root('imkl') or os.getenv('MKLROOT'):
options = self.configure_MKL(options)
else:
# BLAS
@@ -255,7 +255,9 @@ class EB_CP2K(EasyBlock):
self.log.debug("Preparing module files")
imkl = get_software_root('imkl')
-
+ if not imkl:
+ imkl = os.getenv('MKLROOT')
+ self.log.debug("MKLROOT: %s", imkl)
if imkl:
# prepare modinc target path
@@ -471,7 +473,11 @@ class EB_CP2K(EasyBlock):
options['FCFLAGSOPT'] += ' $(INCFLAGS) -heap-arrays 64'
options['FCFLAGSOPT2'] += ' $(INCFLAGS) -heap-arrays 64'
- ifortver = LooseVersion(get_software_version('ifort'))
+ intelver = get_software_version('intel') # ifort
+ if intelver and len(intelver.split('.')[0]) == 2:
+ intelver = '20%s' % intelver
+ ifortver = LooseVersion(intelver) # ifort
+ self.log.debug("ifort loose version: %s" % ifortver)
# -i-static has been deprecated prior to 2013, but was still usable. From 2015 it is not.
if ifortver < LooseVersion("2013"):
@@ -497,7 +503,7 @@ class EB_CP2K(EasyBlock):
raise EasyBuildError(failmsg, "v12", "v2011.8")
elif ifortver >= LooseVersion("11"):
- if LooseVersion(get_software_version('ifort')) >= LooseVersion("11.1.072"):
+ if ifortver >= LooseVersion("11.1.072"):
self.make_instructions += "qs_vxc_atom.o: qs_vxc_atom.F\n\t$(FC) -c $(FCFLAGS2) $<\n"
else:
diff --git a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/g/gromacs.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/g/gromacs.py
index 0519385..615d289 100644
--- a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/g/gromacs.py
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/g/gromacs.py
@@ -247,9 +247,9 @@ class EB_GROMACS(CMakeMake):
else:
self.cfg.update('configopts', "-DGMX_GPU=OFF")
- if get_software_root('imkl'):
+ if get_software_root('imkl') or os.getenv('MKLROOT'):
# using MKL for FFT, so it will also be used for BLAS/LAPACK
- self.cfg.update('configopts', '-DGMX_FFT_LIBRARY=mkl -DMKL_INCLUDE_DIR="$EBROOTMKL/mkl/include" ')
+ self.cfg.update('configopts', '-DGMX_FFT_LIBRARY=mkl -DMKL_INCLUDE_DIR="$MKLROOT/include" ')
libs = os.getenv('LAPACK_STATIC_LIBS').split(',')
mkl_libs = [os.path.join(os.getenv('LAPACK_LIB_DIR'), lib) for lib in libs if lib != 'libgfortran.a']
mkl_libs = ['-Wl,--start-group'] + mkl_libs + ['-Wl,--end-group']
diff --git a/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/generic/buildscript.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/generic/buildscript.py
new file mode 100644
index 0000000..6ea4894
--- /dev/null
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/generic/buildscript.py
@@ -0,0 +1,77 @@
+##
+# Copyright 2009-2018 Ghent University
+#
+# This file is part of EasyBuild,
+# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
+# with support of Ghent University (http://ugent.be/hpc),
+# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
+# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
+# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
+#
+# https://github.com/easybuilders/easybuild
+#
+# EasyBuild is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation v2.
+#
+# EasyBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
+##
+"""
+EasyBuild support for installing (precompiled) software which is supplied as a tarball,
+implemented as an easyblock
+
+@author: Stijn De Weirdt (Ghent University)
+@author: Dries Verdegem (Ghent University)
+@author: Kenneth Hoste (Ghent University)
+@author: Pieter De Baets (Ghent University)
+@author: Jens Timmerman (Ghent University)
+"""
+import shutil
+
+from easybuild.framework.easyblock import EasyBlock
+from easybuild.tools.build_log import EasyBuildError
+from easybuild.tools.run import run_cmd
+from easybuild.framework.easyconfig import CUSTOM
+
+class BuildScript(EasyBlock):
+ """
+ Softare builds from script provided as source
+ """
+
+ @staticmethod
+ def extra_options(extra_vars=None):
+ """Extra easyconfig parameters specific to BuildScript easyblock."""
+ extra_vars = EasyBlock.extra_options(extra_vars)
+ extra_vars.update({
+ 'install_cmds': [None, "List of commands to run to install the software", CUSTOM],
+ })
+ return extra_vars
+
+ def configure_step(self):
+ """
+ Dummy configure method
+ """
+ pass
+
+ def build_step(self):
+ """
+ Dummy build method: nothing to build
+ """
+ pass
+
+ def install_step(self, src=None):
+ """Install by running specified install commands."""
+ if self.cfg['install_cmds'] is not None:
+ for cmd in self.cfg['install_cmds']:
+ run_cmd(cmd, log_all=True)
+
+ def sanity_check_rpath(self):
+ """Skip the rpath sanity check, this is binary software"""
+ self.log.info("RPATH sanity check is skipped when using %s easyblock (derived from Tarball)",
+ self.__class__.__name__)
diff --git a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/generic/mesonninja.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/generic/mesonninja.py
index 0e8c480..ea2c150 100644
--- a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/generic/mesonninja.py
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/generic/mesonninja.py
@@ -56,7 +56,7 @@ class MesonNinja(EasyBlock):
"""
# make sure both Meson and Ninja are included as build dependencies
build_dep_names = [d['name'] for d in self.cfg.builddependencies()]
- for tool in ['Ninja', 'Meson']:
+ for tool in ['ninja', 'meson']:
if tool not in build_dep_names:
raise EasyBuildError("%s not included as build dependency", tool)
cmd = tool.lower()
diff --git a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/generic/pythonpackage.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/generic/pythonpackage.py
index 2409118..f9a4cfc 100644
--- a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/generic/pythonpackage.py
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/generic/pythonpackage.py
@@ -587,9 +587,10 @@ class PythonPackage(ExtensionEasyBlock):
downloaded_deps.extend(re.compile(pattern, re.M).findall(self.install_cmd_output))
if downloaded_deps:
- success = False
- fail_msg = "found one or more downloaded dependencies: %s" % ', '.join(downloaded_deps)
- self.sanity_check_fail_msgs.append(fail_msg)
+ pass
+ #success = False
+ #fail_msg = "found one or more downloaded dependencies: %s" % ', '.join(downloaded_deps)
+ #self.sanity_check_fail_msgs.append(fail_msg)
else:
self.log.debug("Detection of downloaded dependencies not enabled")
diff --git a/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/i/intel.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/i/intel.py
new file mode 100644
index 0000000..b7bd190
--- /dev/null
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/i/intel.py
@@ -0,0 +1,339 @@
+# #
+# Copyright 2009-2019 Ghent University
+#
+# This file is part of EasyBuild,
+# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
+# with support of Ghent University (http://ugent.be/hpc),
+# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
+# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
+# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
+#
+# https://github.com/easybuilders/easybuild
+#
+# EasyBuild is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation v2.
+#
+# EasyBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
+# #
+"""
+EasyBuild support for install the Intel C/C++ compiler suite, implemented as an easyblock
+
+@author: Stijn De Weirdt (Ghent University)
+@author: Dries Verdegem (Ghent University)
+@author: Kenneth Hoste (Ghent University)
+@author: Pieter De Baets (Ghent University)
+@author: Jens Timmerman (Ghent University)
+@author: Ward Poelmans (Ghent University)
+@author: Fokko Masselink
+"""
+
+import os
+import re
+import shutil
+from distutils.version import LooseVersion
+
+from easybuild.framework.easyconfig import CUSTOM
+from easybuild.framework.easyblock import EasyBlock
+from easybuild.easyblocks.generic.intelbase import IntelBase, ACTIVATION_NAME_2012, COMP_ALL
+from easybuild.easyblocks.generic.intelbase import LICENSE_FILE_NAME_2012
+from easybuild.easyblocks.t.tbb import get_tbb_gccprefix
+from easybuild.tools.run import run_cmd
+from easybuild.tools.systemtools import get_shared_lib_ext
+
+
+def get_icc_version():
+ """Obtain icc version string via 'icc --version'."""
+ cmd = "icc --version"
+ (out, _) = run_cmd(cmd, log_all=True, simple=False)
+
+ ver_re = re.compile("^icc \(ICC\) (?P<version>[0-9.]+) [0-9]+$", re.M)
+ version = ver_re.search(out).group('version')
+
+ return version
+
+
+class EB_intel(IntelBase):
+ """Support for installing icc
+
+ - tested with 11.1.046
+ - will fail for all older versions (due to newer silent installer)
+ """
+
+ @staticmethod
+ def extra_options():
+ """Add extra easyconfig parameters for Intel."""
+ extra_vars = {
+ 'official_version': [None, "Official Intel version XXXX.X.XXX", CUSTOM],
+ 'hide_mpi': [True, "LD_LIBRARY_PATH, CPATH, PATH are not including any reference to MPI libs or headers", CUSTOM],
+ }
+ return IntelBase.extra_options(extra_vars)
+
+
+ def __init__(self, *args, **kwargs):
+ """Constructor, initialize class variables."""
+ super(EB_intel, self).__init__(*args, **kwargs)
+
+ self.debuggerpath = None
+
+ self.comp_libs_subdir = None
+
+ if LooseVersion(self.cfg['official_version']) >= LooseVersion('2016'):
+
+ self.comp_libs_subdir = os.path.join('compilers_and_libraries_%s' % self.cfg['official_version'], 'linux')
+
+ if self.cfg['components'] is None:
+ # we need to use 'ALL' by default,
+ # using 'DEFAULTS' results in key things not being installed (e.g. bin/icc)
+ self.cfg['components'] = [COMP_ALL]
+ self.log.debug("Nothing specified for components, but required for version 2016, using %s instead",
+ self.cfg['components'])
+
+
+ def install_step(self):
+ """
+ Actual installation
+ - create silent cfg file
+ - execute command
+ """
+ silent_cfg_names_map = None
+
+ if LooseVersion(self.cfg['official_version']) < LooseVersion('2013_sp1'):
+ # since icc v2013_sp1, silent.cfg has been slightly changed to be 'more standard'
+
+ silent_cfg_names_map = {
+ 'activation_name': ACTIVATION_NAME_2012,
+ 'license_file_name': LICENSE_FILE_NAME_2012,
+ }
+
+ super(EB_intel, self).install_step(silent_cfg_names_map=silent_cfg_names_map)
+ shutil.copy(self.license_file, os.path.join(self.installdir, '../'))
+
+
+ def sanity_check_step(self):
+ """Custom sanity check paths for icc."""
+
+ binprefix = 'bin/intel64'
+ libprefix = 'lib/intel64'
+ if LooseVersion(self.cfg['official_version']) >= LooseVersion('2011'):
+ if LooseVersion(self.cfg['official_version']) <= LooseVersion('2011.3.174'):
+ binprefix = 'bin'
+ elif LooseVersion(self.cfg['official_version']) >= LooseVersion('2013_sp1'):
+ binprefix = 'bin'
+ else:
+ libprefix = 'compiler/lib/intel64'
+
+ binfiles = ['icc', 'icpc']
+ if LooseVersion(self.cfg['official_version']) < LooseVersion('2014'):
+ binfiles += ['idb']
+
+ binaries = [os.path.join(binprefix, f) for f in binfiles]
+ libraries = [os.path.join(libprefix, 'lib%s' % l) for l in ['iomp5.a', 'iomp5.%s' % get_shared_lib_ext()]]
+ sanity_check_files = binaries + libraries
+ if LooseVersion(self.cfg['official_version']) > LooseVersion('2015'):
+ sanity_check_files.append('include/omp.h')
+
+ custom_paths = {
+ 'files': sanity_check_files,
+ 'dirs': [],
+ }
+
+ # make very sure that expected 'compilers_and_libraries_<VERSION>/linux' subdir is there for recent versions,
+ # since we rely on it being there in make_module_req_guess
+ if self.comp_libs_subdir:
+ custom_paths['dirs'].append(self.comp_libs_subdir)
+
+ custom_commands = ["which icc"]
+
+ super(EB_intel, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands)
+
+ def make_module_req_guess(self):
+ """
+ Additional paths to consider for prepend-paths statements in module file
+ """
+ prefix = None
+ docpath = 'documentation_%s' % self.cfg['official_version'].split('.')[0]
+ # guesses per environment variables
+ # some of these paths only apply to certain versions, but that doesn't really matter
+ # existence of paths is checked by module generator before 'prepend-paths' statements are included
+
+ guesses = {
+ 'CLASSPATH': ['daal/lib/daal.jar'],
+ # 'include' is deliberately omitted, including it causes problems, e.g. with complex.h and std::complex
+ # cfr. https://software.intel.com/en-us/forums/intel-c-compiler/topic/338378
+ 'CPATH': ['ipp/include', 'mkl/include', 'mkl/include/fftw', 'tbb/include'],
+ 'DAALROOT': ['daal'],
+ 'IPPROOT': ['ipp'],
+ 'LD_LIBRARY_PATH': ['lib'],
+ 'MANPATH': ['debugger/gdb/intel64/share/man', 'man/common', 'man/en_US', 'share/man'],
+ 'PATH': ['tbb/bin', 'mkl/bin'],
+ 'TBBROOT': ['tbb'],
+ 'MKLROOT': ['mkl'],
+ 'PSTLROOT': ['pstl'],
+ 'INFOPATH': [docpath],
+ 'PKG_CONFIG_PATH': ['mkl/bin/pkgconfig']
+ }
+
+ if self.cfg['m32']:
+ # 32-bit toolchain
+ guesses['PATH'].extend(['bin/ia32', 'tbb/bin/ia32'])
+ # in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
+ guesses['LD_LIBRARY_PATH'].append('lib/ia32')
+
+ else:
+ # 64-bit toolkit
+ guesses['PATH'].extend([
+ 'bin/intel64',
+ 'debugger/gdb/intel64/bin',
+ 'ipp/bin/intel64',
+ 'tbb/bin/emt64',
+ 'tbb/bin/intel64',
+ ])
+
+ # in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
+ guesses['LD_LIBRARY_PATH'].extend([
+ 'tbb/lib/intel64/%s' % get_tbb_gccprefix(),
+ 'mkl/lib/intel64',
+ 'ipp/lib/intel64',
+ 'debugger/ipt/intel64/lib',
+ 'compiler/lib/intel64',
+ ])
+ guesses['MIC_LD_LIBRARY_PATH'] = [
+ 'compiler/lib/mic',
+ 'debugger/ipt/lib/mic',
+ 'ipp/lib/mic',
+ 'mkl/lib/mic',
+ 'tbb/lib/mic',
+ ]
+
+
+ if not self.cfg['hide_mpi']:
+ guesses['LD_LIBRARY_PATH'].append('mpi/mic/lib', 'mpi/intel64/lib')
+ guesses['MIC_LD_LIBRARY_PATH'].append('/mpi/mic/lib')
+ guesses['PATH'].append('mpi/intel64/bin')
+ guesses['CPATH'].append('mpi/intel64/include')
+ if LooseVersion(self.cfg['official_version']) < LooseVersion('2016'):
+ prefix = 'composer_xe_%s' % self.cfg['official_version']
+ # for some older versions, name of subdirectory is slightly different
+ if not os.path.isdir(os.path.join(self.installdir, prefix)):
+ cand_prefix = 'composerxe-%s' % self.cfg['official_version']
+ if os.path.isdir(os.path.join(self.installdir, cand_prefix)):
+ prefix = cand_prefix
+
+ # debugger is dependent on $INTEL_PYTHONHOME since version 2015 and newer
+ if LooseVersion(self.cfg['official_version']) >= LooseVersion('2015'):
+ self.debuggerpath = os.path.join(prefix, 'debugger')
+
+ else:
+ # new directory layout for Intel Parallel Studio XE 2016
+ # https://software.intel.com/en-us/articles/new-directory-layout-for-intel-parallel-studio-xe-2016
+ prefix = self.comp_libs_subdir
+ # Debugger requires INTEL_PYTHONHOME, which only allows for a single value
+ self.debuggerpath = 'debugger_%s' % self.cfg['official_version'].split('.')[0]
+
+ guesses['LD_LIBRARY_PATH'].extend([
+ os.path.join(self.debuggerpath, 'libipt/intel64/lib'),
+ 'daal/lib/intel64_lin',
+ ])
+
+ # 'lib/intel64' is deliberately listed last, so it gets precedence over subdirs
+ guesses['LD_LIBRARY_PATH'].append('lib/intel64')
+
+ # set up advisor and inspector
+
+ # set debugger path
+ if self.debuggerpath:
+ guesses['PATH'].append(os.path.join(self.debuggerpath, 'gdb', 'intel64', 'bin'))
+
+ # in recent Intel compiler distributions, the actual binaries are
+ # in deeper directories, and symlinked in top-level directories
+ # however, not all binaries are symlinked (e.g. mcpcom is not)
+ # we only need to include the deeper directories (same as compilervars.sh)
+ if prefix and os.path.isdir(os.path.join(self.installdir, prefix)):
+ for key, subdirs in guesses.items():
+ guesses[key] = [os.path.join(prefix, subdir) for subdir in subdirs]
+
+ # The for loop above breaks libipt library loading for gdb - this fixes that
+ guesses['LD_LIBRARY_PATH'].extend([
+ 'daal/lib/intel64_lin',
+ # 'advisor/lib64',
+ # 'advisor_xe/lib64'
+ # 'inspector_xe/lib64', # causes problems with libiomp5.so
+ # 'inspector/lib64', # causes problems with libiomp5.so
+ ])
+ guesses['CPATH'].extend([
+ # 'daal/include',
+ # 'advisor/include',
+ # 'advisor_xe/include',
+ # 'inspector/include',
+ # 'inspector_xe/include',
+ ])
+ guesses['PATH'].extend([
+ 'daal/bin',
+ 'advisor/bin64',
+ 'advisor_xe/bin64',
+ 'inspector/bin64',
+ 'inspector_xe/bin64'])
+ guesses['MANPATH'].extend([
+ 'man/common',
+ '%s/en/debugger//gdb-mic/man' % docpath,
+ '%s/en/debugger//gdb-igfx/man' % docpath,
+ '%s/en/debugger//gdb-ia/man' % docpath,])
+ guesses['INFOPATH'].extend([
+ '%s/en/debugger//gdb-mic/info' % docpath,
+ '%s/en/debugger//gdb-ia/info' % docpath,
+ '%s/en/debugger//gdb-igfx/info' % docpath])
+ if self.debuggerpath:
+ guesses['LD_LIBRARY_PATH'].extend([
+ os.path.join(self.debuggerpath, 'libipt/intel64/lib'),
+ os.path.join(self.debuggerpath, 'iga/lib')])
+ guesses['GDB_CROSS'] = [
+ os.path.join(self.debuggerpath, 'gdb/intel64_mic/bin/gdb-mic'),
+ os.path.join(self.debuggerpath, 'gdb/intel64/bin/gdb-ia')]
+ for gdb in guesses['GDB_CROSS']:
+ if os.path.isfile(os.path.join(self.installdir, gdb)):
+ # pick first existing one and reset list
+ guesses['GDB_CROSS'] = [gdb]
+ break
+ guesses['GDBSERVER_MIC'] = [
+ os.path.join(self.debuggerpath, 'gdb/targets/intel64/x200/bin/gdbserver'),
+ os.path.join(self.debuggerpath, 'gdb/targets/mic/bin/gdbserver'),]
+
+ # only set $IDB_HOME if idb exists
+ idb_home_subdir = 'bin/intel64'
+ if os.path.isfile(os.path.join(self.installdir, idb_home_subdir, 'idb')):
+ guesses['IDB_HOME'] = [idb_home_subdir]
+
+ guesses['LIBRARY_PATH'] = guesses['LD_LIBRARY_PATH']
+
+ return guesses
+
+
+ def make_module_extra(self, *args, **kwargs):
+ """Additional custom variables for icc: $INTEL_PYTHONHOME."""
+ txt = super(EB_intel, self).make_module_extra(*args, **kwargs)
+
+ if self.debuggerpath:
+ intel_pythonhome = os.path.join(self.installdir, self.debuggerpath, 'python', 'intel64')
+ if os.path.isdir(intel_pythonhome):
+ txt += self.module_generator.set_environment('INTEL_PYTHONHOME', intel_pythonhome)
+
+ # use licence file in installdir/../
+ self.license_file = os.path.join(self.installdir, '..', os.path.basename(self.license_file))
+
+ # on Debian/Ubuntu, /usr/include/x86_64-linux-gnu needs to be included in $CPATH for icc
+ out, ec = run_cmd("gcc -print-multiarch", simple=False, log_all=False, log_ok=False)
+ multiarch_inc_subdir = out.strip()
+ if ec == 0 and multiarch_inc_subdir:
+ multiarch_inc_dir = os.path.join('/usr', 'include', multiarch_inc_subdir)
+ self.log.info("Adding multiarch include path %s to $CPATH in generated module file", multiarch_inc_dir)
+ # system location must be appended at the end, so use append_paths
+ txt += self.module_generator.append_paths('CPATH', [multiarch_inc_dir], allow_abs=True)
+
+ return txt
diff --git a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/o/openfoam.py b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/o/openfoam.py
index 3a286b5..ff10c80 100644
--- a/home/uvacse/git/easybuild-easyblocks/easybuild/easyblocks/o/openfoam.py
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/o/openfoam.py
@@ -67,8 +67,12 @@ class EB_OpenFOAM(EasyBlock):
self.openfoamdir = None
self.thrdpartydir = None
+ # version may start with 'v' for some variants of OpenFOAM
+ # we need to strip this off to avoid problems when comparing LooseVersion instances in Python 3
+ self.looseversion = LooseVersion(self.version.strip('v+'))
+
if 'extend' in self.name.lower():
- if LooseVersion(self.version) >= LooseVersion('3.0'):
+ if self.looseversion >= LooseVersion('3.0'):
self.openfoamdir = 'foam-extend-%s' % self.version
else:
self.openfoamdir = 'OpenFOAM-%s-ext' % self.version
@@ -145,10 +149,10 @@ class EB_OpenFOAM(EasyBlock):
extra_flags = '-fuse-ld=bfd'
# older versions of OpenFOAM-Extend require -fpermissive
- if 'extend' in self.name.lower() and LooseVersion(self.version) < LooseVersion('2.0'):
+ if 'extend' in self.name.lower() and self.looseversion < LooseVersion('2.0'):
extra_flags += ' -fpermissive'
- if LooseVersion(self.version) < LooseVersion('3.0'):
+ if self.looseversion < LooseVersion('3.0'):
extra_flags += ' -fno-delete-null-pointer-checks'
elif comp_fam == toolchain.INTELCOMP: # @UndefinedVariable
@@ -166,13 +170,13 @@ class EB_OpenFOAM(EasyBlock):
regex_subs = [(r"^(setenv|export) WM_THIRD_PARTY_USE_.*[ =].*$", r"# \g<0>")]
# this does not work for OpenFOAM Extend lower than 2.0
- if 'extend' not in self.name.lower() or LooseVersion(self.version) >= LooseVersion('2.0'):
+ if 'extend' not in self.name.lower() or self.looseversion >= LooseVersion('2.0'):
key = "WM_PROJECT_VERSION"
regex_subs += [(r"^(setenv|export) %s=.*$" % key, r"export %s=%s #\g<0>" % (key, self.version))]
WM_env_var = ['WM_COMPILER', 'WM_MPLIB', 'WM_THIRD_PARTY_DIR']
# OpenFOAM >= 3.0.0 can use 64 bit integers
- if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0'):
+ if 'extend' not in self.name.lower() and self.looseversion >= LooseVersion('3.0'):
WM_env_var.append('WM_LABEL_SIZE')
for env_var in WM_env_var:
regex_subs.append((r"^(setenv|export) (?P<var>%s)[ =](?P<val>.*)$" % env_var,
@@ -181,6 +185,8 @@ class EB_OpenFOAM(EasyBlock):
# inject compiler variables into wmake/rules files
ldirs = glob.glob(os.path.join(self.builddir, self.openfoamdir, 'wmake', 'rules', 'linux*'))
+ if self.looseversion >= LooseVersion('1906'):
+ ldirs += glob.glob(os.path.join(self.builddir, self.openfoamdir, 'wmake', 'rules', 'General', '*'))
langs = ['c', 'c++']
# NOTE: we do not want to change the Debug rules files becuse
@@ -210,6 +216,9 @@ class EB_OpenFOAM(EasyBlock):
'c++OPT': os.environ['CXXFLAGS'],
}
for wmake_rules_file in wmake_rules_files:
+ # the cOpt and c++Opt files don't exist in the General directories (which are included for recent versions)
+ if not os.path.isfile(wmake_rules_file):
+ continue
fullpath = os.path.join(self.builddir, self.openfoamdir, wmake_rules_file)
self.log.debug("Patching compiler variables in %s", fullpath)
regex_subs = []
@@ -220,6 +229,7 @@ class EB_OpenFOAM(EasyBlock):
# enable verbose build for debug purposes
# starting with openfoam-extend 3.2, PS1 also needs to be set
env.setvar("FOAM_VERBOSE", '1')
+ env.setvar("PS1", '1')
# installation directory
env.setvar("FOAM_INST_DIR", self.installdir)
@@ -241,15 +251,15 @@ class EB_OpenFOAM(EasyBlock):
env.setvar("WM_NCOMPPROCS", str(self.cfg['parallel']))
# OpenFOAM >= 3.0.0 can use 64 bit integers
- if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0'):
+ if 'extend' not in self.name.lower() and self.looseversion >= LooseVersion('3.0'):
if self.toolchain.options['i8']:
env.setvar("WM_LABEL_SIZE", '64')
else:
env.setvar("WM_LABEL_SIZE", '32')
# make sure lib/include dirs for dependencies are found
- openfoam_extend_v3 = 'extend' in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0')
- if LooseVersion(self.version) < LooseVersion("2") or openfoam_extend_v3:
+ openfoam_extend_v3 = 'extend' in self.name.lower() and self.looseversion >= LooseVersion('3.0')
+ if self.looseversion < LooseVersion("2") or openfoam_extend_v3:
self.log.debug("List of deps: %s" % self.cfg.dependencies())
for dep in self.cfg.dependencies():
dep_name = dep['name'].upper(),
@@ -261,7 +271,7 @@ class EB_OpenFOAM(EasyBlock):
"%s_LIB_DIR": "%s/lib",
"%s_INCLUDE_DIR": "%s/include",
}
- for var, val in dep_vars.iteritems():
+ for var, val in dep_vars.items():
env.setvar(var % dep_name, val % dep_root)
else:
for depend in ['SCOTCH', 'METIS', 'CGAL', 'Paraview']:
@@ -277,7 +287,7 @@ class EB_OpenFOAM(EasyBlock):
"""Build OpenFOAM using make after sourcing script to set environment."""
precmd = "source %s" % os.path.join(self.builddir, self.openfoamdir, "etc", "bashrc")
- if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion('4.0'):
+ if 'extend' not in self.name.lower() and self.looseversion >= LooseVersion('4.0'):
cleancmd = "cd $WM_PROJECT_DIR && wcleanPlatform -all && cd -"
else:
cleancmd = "wcleanAll"
@@ -289,7 +299,7 @@ class EB_OpenFOAM(EasyBlock):
'prebuildopts': self.cfg['prebuildopts'],
'makecmd': os.path.join(self.builddir, self.openfoamdir, '%s'),
}
- if 'extend' in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0'):
+ if 'extend' in self.name.lower() and self.looseversion >= LooseVersion('3.0'):
qa = {
"Proceed without compiling ParaView [Y/n]": 'Y',
"Proceed without compiling cudaSolvers? [Y/n]": 'Y',
@@ -305,12 +315,14 @@ class EB_OpenFOAM(EasyBlock):
r"\s*\^\s*", # warning indicator
"Cleaning .*",
]
- run_cmd_qa(cmd_tmpl % 'Allwmake.firstInstall', qa, no_qa=noqa, log_all=True, simple=True)
+ run_cmd_qa(cmd_tmpl % 'Allwmake.firstInstall', qa, no_qa=noqa, log_all=True, simple=True, maxhits=500)
else:
cmd = 'Allwmake'
- if LooseVersion(self.version) >= LooseVersion('1606'):
+ if self.looseversion > LooseVersion('1606'):
# use Allwmake -log option if possible since this can be useful during builds, but also afterwards
- cmd += ' -log'
+# cmd += ' -log'
+ cmd += ">log.make"
+ self.log.debug("CMD: %s" % cmd )
run_cmd(cmd_tmpl % cmd, log_all=True, simple=True, log_output=True)
def install_step(self):
@@ -333,7 +345,7 @@ class EB_OpenFOAM(EasyBlock):
shlib_ext = get_shared_lib_ext()
# OpenFOAM >= 3.0.0 can use 64 bit integers
- if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0'):
+ if 'extend' not in self.name.lower() and self.looseversion >= LooseVersion('3.0'):
if self.toolchain.options['i8']:
int_size = 'Int64'
else:
@@ -343,8 +355,8 @@ class EB_OpenFOAM(EasyBlock):
psubdir = "linux64%sDP%s%s" % (self.wm_compiler, int_size, self.build_type)
- openfoam_extend_v3 = 'extend' in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0')
- if openfoam_extend_v3 or LooseVersion(self.version) < LooseVersion("2"):
+ openfoam_extend_v3 = 'extend' in self.name.lower() and self.looseversion >= LooseVersion('3.0')
+ if openfoam_extend_v3 or self.looseversion < LooseVersion("2"):
toolsdir = os.path.join(self.openfoamdir, "applications", "bin", psubdir)
libsdir = os.path.join(self.openfoamdir, "lib", psubdir)
dirs = [toolsdir, libsdir]
@@ -356,16 +368,24 @@ class EB_OpenFOAM(EasyBlock):
# some randomly selected binaries
# if one of these is missing, it's very likely something went wrong
bins = [os.path.join(self.openfoamdir, "bin", x) for x in ["paraFoam"]] + \
- [os.path.join(toolsdir, "buoyant%sSimpleFoam" % x) for x in ["", "Boussinesq"]] + \
- [os.path.join(toolsdir, "%sFoam" % x) for x in ["boundary", "engine", "sonic"]] + \
+ [os.path.join(toolsdir, "buoyantSimpleFoam")] + \
+ [os.path.join(toolsdir, "%sFoam" % x) for x in ["boundary", "engine"]] + \
[os.path.join(toolsdir, "surface%s" % x) for x in ["Add", "Find", "Smooth"]] + \
[os.path.join(toolsdir, x) for x in ['blockMesh', 'checkMesh', 'deformedGeom', 'engineSwirl',
'modifyMesh', 'refineMesh']]
+
+ # only include Boussinesq and sonic since for OpenFOAM < 7, since those solvers have been deprecated
+ if self.looseversion < LooseVersion('7'):
+ bins.extend([
+ os.path.join(toolsdir, "buoyantBoussinesqSimpleFoam"),
+ os.path.join(toolsdir, "sonicFoam")
+ ])
+
# check for the Pstream and scotchDecomp libraries, there must be a dummy one and an mpi one
if 'extend' in self.name.lower():
libs = [os.path.join(libsdir, "libscotchDecomp.%s" % shlib_ext),
os.path.join(libsdir, "libmetisDecomp.%s" % shlib_ext)]
- if LooseVersion(self.version) < LooseVersion('3.2'):
+ if self.looseversion < LooseVersion('3.2'):
# Pstream should have both a dummy and a mpi one
libs.extend([os.path.join(libsdir, x, "libPstream.%s" % shlib_ext) for x in ["dummy", "mpi"]])
libs.extend([os.path.join(libsdir, "mpi", "libparMetisDecomp.%s" % shlib_ext)])
@@ -378,7 +398,7 @@ class EB_OpenFOAM(EasyBlock):
[os.path.join(libsdir, "libscotchDecomp.%s" % shlib_ext)] + \
[os.path.join(libsdir, "dummy", "libscotchDecomp.%s" % shlib_ext)]
- if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion("2.3.0"):
+ if 'extend' not in self.name.lower() and self.looseversion >= LooseVersion("2.3.0"):
# surfaceSmooth is replaced by surfaceLambdaMuSmooth is OpenFOAM v2.3.0
bins.remove(os.path.join(toolsdir, "surfaceSmooth"))
bins.append(os.path.join(toolsdir, "surfaceLambdaMuSmooth"))
@@ -408,7 +428,7 @@ class EB_OpenFOAM(EasyBlock):
]
# OpenFOAM >= 3.0.0 can use 64 bit integers
- if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0'):
+ if 'extend' not in self.name.lower() and self.looseversion >= LooseVersion('3.0'):
if self.toolchain.options['i8']:
env_vars += [('WM_LABEL_SIZE', '64')]
else:
diff --git a/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/o/openfoam.py.old b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/o/openfoam.py.old
new file mode 100644
index 0000000..aa89dd9
--- /dev/null
+++ b/apps/software/EasyBuild/3.9.0/lib/python2.7/site-packages/easybuild_easyblocks-3.9.0-py2.7.egg/easybuild/easyblocks/o/openfoam.py.old
@@ -0,0 +1,423 @@
+##
+# Copyright 2009-2019 Ghent University
+#
+# This file is part of EasyBuild,
+# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
+# with support of Ghent University (http://ugent.be/hpc),
+# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
+# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
+# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
+#
+# https://github.com/easybuilders/easybuild
+#
+# EasyBuild is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation v2.
+#
+# EasyBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
+##
+"""
+EasyBuild support for building and installing OpenFOAM, implemented as an easyblock
+
+@author: Stijn De Weirdt (Ghent University)
+@author: Dries Verdegem (Ghent University)
+@author: Kenneth Hoste (Ghent University)
+@author: Pieter De Baets (Ghent University)
+@author: Jens Timmerman (Ghent University)
+@author: Xavier Besseron (University of Luxembourg)
+@author: Ward Poelmans (Ghent University)
+@author: Balazs Hajgato (Free University Brussels (VUB))
+"""
+
+import glob
+import os
+import re
+import shutil
+import stat
+from distutils.version import LooseVersion
+
+import easybuild.tools.environment as env
+import easybuild.tools.toolchain as toolchain
+from easybuild.framework.easyblock import EasyBlock
+from easybuild.tools.build_log import EasyBuildError
+from easybuild.tools.filetools import adjust_permissions, apply_regex_substitutions, mkdir
+from easybuild.tools.modules import get_software_root, get_software_version
+from easybuild.tools.run import run_cmd, run_cmd_qa
+from easybuild.tools.systemtools import get_shared_lib_ext
+
+
+class EB_OpenFOAM(EasyBlock):
+ """Support for building and installing OpenFOAM."""
+
+ def __init__(self, *args, **kwargs):
+ """Specify that OpenFOAM should be built in install dir."""
+
+ super(EB_OpenFOAM, self).__init__(*args, **kwargs)
+
+ self.build_in_installdir = True
+
+ self.wm_compiler = None
+ self.wm_mplib = None
+ self.openfoamdir = None
+ self.thrdpartydir = None
+
+ if 'extend' in self.name.lower():
+ if LooseVersion(self.version) >= LooseVersion('3.0'):
+ self.openfoamdir = 'foam-extend-%s' % self.version
+ else:
+ self.openfoamdir = 'OpenFOAM-%s-ext' % self.version
+ else:
+ self.openfoamdir = '-'.join([self.name, '-'.join(self.version.split('-')[:2])])
+ self.log.debug("openfoamdir: %s" % self.openfoamdir)
+
+ # Set build type to requested value
+ if self.toolchain.options['debug']:
+ self.build_type = 'Debug'
+ else:
+ self.build_type = 'Opt'
+
+ def extract_step(self):
+ """Extract sources as expected by the OpenFOAM(-Extend) build scripts."""
+ super(EB_OpenFOAM, self).extract_step()
+ # make sure that the expected subdir is really there after extracting
+ # if not, the build scripts (e.g., the etc/bashrc being sourced) will likely fail
+ openfoam_installdir = os.path.join(self.installdir, self.openfoamdir)
+ if not os.path.exists(openfoam_installdir):
+ self.log.warning("Creating expected directory %s, and moving everything there" % openfoam_installdir)
+ try:
+ contents_installdir = os.listdir(self.installdir)
+ source = os.path.join(self.installdir, contents_installdir[0])
+ # it's one directory but has a wrong name
+ if len(contents_installdir) == 1 and os.path.isdir(source):
+ target = os.path.join(self.installdir, self.openfoamdir)
+ self.log.debug("Renaming %s to %s", source, target)
+ os.rename(source, target)
+ else:
+ mkdir(openfoam_installdir)
+ for fil in contents_installdir:
+ if fil != self.openfoamdir:
+ source = os.path.join(self.installdir, fil)
+ target = os.path.join(openfoam_installdir, fil)
+ self.log.debug("Moving %s to %s", source, target)
+ shutil.move(source, target)
+ os.chdir(openfoam_installdir)
+ except OSError as err:
+ raise EasyBuildError("Failed to move all files to %s: %s", openfoam_installdir, err)
+
+ def patch_step(self, beginpath=None):
+ """Adjust start directory and start path for patching to correct directory."""
+ self.cfg['start_dir'] = os.path.join(self.installdir, self.openfoamdir)
+ super(EB_OpenFOAM, self).patch_step(beginpath=self.cfg['start_dir'])
+
+ def prepare_step(self, *args, **kwargs):
+ """Prepare for OpenFOAM install procedure."""
+ super(EB_OpenFOAM, self).prepare_step(*args, **kwargs)
+
+ comp_fam = self.toolchain.comp_family()
+ if comp_fam == toolchain.GCC: # @UndefinedVariable
+ self.wm_compiler = 'Gcc'
+ elif comp_fam == toolchain.INTELCOMP: # @UndefinedVariable
+ self.wm_compiler = 'Icc'
+ else:
+ raise EasyBuildError("Unknown compiler family, don't know how to set WM_COMPILER")
+
+ # set to an MPI unknown by OpenFOAM, since we're handling the MPI settings ourselves (via mpicc, etc.)
+ # Note: this name must contain 'MPI' so the MPI version of the
+ # Pstream library is built (cf src/Pstream/Allwmake)
+ self.wm_mplib = "EASYBUILDMPI"
+
+ def configure_step(self):
+ """Configure OpenFOAM build by setting appropriate environment variables."""
+ # compiler & compiler flags
+ comp_fam = self.toolchain.comp_family()
+
+ extra_flags = ''
+ if comp_fam == toolchain.GCC: # @UndefinedVariable
+ if get_software_version('GCC') >= LooseVersion('4.8'):
+ # make sure non-gold version of ld is used, since OpenFOAM requires it
+ # see http://www.openfoam.org/mantisbt/view.php?id=685
+ extra_flags = '-fuse-ld=bfd'
+
+ # older versions of OpenFOAM-Extend require -fpermissive
+ if 'extend' in self.name.lower() and LooseVersion(self.version) < LooseVersion('2.0'):
+ extra_flags += ' -fpermissive'
+
+ if LooseVersion(self.version) < LooseVersion('3.0'):
+ extra_flags += ' -fno-delete-null-pointer-checks'
+
+ elif comp_fam == toolchain.INTELCOMP: # @UndefinedVariable
+ # make sure -no-prec-div is used with Intel compilers
+ extra_flags = '-no-prec-div'
+
+ for env_var in ['CFLAGS', 'CXXFLAGS']:
+ env.setvar(env_var, "%s %s" % (os.environ.get(env_var, ''), extra_flags))
+
+ # patch out hardcoding of WM_* environment variables
+ # for example, replace 'export WM_COMPILER=Gcc' with ': ${WM_COMPILER:=Gcc}; export WM_COMPILER'
+ for script in [os.path.join(self.builddir, self.openfoamdir, x) for x in ['etc/bashrc', 'etc/cshrc']]:
+ self.log.debug("Patching out hardcoded $WM_* env vars in %s", script)
+ # disable any third party stuff, we use EB controlled builds
+ regex_subs = [(r"^(setenv|export) WM_THIRD_PARTY_USE_.*[ =].*$", r"# \g<0>")]
+
+ # this does not work for OpenFOAM Extend lower than 2.0
+ if 'extend' not in self.name.lower() or LooseVersion(self.version) >= LooseVersion('2.0'):
+ key = "WM_PROJECT_VERSION"
+ regex_subs += [(r"^(setenv|export) %s=.*$" % key, r"export %s=%s #\g<0>" % (key, self.version))]
+
+ WM_env_var = ['WM_COMPILER', 'WM_MPLIB', 'WM_THIRD_PARTY_DIR']
+ # OpenFOAM >= 3.0.0 can use 64 bit integers
+ if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0'):
+ WM_env_var.append('WM_LABEL_SIZE')
+ for env_var in WM_env_var:
+ regex_subs.append((r"^(setenv|export) (?P<var>%s)[ =](?P<val>.*)$" % env_var,
+ r": ${\g<var>:=\g<val>}; export \g<var>"))
+ apply_regex_substitutions(script, regex_subs)
+
+ # inject compiler variables into wmake/rules files
+ ldirs = glob.glob(os.path.join(self.builddir, self.openfoamdir, 'wmake', 'rules', 'linux*'))
+ langs = ['c', 'c++']
+
+ # NOTE: we do not want to change the Debug rules files becuse
+ # that would change the cOPT/c++OPT values from their empty setting.
+ suffixes = ['', 'Opt']
+ wmake_rules_files = [os.path.join(ldir, lang + suff) for ldir in ldirs for lang in langs for suff in suffixes]
+
+ mpicc = os.environ['MPICC']
+ mpicxx = os.environ['MPICXX']
+ cc_seq = os.environ.get('CC_SEQ', os.environ['CC'])
+ cxx_seq = os.environ.get('CXX_SEQ', os.environ['CXX'])
+
+ if self.toolchain.mpi_family() == toolchain.OPENMPI:
+ # no -cc/-cxx flags supported in OpenMPI compiler wrappers
+ c_comp_cmd = 'OMPI_CC="%s" %s' % (cc_seq, mpicc)
+ cxx_comp_cmd = 'OMPI_CXX="%s" %s' % (cxx_seq, mpicxx)
+ else:
+ # -cc/-cxx should work for all MPICH-based MPIs (including Intel MPI)
+ c_comp_cmd = '%s -cc="%s"' % (mpicc, cc_seq)
+ cxx_comp_cmd = '%s -cxx="%s"' % (mpicxx, cxx_seq)
+
+ comp_vars = {
+ # specify MPI compiler wrappers and compiler commands + sequential compiler that should be used by them
+ 'cc': c_comp_cmd,
+ 'CC': cxx_comp_cmd,
+ 'cOPT': os.environ['CFLAGS'],
+ 'c++OPT': os.environ['CXXFLAGS'],
+ }
+ for wmake_rules_file in wmake_rules_files:
+ fullpath = os.path.join(self.builddir, self.openfoamdir, wmake_rules_file)
+ self.log.debug("Patching compiler variables in %s", fullpath)
+ regex_subs = []
+ for comp_var, newval in comp_vars.items():
+ regex_subs.append((r"^(%s\s*=\s*).*$" % re.escape(comp_var), r"\1%s" % newval))
+ apply_regex_substitutions(fullpath, regex_subs)
+
+ # enable verbose build for debug purposes
+ # starting with openfoam-extend 3.2, PS1 also needs to be set
+ env.setvar("FOAM_VERBOSE", '1')
+
+ # installation directory
+ env.setvar("FOAM_INST_DIR", self.installdir)
+
+ # third party directory
+ self.thrdpartydir = "ThirdParty-%s" % self.version
+ # only if third party stuff is actually installed
+ if os.path.exists(self.thrdpartydir):
+ os.symlink(os.path.join("..", self.thrdpartydir), self.thrdpartydir)
+ env.setvar("WM_THIRD_PARTY_DIR", os.path.join(self.installdir, self.thrdpartydir))
+
+ env.setvar("WM_COMPILER", self.wm_compiler)
+ env.setvar("WM_MPLIB", self.wm_mplib)
+
+ # Set Compile options according to build type
+ env.setvar("WM_COMPILE_OPTION", self.build_type)
+
+ # parallel build spec
+ env.setvar("WM_NCOMPPROCS", str(self.cfg['parallel']))
+
+ # OpenFOAM >= 3.0.0 can use 64 bit integers
+ if 'extend' not in self.name.lower() and LooseVersion(self.version) >= LooseVersion('3.0'):
+ if self.toolchain.options['i8']:
+ env.setvar("WM_LABEL_SIZE", '64')
+ else:
+ env.setvar("WM_LABEL_SIZE", '32')
+
+ # make sure lib/include dirs for dependencies are found