From cc9a6406c41e5a9dc953c9929277b8e1f7c8ca88 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Thu, 23 May 2024 11:20:50 +0200 Subject: [PATCH 1/9] Add PyTorch-Bundle for 2023a for CPU --- .../software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml index e65747e4a5..7610ad35c6 100644 --- a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml +++ b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml @@ -4,3 +4,6 @@ easyconfigs: - R-bundle-Bioconductor-3.18-foss-2023a-R-4.3.2.eb: options: from-pr: 20379 + - PyTorch-bundle-2.1.2-foss-2023a.eb: + options: + from-commit: 7124863ed588066e5a988b4073d91381497a7f64 From ca08b19040ef9ae2c057ef77fde1127905d19bd0 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Thu, 23 May 2024 13:45:08 +0200 Subject: [PATCH 2/9] Switch to from-pr --- .../software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml index 7610ad35c6..1b33b52b5a 100644 --- a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml +++ b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml @@ -6,4 +6,4 @@ easyconfigs: from-pr: 20379 - PyTorch-bundle-2.1.2-foss-2023a.eb: options: - from-commit: 7124863ed588066e5a988b4073d91381497a7f64 + from-pr: 20382 From 1183a5de62bb56af8961c70a2ade749a6af98759 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Thu, 8 Aug 2024 15:31:50 +0200 Subject: [PATCH 3/9] Build with eb 4.9.2 instead to get the updated EasyBlock from PR 3322 --- .../software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml | 3 --- .../software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023a.yml | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml index a4fd4c583a..27c18a487e 100644 --- a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml +++ b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml @@ -22,6 +22,3 @@ easyconfigs: from-pr: 20784 - Valgrind-3.21.0-gompi-2023a.eb - OrthoFinder-2.5.5-foss-2023a.eb - - PyTorch-bundle-2.1.2-foss-2023a.eb: - options: - from-pr: 20382 diff --git a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023a.yml b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023a.yml index d405d17193..5c65d8b2e8 100644 --- a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023a.yml +++ b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023a.yml @@ -27,3 +27,4 @@ easyconfigs: # see https://github.com/easybuilders/easybuild-easyconfigs/pull/20951 from-commit: a92667fe32396bbd4106243658625f7ff2adcd68 - amdahl-0.3.1-gompi-2023a.eb + - PyTorch-bundle-2.1.2-foss-2023a.eb From db513cade338a496ef87acf9070b36311bcaefdb Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Wed, 21 Aug 2024 21:58:49 +0200 Subject: [PATCH 4/9] Workaround for the libtcmalloc_minimal.so.4: cannot allocate memory in static TLS block error --- eb_hooks.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index 73e1ff7df6..7cff05a605 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -725,6 +725,31 @@ def post_sanitycheck_cuda(self, *args, **kwargs): raise EasyBuildError("CUDA-specific hook triggered for non-CUDA easyconfig?!") +def pre_module_hook(self,*args, **kwargs): + """Main pre-module hook: trigger custom functions based on software name.""" + if self.name in PRE_MODULE_HOOKS: + PRE_MODULE_HOOKS[self.name](self, *args, **kwargs) + + +def pre_module_sentencepiece(self, *args, **kwargs): + """ + LD_PRELOAD `libtcmalloc_minimal.so.4` on AARCH64-based systems + Avoids "libtcmalloc_minimal.so.4: cannot allocate memory in static TLS block" error + See https://github.com/EESSI/software-layer/pull/585/#issuecomment-2286068465 + """ + if self.name == "SentencePiece": + # We want to set LD_PRELOAD so that it loads the libtcmalloc_minimal.so library from gperftools + # However, if LD_PRELOAD is already set, we need to prepend to it. + # An existing LD_PRELOAD can be space or colon separated, both are allowed + # So first we make sure it is colon seperated + # Colon seperation is allowed for LD_PRELOAD, so the easiest way to prepend to whats there + # is to specify it through modextrapaths + self.cfg['modluafooter'] = """ +libtcmalloc = pathJoin(os.getenv("EBROOTGPERFTOOLS"), "lib64", "libtcmalloc_minimal.so") +prepend_path("LD_PRELOAD", libtcmalloc) +""" + + def inject_gpu_property(ec): """ Add 'gpu' property, via modluafooter easyconfig parameter @@ -807,3 +832,7 @@ def inject_gpu_property(ec): POST_SANITYCHECK_HOOKS = { 'CUDA': post_sanitycheck_cuda, } + +PRE_MODULE_HOOKS = { + 'SentencePiece': pre_module_sentencepiece, +} From 3d72e348b598e86efbca5e8fe94de37b6c0d93e5 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Wed, 21 Aug 2024 22:06:29 +0200 Subject: [PATCH 5/9] Only apply workaround for AARCH64, since it's only a problem there --- eb_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eb_hooks.py b/eb_hooks.py index 7cff05a605..f1366b632a 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -737,7 +737,7 @@ def pre_module_sentencepiece(self, *args, **kwargs): Avoids "libtcmalloc_minimal.so.4: cannot allocate memory in static TLS block" error See https://github.com/EESSI/software-layer/pull/585/#issuecomment-2286068465 """ - if self.name == "SentencePiece": + if self.name == "SentencePiece" and get_cpu_architecture() == AARCH64: # We want to set LD_PRELOAD so that it loads the libtcmalloc_minimal.so library from gperftools # However, if LD_PRELOAD is already set, we need to prepend to it. # An existing LD_PRELOAD can be space or colon separated, both are allowed From a777e47d20a7d130e0c2612bed9429fa8376e6a3 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Thu, 22 Aug 2024 16:10:40 +0200 Subject: [PATCH 6/9] Make sure hook gets applied before the sanity check step, so that libtcmalloc is also LD_PRELOADed in this step --- eb_hooks.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/eb_hooks.py b/eb_hooks.py index f1366b632a..2acb36eab8 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -725,18 +725,19 @@ def post_sanitycheck_cuda(self, *args, **kwargs): raise EasyBuildError("CUDA-specific hook triggered for non-CUDA easyconfig?!") -def pre_module_hook(self,*args, **kwargs): - """Main pre-module hook: trigger custom functions based on software name.""" - if self.name in PRE_MODULE_HOOKS: - PRE_MODULE_HOOKS[self.name](self, *args, **kwargs) +def pre_sanitycheck_hook(self,*args, **kwargs): + """Main pre-sanitycheck hook: trigger custom functions based on software name.""" + if self.name in PRE_SANITYCHECK_HOOKS: + PRE_SANITYCHECK_HOOKS[self.name](self, *args, **kwargs) -def pre_module_sentencepiece(self, *args, **kwargs): +def pre_sanitycheck_sentencepiece(self, *args, **kwargs): """ LD_PRELOAD `libtcmalloc_minimal.so.4` on AARCH64-based systems Avoids "libtcmalloc_minimal.so.4: cannot allocate memory in static TLS block" error See https://github.com/EESSI/software-layer/pull/585/#issuecomment-2286068465 """ + print("APPLYING HOOK") if self.name == "SentencePiece" and get_cpu_architecture() == AARCH64: # We want to set LD_PRELOAD so that it loads the libtcmalloc_minimal.so library from gperftools # However, if LD_PRELOAD is already set, we need to prepend to it. @@ -829,10 +830,10 @@ def inject_gpu_property(ec): 'numpy': post_single_extension_numpy, } -POST_SANITYCHECK_HOOKS = { - 'CUDA': post_sanitycheck_cuda, +PRE_SANITYCHECK_HOOKS = { + 'SentencePiece': pre_sanitycheck_sentencepiece, } -PRE_MODULE_HOOKS = { - 'SentencePiece': pre_module_sentencepiece, +POST_SANITYCHECK_HOOKS = { + 'CUDA': post_sanitycheck_cuda, } From 71679c7382d0bb4292e0c942b8d45d5e0bada145 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Tue, 27 Aug 2024 11:29:26 +0200 Subject: [PATCH 7/9] Take out debugging print statement --- eb_hooks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/eb_hooks.py b/eb_hooks.py index 2acb36eab8..dc4bf54f84 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -737,7 +737,6 @@ def pre_sanitycheck_sentencepiece(self, *args, **kwargs): Avoids "libtcmalloc_minimal.so.4: cannot allocate memory in static TLS block" error See https://github.com/EESSI/software-layer/pull/585/#issuecomment-2286068465 """ - print("APPLYING HOOK") if self.name == "SentencePiece" and get_cpu_architecture() == AARCH64: # We want to set LD_PRELOAD so that it loads the libtcmalloc_minimal.so library from gperftools # However, if LD_PRELOAD is already set, we need to prepend to it. From 4febd91daa371ed2b7d2c0587648ac86e97f35f8 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Tue, 3 Sep 2024 15:58:56 +0200 Subject: [PATCH 8/9] Add newer ReFrame to fix https://github.com/EESSI/software-layer/pull/585#issuecomment-2304940917 (along with https://github.com/EESSI/software-layer/pull/682) --- .../2023.06/eessi-2023.06-eb-4.9.2-2023b.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml index 883483f5d2..f4dd7f0e75 100644 --- a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml +++ b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml @@ -1,5 +1,9 @@ easyconfigs: - IPython-8.17.2-GCCcore-13.2.0.eb + - ReFrame-4.6.2-GCCcore-13.2.0.eb: + options: + # See https://github.com/easybuilders/easybuild-easyconfigs/pull/21269 + from-commit: 230fae37daf35b286392aba7b9f0592b516517d1 - dlb-3.4-gompi-2023b.eb - pystencils-1.3.4-gfbf-2023b.eb: options: From 0390ccf51cc5069fc7176ffc5817fb8a5b59b9b1 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Tue, 17 Sep 2024 22:54:28 +0200 Subject: [PATCH 9/9] Remove ReFrame again, as we add it in a seperate PR --- .../2023.06/eessi-2023.06-eb-4.9.2-2023b.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml index f4dd7f0e75..883483f5d2 100644 --- a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml +++ b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-2023b.yml @@ -1,9 +1,5 @@ easyconfigs: - IPython-8.17.2-GCCcore-13.2.0.eb - - ReFrame-4.6.2-GCCcore-13.2.0.eb: - options: - # See https://github.com/easybuilders/easybuild-easyconfigs/pull/21269 - from-commit: 230fae37daf35b286392aba7b9f0592b516517d1 - dlb-3.4-gompi-2023b.eb - pystencils-1.3.4-gfbf-2023b.eb: options: