Skip to content

Commit c17ac36

Browse files
authored
Merge branch 'main' into site_toolchain_error
2 parents d051c02 + 5b9657a commit c17ac36

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

eb_hooks.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,28 @@ def pre_prepare_hook_llvm_a64fx(self, *args, **kwargs):
986986
update_build_option('optarch', 'march=armv8.2-a')
987987

988988

989+
def pre_prepare_hook_pytorch(self, *args, **kwargs):
990+
"""
991+
Solve PyTorch test failures due to:
992+
cannot enable executable stack as shared object requires: Invalid argument
993+
994+
Glibc prevents loading of shared libraries with an executable stack.
995+
We can work around it by reverting to old behavior by setting glibc.rtld.execstack=2,
996+
which forces the stack to be executable at process startup.
997+
See:
998+
https://github.com/ValveSoftware/Source-1-Games/issues/6982
999+
https://gitlab.archlinux.org/archlinux/packaging/packages/glibc/-/issues/19
1000+
https://sourceware.org/bugzilla/show_bug.cgi?id=32653
1001+
"""
1002+
if self.name == 'PyTorch':
1003+
if self.version in ['2.6.0', '2.7.1', '2.9.1']:
1004+
eessi_version = get_eessi_envvar('EESSI_VERSION')
1005+
if eessi_version == '2025.06':
1006+
os.environ['GLIBC_TUNABLES'] = 'glibc.rtld.execstack=2'
1007+
else:
1008+
raise EasyBuildError("PyTorch-specific hook triggered for non-PyTorch easyconfig?!")
1009+
1010+
9891011
def post_prepare_hook_llvm_a64fx(self, *args, **kwargs):
9901012
"""
9911013
Post-prepare hook for LLVM 14 and 15 on A64FX to reset optarch build option.
@@ -1912,6 +1934,7 @@ def post_easyblock_hook(self, *args, **kwargs):
19121934
'cuDNN': pre_prepare_hook_cudnn,
19131935
'Highway': pre_prepare_hook_highway_handle_test_compilation_issues,
19141936
'LLVM': pre_prepare_hook_llvm_a64fx,
1937+
'PyTorch': pre_prepare_hook_pytorch,
19151938
'Rust': pre_prepare_hook_llvm_a64fx,
19161939
}
19171940

0 commit comments

Comments
 (0)