Skip to content

Commit 9873b2c

Browse files
committed
[CI] Fix gym rendering issues
1 parent 16b70be commit 9873b2c

File tree

5 files changed

+78
-23
lines changed

5 files changed

+78
-23
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"file_format_version" : "1.0.0",
3+
"ICD" : {
4+
"library_path" : "libEGL_nvidia.so.0"
5+
}
6+
}

.github/unittest/linux_libs/scripts_gym/run_test.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,22 @@ lib_dir="${env_dir}/lib"
1818
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib_dir
1919
export MKL_THREADING_LAYER=GNU
2020

21+
# Start Xvfb with specific OpenGL configuration
22+
export DISPLAY=:99
23+
Xvfb :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 &
24+
sleep 3 # Give Xvfb time to start
25+
26+
# Verify OpenGL/EGL setup
27+
glxinfo -B || true
28+
echo "EGL_PLATFORM=$EGL_PLATFORM"
29+
echo "MUJOCO_GL=$MUJOCO_GL"
30+
echo "PYOPENGL_PLATFORM=$PYOPENGL_PLATFORM"
31+
32+
# Run the tests
2133
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test.py -v --durations 200
2234
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test_deps.py -v --durations 200 -k 'test_gym'
2335

2436
unset LD_PRELOAD
25-
export DISPLAY=:99
26-
Xvfb :99 -screen 0 1400x900x24 > /dev/null 2>&1 &
2737
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 200 -k "gym and not isaac" --error-for-skips --mp_fork
2838
coverage combine
2939
coverage xml -i

.github/unittest/linux_libs/scripts_gym/setup_env.sh

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,28 @@
55
#
66
# Do not install PyTorch and torchvision here, otherwise they also get cached.
77

8+
unset PYTORCH_VERSION
9+
# For unittest, nightly PyTorch is used as the following section,
10+
# so no need to set PYTORCH_VERSION.
11+
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.
12+
apt-get update && apt-get install -y \
13+
git wget gcc g++ \
14+
libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev \
15+
libglvnd0 libgl1 libglx0 libegl1 libgles2 \
16+
xvfb libegl-dev libx11-dev freeglut3-dev \
17+
mesa-utils mesa-common-dev \
18+
libsdl2-dev libsdl2-2.0-0
19+
820
set -e
21+
set -v
922

1023
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
11-
# Avoid error: "fatal: unsafe repository"
12-
apt-get update && apt-get install -y git wget gcc g++
13-
apt-get install -y libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev libsdl2-dev libsdl2-2.0-0
14-
apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2 xvfb libegl-dev libx11-dev freeglut3-dev
1524

25+
# Setup EGL
26+
mkdir -p /usr/share/glvnd/egl_vendor.d
27+
cp $this_dir/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json
28+
29+
# Avoid error: "fatal: unsafe repository"
1630
git config --global --add safe.directory '*'
1731
root_dir="$(git rev-parse --show-toplevel)"
1832
conda_dir="${root_dir}/conda"
@@ -79,13 +93,15 @@ conda env config vars set \
7993
SDL_VIDEODRIVER=dummy \
8094
DISPLAY=:99 \
8195
PYOPENGL_PLATFORM=egl \
82-
LD_PRELOAD=$glew_path \
96+
__GLX_VENDOR_LIBRARY_NAME=nvidia \
97+
MESA_GL_VERSION_OVERRIDE=3.3 \
98+
EGL_PLATFORM=x11 \
99+
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/x86_64-linux-gnu/libGL.so \
83100
NVIDIA_PATH=/usr/src/nvidia-470.63.01 \
84101
MUJOCO_PY_MJKEY_PATH=${root_dir}/mujoco-py/mujoco_py/binaries/mjkey.txt \
85102
MUJOCO_PY_MUJOCO_PATH=${root_dir}/mujoco-py/mujoco_py/binaries/linux/mujoco210 \
86-
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pytorch/rl/mujoco-py/mujoco_py/binaries/linux/mujoco210/bin
103+
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pytorch/rl/mujoco-py/mujoco_py/binaries/linux/mujoco210/bin \
87104
TOKENIZERS_PARALLELISM=true
88-
# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/circleci/project/mujoco-py/mujoco_py/binaries/linux/mujoco210/bin
89105

90106
# make env variables apparent
91107
conda deactivate && conda activate "${env_dir}"

.github/unittest/linux_olddeps/scripts_gym_0_13/run_test.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pytorch/rl/mujoco-py/mujoco_py/binaries
2222
export MKL_THREADING_LAYER=GNU
2323
export BATCHED_PIPE_TIMEOUT=60
2424

25+
# Start Xvfb with specific OpenGL configuration
26+
export DISPLAY=:99
27+
Xvfb :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 &
28+
sleep 3 # Give Xvfb time to start
29+
30+
# Verify OpenGL/EGL setup
31+
glxinfo -B || true
32+
echo "EGL_PLATFORM=$EGL_PLATFORM"
33+
echo "MUJOCO_GL=$MUJOCO_GL"
34+
echo "PYOPENGL_PLATFORM=$PYOPENGL_PLATFORM"
35+
2536
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test.py -v --durations 200
2637
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test_deps.py -v --durations 200 -k 'test_gym'
2738

28-
export DISPLAY=:99
29-
Xvfb :99 -screen 0 1400x900x24 > /dev/null 2>&1 &
30-
3139
CKPT_BACKEND=torch MUJOCO_GL=egl python .github/unittest/helpers/coverage_run_parallel.py -m pytest \
3240
--instafail -v \
3341
--durations 200 \

.github/unittest/linux_olddeps/scripts_gym_0_13/setup_env.sh

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,36 @@ set -v
1111
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1212

1313
apt-get update && apt-get upgrade -y
14-
printf "* Installing vim - git - wget\n"
15-
apt-get install -y vim git wget
16-
17-
printf "* Installing glfw - glew - osmesa part 1\n"
18-
apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2 xvfb libx11-dev libegl-dev
19-
20-
#printf "* Installing glfw - glew - osmesa part 2\n"
21-
#apt-get install -y libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev libsdl2-dev libsdl2-2.0-0
14+
printf "* Installing build dependencies\n"
15+
apt-get install -y vim git wget build-essential
16+
17+
printf "* Installing OpenGL and related packages\n"
18+
apt-get install -y \
19+
libglvnd0 libgl1 libglx0 libegl1 libgles2 \
20+
xvfb libx11-dev libegl-dev \
21+
libglfw3 libgl1-mesa-glx libosmesa6 \
22+
libglew-dev libglew2.1 \
23+
mesa-utils mesa-common-dev \
24+
libgl1-mesa-dev libglu1-mesa-dev \
25+
libsdl2-dev libsdl2-2.0-0
2226

2327
if [ "${CU_VERSION:-}" == cpu ] ; then
2428
# solves version `GLIBCXX_3.4.29' not found for tensorboard
25-
# apt-get install -y gcc-4.9
2629
apt-get upgrade -y libstdc++6
2730
apt-get dist-upgrade -y
2831
else
2932
apt-get install -y g++ gcc
3033
fi
3134

35+
# Setup EGL
36+
mkdir -p /usr/share/glvnd/egl_vendor.d
37+
echo '{
38+
"file_format_version" : "1.0.0",
39+
"ICD" : {
40+
"library_path" : "libEGL_nvidia.so.0"
41+
}
42+
}' > /usr/share/glvnd/egl_vendor.d/10_nvidia.json
43+
3244
git config --global --add safe.directory '*'
3345
root_dir="$(git rev-parse --show-toplevel)"
3446
conda_dir="${root_dir}/conda"
@@ -98,9 +110,12 @@ conda env config vars set \
98110
MAX_IDLE_COUNT=1000 \
99111
MUJOCO_GL=egl \
100112
SDL_VIDEODRIVER=dummy \
101-
DISPLAY=unix:0.0 \
113+
DISPLAY=:99 \
102114
PYOPENGL_PLATFORM=egl \
103-
LD_PRELOAD=$glew_path \
115+
__GLX_VENDOR_LIBRARY_NAME=nvidia \
116+
MESA_GL_VERSION_OVERRIDE=3.3 \
117+
EGL_PLATFORM=x11 \
118+
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/x86_64-linux-gnu/libGL.so \
104119
NVIDIA_PATH=/usr/src/nvidia-470.63.01 \
105120
MUJOCO_PY_MJKEY_PATH=${root_dir}/mujoco-py/mujoco_py/binaries/mjkey.txt \
106121
MUJOCO_PY_MUJOCO_PATH=${root_dir}/mujoco-py/mujoco_py/binaries/linux/mujoco210 \

0 commit comments

Comments
 (0)