- Add GCC wrapper script to filter Intel compiler flags - Download missing mujoco-py generated files automatically - Update installer with comprehensive MuJoCo fixes - Document complete solution in README and EXPERIMENT_PLAN - Hopper fine-tuning validated with reward 1415.8471 - All pre-training environments working - DPPO is now production-ready on HoReKa
46 lines
1.8 KiB
Python
46 lines
1.8 KiB
Python
import os
|
|
import sysconfig
|
|
|
|
def apply_mujoco_fix():
|
|
"""Apply HoReKa Intel compiler compatibility fix for mujoco-py"""
|
|
|
|
# Override compiler settings with wrapper that filters Intel flags
|
|
wrapper_path = os.path.abspath('gcc_wrapper.sh')
|
|
os.environ['CC'] = wrapper_path
|
|
os.environ['CXX'] = '/usr/bin/g++'
|
|
os.environ['CFLAGS'] = '-std=c99 -O2 -fPIC -w'
|
|
os.environ['CXXFLAGS'] = '-std=c++11 -O2 -fPIC -w'
|
|
|
|
# Patch sysconfig to remove Intel compiler flags
|
|
if not hasattr(sysconfig, '_original_get_config_var'):
|
|
def patched_get_config_var(name):
|
|
if name in ['CFLAGS', 'BASECFLAGS', 'PY_CFLAGS', 'PY_CORE_CFLAGS', 'CCSHARED', 'OPT']:
|
|
return '-std=c99 -O2 -fPIC -w'
|
|
elif name in ['CXXFLAGS']:
|
|
return '-std=c++11 -O2 -fPIC -w'
|
|
elif name == 'CC':
|
|
return '/usr/bin/gcc'
|
|
elif name == 'CXX':
|
|
return '/usr/bin/g++'
|
|
else:
|
|
return sysconfig._original_get_config_var(name)
|
|
|
|
sysconfig._original_get_config_var = sysconfig.get_config_var
|
|
sysconfig.get_config_var = patched_get_config_var
|
|
|
|
# Also patch distutils directly
|
|
import distutils.util
|
|
import distutils.ccompiler
|
|
def patched_customize_compiler(compiler):
|
|
compiler.set_executable('compiler_so', '/usr/bin/gcc')
|
|
compiler.set_executable('compiler_cxx', '/usr/bin/g++')
|
|
compiler.set_executable('linker_so', '/usr/bin/gcc -shared')
|
|
return compiler
|
|
|
|
# Override customize_compiler function
|
|
distutils.ccompiler.customize_compiler = patched_customize_compiler
|
|
print("Applied HoReKa MuJoCo compilation fix")
|
|
|
|
if __name__ == "__main__":
|
|
apply_mujoco_fix()
|