Skip to content

Commit

Permalink
amend
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens committed Feb 5, 2025
1 parent 59a557d commit cd8079f
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 86 deletions.
3 changes: 0 additions & 3 deletions .github/unittest/windows_optdepts/scripts/post_process.sh

This file was deleted.

18 changes: 0 additions & 18 deletions .github/unittest/windows_optdepts/scripts/run_test.sh

This file was deleted.

45 changes: 0 additions & 45 deletions .github/unittest/windows_optdepts/scripts/setup_env.sh

This file was deleted.

47 changes: 41 additions & 6 deletions ...ttest/windows_optdepts/scripts/install.sh → ...test/windows_optdepts/scripts/unittest.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
#!/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.
# This script is for setting up environment in which unit test is ran.
# To speed up the CI time, the resulting environment is cached.
#
# Do not install PyTorch and torchvision here, otherwise they also get cached.

set -ex
# =================================== Setup =================================================

this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
root_dir="$(git rev-parse --show-toplevel)"
env_dir="${root_dir}/env"

cd "${root_dir}"

eval "$($(which conda) shell.bash hook)" && set -x

# Create test environment at ./env
printf "* Creating a test environment\n"
conda create --name ci -y python="$PYTHON_VERSION"

printf "* Activating the environment"
conda activate ci

printf "Python version"
echo $(which python)
echo $(python --version)
echo $(conda info -e)


python -m pip install hypothesis future cloudpickle pytest pytest-cov pytest-mock pytest-instafail pytest-rerunfailures expecttest pyyaml scipy coverage

# =================================== Install =================================================

eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
conda activate ./env

# TODO, refactor the below logic to make it easy to understand how to get correct cuda_version.
if [ "${CU_VERSION:-}" == cpu ] ; then
Expand Down Expand Up @@ -98,3 +120,16 @@ python -c """
from torchrl.data import ReplayBuffer
print('successfully imported torchrl')
"""

# =================================== Run =================================================

source "$this_dir/set_cuda_envs.sh"

# we don't use torchsnapshot
export CKPT_BACKEND=torch
export MAX_IDLE_COUNT=60
export BATCHED_PIPE_TIMEOUT=60
export LAZY_LEGACY_OP=False

python -m torch.utils.collect_env
pytest --junitxml=test-results/junit.xml -v --durations 200 --ignore test/test_distributed.py --ignore test/test_rlhf.py
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- repository: pytorch/rl
smoke-test-script: test/smoke_test.py
package-name: torchrl
name: pytorch/rl
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
with:
repository: ${{ matrix.repository }}
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/test-windows-optdepts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ permissions:

jobs:
unittests-cpu:
strategy:
matrix:
python-version:
- "3.10"
runner: ["windows.4xlarge"]
gpu-arch-type: ["cpu"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
with:
runner: "windows.4xlarge"
repository: pytorch/rl
runner: ${{ matrix.runner }}
timeout: 40
test-infra-ref: main
script: |
set -euxo pipefail
export PYTHON_VERSION="3.9"
export PYTHON_VERSION=${{ matrix.python-version }}
export CU_VERSION="cpu"
export torch_cuda="False"
Expand All @@ -48,17 +56,7 @@ jobs:
fi
export TD_GET_DEFAULTS_TO_NONE=1
## setup_env.sh
./.github/unittest/windows_optdepts/scripts/setup_env.sh
## install.sh
./.github/unittest/windows_optdepts/scripts/install.sh
## run_test.sh
./.github/unittest/windows_optdepts/scripts/run_test.sh
## post_process.sh
./.github/unittest/windows_optdepts/scripts/post_process.sh
./.github/unittest/windows_optdepts/scripts/unittest.sh
# unittests-gpu:
# uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ per-file-ignores =
examples/*.py: T201
test/opengl_rendering.py: T201
*/**/run-clang-format.py: T201
packaging/*/**.py: T201

exclude = venv
extend-select = B901, C401, C408, C409, TOR0, TOR1, TOR2
Expand Down

0 comments on commit cd8079f

Please sign in to comment.