Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a816d0c
update linux setup_env to include libosmesa6 and libgl1-mesa-glx
Aug 3, 2022
b714c34
try just apt
Aug 3, 2022
a77c0b5
try yum
Aug 3, 2022
3424edd
try yum again
Aug 3, 2022
7aabc85
well it is functorch now
Aug 3, 2022
f7692ee
remove install from git
Aug 3, 2022
7ca29dc
Merge branch 'main' into TT_circleci
Aug 3, 2022
567c00f
remove
Aug 3, 2022
2f131c9
revert format
Aug 3, 2022
69f436c
remove conda install
Aug 3, 2022
8d99c5d
should be good
Aug 3, 2022
0aaba3f
remove xml
Aug 3, 2022
8e2ae9a
save setup
Aug 3, 2022
c98d40d
git merge
Aug 3, 2022
d0dd7bb
try fix openGL version
Aug 3, 2022
2901caa
for GPU tests?
Aug 3, 2022
d5dbde9
revert
Aug 3, 2022
b6a26df
try again
Aug 4, 2022
76253a8
try again
Aug 4, 2022
cdbeb14
try again
Aug 4, 2022
06a9e1c
try again
Aug 4, 2022
d6a8f4e
try again
Aug 4, 2022
a672c38
try again
Aug 4, 2022
f436505
update pyopenGL platform
Aug 4, 2022
35ccfaf
check env vars
Aug 4, 2022
cbaa2c9
check mesa
Aug 4, 2022
93fb291
ld path
Aug 4, 2022
7f27626
init
vmoens Aug 5, 2022
9e777b8
amend
vmoens Aug 5, 2022
565532e
amend
vmoens Aug 5, 2022
41ff129
amend
vmoens Aug 5, 2022
1024a02
amend
vmoens Aug 5, 2022
09bb294
amend
vmoens Aug 5, 2022
4cddd6e
amend
vmoens Aug 5, 2022
650afc1
amend
vmoens Aug 5, 2022
0fb5793
amend
vmoens Aug 5, 2022
2c2d5e4
amend
vmoens Aug 5, 2022
f10e164
LIBRARY_PATH
vmoens Aug 5, 2022
47d3a32
__CONDA_SHLVL_1_DISPLAY and __CONDA_SHLVL_1_LD_LIBRARY_PATH
vmoens Aug 5, 2022
2dc443c
amend
vmoens Aug 6, 2022
7c692ce
amend
vmoens Aug 6, 2022
74af44c
amend
vmoens Aug 6, 2022
ea07ec9
amend
vmoens Aug 6, 2022
5eda0d0
amend
vmoens Aug 6, 2022
4d551ae
amend
vmoens Aug 6, 2022
018e9d3
amend
vmoens Aug 6, 2022
86a0b1e
amend
vmoens Aug 6, 2022
b678d01
amend
vmoens Aug 6, 2022
219f87a
amend
vmoens Aug 6, 2022
a72d88b
amend
vmoens Aug 6, 2022
d4da7c4
amend
vmoens Aug 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 35 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,22 @@ jobs:
paths:
- conda
- env
- run:
# Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# They're available in all the other workflows (OSX and Windows).
# But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
name: export CIRCLECI env var
command: echo "CIRCLECI=true" >> ./env.list
# - run:
# # Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# # Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# # They're available in all the other workflows (OSX and Windows).
# # But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# # So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
# name: export CIRCLECI env var
# command: echo "CIRCLECI=true" >> ./env.list
- run:
name: Install torchrl
# command: bash .circleci/unittest/linux/scripts/install.sh
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
- run:
name: Run tests
command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
command: bash .circleci/unittest/linux/scripts/run_test.sh
# command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
- run:
name: Post Process
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/post_process.sh
Expand Down Expand Up @@ -368,20 +370,22 @@ jobs:
paths:
- conda
- env
- run:
# Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# They're available in all the other workflows (OSX and Windows).
# But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
name: export CIRCLECI env var
command: echo "CIRCLECI=true" >> ./env.list
# - run:
# # Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# # Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# # They're available in all the other workflows (OSX and Windows).
# # But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# # So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
# name: export CIRCLECI env var
# command: echo "CIRCLECI=true" >> ./env.list
- run:
name: Install torchrl
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_optdeps/scripts/install.sh
# command: bash .circleci/unittest/linux_optdeps/scripts/install.sh
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
- run:
name: Run tests
command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_optdeps/scripts/run_test.sh
command: bash .circleci/unittest/linux_optdeps/scripts/run_test.sh
# command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
- run:
name: Post Process
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_optdeps/scripts/post_process.sh
Expand Down Expand Up @@ -468,20 +472,22 @@ jobs:
paths:
- conda
- env
- run:
# Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# They're availble in all the other workflows (OSX and Windows).
# But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
name: export CIRCLECI env var
command: echo "CIRCLECI=true" >> ./env.list
# - run:
# # Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# # Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# # They're available in all the other workflows (OSX and Windows).
# # But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# # So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
# name: export CIRCLECI env var
# command: echo "CIRCLECI=true" >> ./env.list
- run:
name: Install torchrl
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_stable/scripts/install.sh
# command: bash .circleci/unittest/linux_stable/scripts/install.sh
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
- run:
name: Run tests
command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_stable/scripts/run_test.sh
command: bash .circleci/unittest/linux_stable/scripts/run_test.sh
# command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
- run:
name: Post Process
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_stable/scripts/post_process.sh
Expand Down
21 changes: 17 additions & 4 deletions .circleci/unittest/linux/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ printf "* Installing dependencies (except PyTorch)\n"
echo " - python=${PYTHON_VERSION}" >> "${this_dir}/environment.yml"
cat "${this_dir}/environment.yml"


if [[ $OSTYPE == 'darwin'* ]]; then
PRIVATE_MUJOCO_GL=glfw
else
conda install -y -c conda-forge mesa
conda install -y -c conda-forge mesalib
elif [ "${CU_VERSION:-}" == cpu ]; then
PRIVATE_MUJOCO_GL=osmesa
else
PRIVATE_MUJOCO_GL=egl
fi

export MUJOCO_GL=$PRIVATE_MUJOCO_GL
Expand All @@ -67,6 +68,18 @@ conda env config vars set MUJOCO_PY_MUJOCO_PATH=$root_dir/.mujoco/mujoco210 \
MJLIB_PATH=$root_dir/.mujoco/mujoco-2.1.1/lib/libmujoco.so.2.1.1 \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$root_dir/.mujoco/mujoco210/bin \
SDL_VIDEODRIVER=dummy \
MUJOCO_GL=$PRIVATE_MUJOCO_GL
MUJOCO_GL=$PRIVATE_MUJOCO_GL \
PYOPENGL_PLATFORM=$PRIVATE_MUJOCO_GL

# Software rendering requires GLX and OSMesa.
if [ $PRIVATE_MUJOCO_GL == 'egl' ] || [ $PRIVATE_MUJOCO_GL == 'osmesa' ] ; then
yum makecache
yum install -y glfw
yum install -y glew
yum install -y mesa-libGL
yum install -y mesa-libOSMesa-devel
yum -y install egl-utils
yum -y install freeglut
fi

conda env update --file "${this_dir}/environment.yml" --prune
22 changes: 17 additions & 5 deletions .circleci/unittest/linux_stable/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ conda activate "${env_dir}"

# 3. Install mujoco
printf "* Installing mujoco and related\n"
mkdir $root_dir/.mujoco
mkdir -p $root_dir/.mujoco
cd $root_dir/.mujoco/
wget https://github.com/deepmind/mujoco/releases/download/2.1.1/mujoco-2.1.1-linux-x86_64.tar.gz
tar -xf mujoco-2.1.1-linux-x86_64.tar.gz
Expand All @@ -56,10 +56,10 @@ cat "${this_dir}/environment.yml"

if [[ $OSTYPE == 'darwin'* ]]; then
PRIVATE_MUJOCO_GL=glfw
else
conda install -y -c conda-forge mesa
conda install -y -c conda-forge mesalib
elif [ "${CU_VERSION:-}" == cpu ]; then
PRIVATE_MUJOCO_GL=osmesa
else
PRIVATE_MUJOCO_GL=egl
fi

export MUJOCO_GL=$PRIVATE_MUJOCO_GL
Expand All @@ -68,6 +68,18 @@ conda env config vars set MUJOCO_PY_MUJOCO_PATH=$root_dir/.mujoco/mujoco210 \
MJLIB_PATH=$root_dir/.mujoco/mujoco-2.1.1/lib/libmujoco.so.2.1.1 \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$root_dir/.mujoco/mujoco210/bin \
SDL_VIDEODRIVER=dummy \
MUJOCO_GL=$PRIVATE_MUJOCO_GL
MUJOCO_GL=$PRIVATE_MUJOCO_GL \
PYOPENGL_PLATFORM=$PRIVATE_MUJOCO_GL

# Software rendering requires GLX and OSMesa.
if [ $PRIVATE_MUJOCO_GL == 'egl' ] || [ $PRIVATE_MUJOCO_GL == 'osmesa' ] ; then
yum makecache
yum install -y glfw
yum install -y glew
yum install -y mesa-libGL
yum install -y mesa-libOSMesa-devel
yum -y install egl-utils
yum -y install freeglut
fi

conda env update --file "${this_dir}/environment.yml" --prune
55 changes: 26 additions & 29 deletions test/test_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_gym(env_name, frame_skip, from_pixels, pixels_only):


@pytest.mark.skipif(not _has_dmc, reason="no dm_control library found")
@pytest.mark.parametrize("env_name,task", [["cheetah", "run"], ["humanoid", "walk"]])
@pytest.mark.parametrize("env_name,task", [["cheetah", "run"]])
@pytest.mark.parametrize("frame_skip", [1, 3])
@pytest.mark.parametrize(
"from_pixels,pixels_only",
Expand All @@ -118,35 +118,32 @@ def test_gym(env_name, frame_skip, from_pixels, pixels_only):
def test_dmcontrol(env_name, task, frame_skip, from_pixels, pixels_only):
if from_pixels and (not torch.has_cuda or not torch.cuda.device_count()):
raise pytest.skip("no cuda device")
env0 = DMControlEnv(
env_name,
task,
frame_skip=frame_skip,
from_pixels=from_pixels,
pixels_only=pixels_only,
)
torch.manual_seed(0)
np.random.seed(0)
final_seed0 = env0.set_seed(0)
tdreset0 = env0.reset()
rollout0 = env0.rollout(max_steps=50)
env0.close()
del env0

env1 = DMControlEnv(
env_name,
task,
frame_skip=frame_skip,
from_pixels=from_pixels,
pixels_only=pixels_only,
)
torch.manual_seed(0)
np.random.seed(0)
final_seed1 = env1.set_seed(0)
tdreset1 = env1.reset()
rollout1 = env1.rollout(max_steps=50)
env1.close()
del env1
tds = []
tds_reset = []
final_seed = []
for i in range(2):
env0 = DMControlEnv(
env_name,
task,
frame_skip=frame_skip,
from_pixels=from_pixels,
pixels_only=pixels_only,
)
torch.manual_seed(0)
np.random.seed(0)
final_seed0 = env0.set_seed(0)
tdreset0 = env0.reset()
rollout0 = env0.rollout(max_steps=50)
env0.close()
del env0
tds_reset.append(tdreset0)
tds.append(rollout0)
final_seed.append(final_seed0)

tdreset1, tdreset0 = tds_reset
rollout0, rollout1 = tds
final_seed0, final_seed1 = final_seed

assert_allclose_td(tdreset1, tdreset0)
assert final_seed0 == final_seed1
Expand Down