@@ -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+
9891011def 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