Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
49 changes: 49 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,51 @@ jobs:
- store_test_results:
path: test-results

unittest_linux_jumanji_gpu:
<<: *binary_common
machine:
image: ubuntu-2004-cuda-11.4:202110-01
resource_class: gpu.nvidia.medium
environment:
image_name: "pytorch/manylinux-cuda113"
TAR_OPTIONS: --no-same-owner
PYTHON_VERSION: << parameters.python_version >>
CU_VERSION: << parameters.cu_version >>

steps:
- checkout
- designate_upload_channel
- run:
name: Generate cache key
# This will refresh cache on Sundays, nightly build should generate new cache.
command: echo "$(date +"%Y-%U")" > .circleci-weekly
- restore_cache:
keys:
- env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux_libs/scripts_jumanji/environment.yml" }}-{{ checksum ".circleci-weekly" }}
- run:
name: Setup
command: .circleci/unittest/linux_libs/scripts_jumanji/setup_env.sh
- save_cache:
key: env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux_libs/scripts_jumanji/environment.yml" }}-{{ checksum ".circleci-weekly" }}
paths:
- conda
- env
- 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_libs/scripts_jumanji/install.sh
- run:
name: Run tests
command: bash .circleci/unittest/linux_libs/scripts_jumanji/run_test.sh
- run:
name: Codecov upload
command: |
bash <(curl -s https://codecov.io/bash) -Z -F linux-jumanji
- run:
name: Post Process
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_libs/scripts_jumanji/post_process.sh
- store_test_results:
path: test-results

unittest_linux_gym_gpu:
<<: *binary_common
machine:
Expand Down Expand Up @@ -879,6 +924,10 @@ workflows:
cu_version: cu113
name: unittest_linux_habitat_gpu_py3.8
python_version: '3.8'
- unittest_linux_jumanji_gpu:
cu_version: cu113
name: unittest_linux_jumanji_gpu_py3.8
python_version: '3.8'
- unittest_linux_gym_gpu:
cu_version: cu113
name: unittest_linux_gym_gpu_py3.8
Expand Down
64 changes: 58 additions & 6 deletions .circleci/unittest/linux_examples/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,76 @@ export MKL_THREADING_LAYER=GNU

coverage run -m pytest test/smoke_test.py -v --durations 20
coverage run -m pytest test/smoke_test_deps.py -v --durations 20
coverage run -m python examples/ddpg/ddpg.py \
total_frames=14 \
coverage run examples/ddpg/ddpg.py \
total_frames=48 \
init_random_frames=10 \
batch_size=10 \
frames_per_batch=16 \
num_workers=2 \
env_per_collector=1 \
collector_devices=cuda:0 \
optim_steps_per_batch=1 \
record_video=True
coverage run -m python examples/dqn/dqn.py \
total_frames=14 \
record_video=True \
record_frames=4 \
buffer_size=120
coverage run examples/dqn/dqn.py \
total_frames=48 \
init_random_frames=10 \
batch_size=10 \
frames_per_batch=16 \
num_workers=2 \
env_per_collector=1 \
collector_devices=cuda:0 \
optim_steps_per_batch=1 \
record_video=True
record_video=True \
record_frames=4 \
buffer_size=120
coverage run examples/redq/redq.py \
total_frames=48 \
init_random_frames=10 \
batch_size=10 \
frames_per_batch=16 \
num_workers=2 \
env_per_collector=1 \
collector_devices=cuda:0 \
optim_steps_per_batch=1 \
record_video=True \
record_frames=4 \
buffer_size=120
coverage run examples/sac/sac.py \
total_frames=48 \
init_random_frames=10 \
batch_size=10 \
frames_per_batch=16 \
num_workers=2 \
env_per_collector=1 \
collector_devices=cuda:0 \
optim_steps_per_batch=1 \
record_video=True \
record_frames=4 \
buffer_size=120
coverage run examples/ppo/ppo.py \
total_frames=48 \
batch_size=10 \
frames_per_batch=16 \
num_workers=2 \
env_per_collector=1 \
collector_devices=cuda:0 \
optim_steps_per_batch=1 \
record_video=True \
record_frames=4 \
lr_scheduler=
coverage run examples/dreamer/dreamer.py \
total_frames=48 \
init_random_frames=10 \
batch_size=10 \
frames_per_batch=200 \
num_workers=2 \
env_per_collector=1 \
collector_devices=cuda:0 \
optim_steps_per_batch=1 \
record_video=True \
record_frames=4 \
buffer_size=120 \
rssm_hidden_dim=17
coverage xml -i
18 changes: 18 additions & 0 deletions .circleci/unittest/linux_libs/scripts_jumanji/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
channels:
- pytorch
- defaults
dependencies:
- pip
- pip:
- hypothesis
- future
- cloudpickle
- pytest
- pytest-cov
- pytest-mock
- pytest-instafail
- expecttest
- pyyaml
- scipy
- hydra-core
- jumanji
45 changes: 45 additions & 0 deletions .circleci/unittest/linux_libs/scripts_jumanji/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

unset PYTORCH_VERSION
# For unittest, nightly PyTorch is used as the following section,
# so no need to set PYTORCH_VERSION.
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.

set -e

eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env

if [ "${CU_VERSION:-}" == cpu ] ; then
version="cpu"
else
if [[ ${#CU_VERSION} -eq 4 ]]; then
CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}"
elif [[ ${#CU_VERSION} -eq 5 ]]; then
CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}"
fi
echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION ($CU_VERSION)"
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
fi

# submodules
git submodule sync && git submodule update --init --recursive

printf "Installing PyTorch with %s\n" "${CU_VERSION}"
if [ "${CU_VERSION:-}" == cpu ] ; then
# conda install -y pytorch torchvision cpuonly -c pytorch-nightly
# use pip to install pytorch as conda can frequently pick older release
# conda install -y pytorch cpuonly -c pytorch-nightly
pip3 install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu --force-reinstall
else
pip3 install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cu116 --force-reinstall
fi

# smoke test
python -c "import functorch"

printf "* Installing torchrl\n"
pip3 install -e .

# smoke test
python -c "import torchrl"
6 changes: 6 additions & 0 deletions .circleci/unittest/linux_libs/scripts_jumanji/post_process.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e

eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
Loading