#!/bin/bash #SBATCH --job-name=dppo_mujoco_success #SBATCH --account=hk-project-p0022232 #SBATCH --partition=dev_accelerated #SBATCH --gres=gpu:1 #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 #SBATCH --cpus-per-task=8 #SBATCH --time=00:30:00 #SBATCH --mem=24G #SBATCH --output=logs/dppo_mujoco_success_%j.out #SBATCH --error=logs/dppo_mujoco_success_%j.err # Load only CUDA module load devel/cuda/12.4 cd $SLURM_SUBMIT_DIR source .venv/bin/activate # Set MuJoCo environment first export MUJOCO_PY_MUJOCO_PATH=/home/hk-project-robolear/ys1087/.mujoco/mujoco210 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hk-project-robolear/ys1087/.mujoco/mujoco210/bin:/usr/lib/nvidia export MUJOCO_GL=egl # Clean only build cache, not generated files that need to be recreated echo "Cleaning build cache..." rm -rf .venv/lib/python3.10/site-packages/mujoco_py/.eggs/ rm -rf .venv/lib/python3.10/site-packages/mujoco_py/build/ find .venv/lib/python3.10/site-packages/mujoco_py/ -name "*.so" -delete find .venv/lib/python3.10/site-packages/mujoco_py/ -name "*.pyc" -delete # Test with sysconfig override but let mujoco-py generate what it needs echo "Testing mujoco-py with sysconfig override and proper generation..." python -c " import os import sysconfig # Override compiler settings os.environ['CC'] = '/usr/bin/gcc' 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 flags def patched_get_config_var(name): if name in ['CFLAGS', 'BASECFLAGS', 'PY_CFLAGS', 'PY_CORE_CFLAGS', 'CCSHARED']: 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: # Call original for other config vars return sysconfig._original_get_config_var(name) # Store original and apply patch sysconfig._original_get_config_var = sysconfig.get_config_var sysconfig.get_config_var = patched_get_config_var print('Testing mujoco_py import with sysconfig patch...') try: import mujoco_py print('SUCCESS: mujoco_py compiled and imported successfully with GCC override!') except Exception as e: print(f'FAILED: {e}') import traceback traceback.print_exc() "