From 4456db0db2ee27afc1793ba065cfcdf5901fe809 Mon Sep 17 00:00:00 2001 From: Rob Anderson Date: Tue, 31 Jan 2023 11:46:26 -0600 Subject: [PATCH] linux cpu unit tests --- .circleci/unittest/linux/scripts/install.sh | 2 +- .circleci/unittest/linux/scripts/setup_env.sh | 10 +++- .github/workflows/test-linux-cpu.yml | 46 +++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test-linux-cpu.yml diff --git a/.circleci/unittest/linux/scripts/install.sh b/.circleci/unittest/linux/scripts/install.sh index a7c9bb93976..d0f3f7a132e 100755 --- a/.circleci/unittest/linux/scripts/install.sh +++ b/.circleci/unittest/linux/scripts/install.sh @@ -30,7 +30,7 @@ printf "Installing PyTorch with %s\n" "${CU_VERSION}" if [ "${CU_VERSION:-}" == cpu ] ; then pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu else - pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu113 + pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/$CU_VERSION fi # smoke test diff --git a/.circleci/unittest/linux/scripts/setup_env.sh b/.circleci/unittest/linux/scripts/setup_env.sh index 00a21db6cc1..53c9017d79e 100755 --- a/.circleci/unittest/linux/scripts/setup_env.sh +++ b/.circleci/unittest/linux/scripts/setup_env.sh @@ -63,13 +63,21 @@ else fi export MUJOCO_GL=$PRIVATE_MUJOCO_GL -conda env config vars set MUJOCO_PY_MUJOCO_PATH=$root_dir/.mujoco/mujoco210 \ +if [ "${CU_VERSION:-}" == cpu ]; then + conda env config vars set MUJOCO_PY_MUJOCO_PATH=$root_dir/.mujoco/mujoco210 \ DISPLAY=unix:0.0 \ 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 \ PYOPENGL_PLATFORM=$PRIVATE_MUJOCO_GL +else + 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 \ + MUJOCO_GL=$PRIVATE_MUJOCO_GL \ + PYOPENGL_PLATFORM=$PRIVATE_MUJOCO_GL +fi # Software rendering requires GLX and OSMesa. if [ $PRIVATE_MUJOCO_GL == 'egl' ] || [ $PRIVATE_MUJOCO_GL == 'osmesa' ] ; then diff --git a/.github/workflows/test-linux-cpu.yml b/.github/workflows/test-linux-cpu.yml new file mode 100644 index 00000000000..88aca671e00 --- /dev/null +++ b/.github/workflows/test-linux-cpu.yml @@ -0,0 +1,46 @@ +name: Unit-tests on Linux CPU + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + workflow_dispatch: + +env: + CHANNEL: "nightly" + +jobs: + tests: + strategy: + matrix: + python_version: ["3.8", "3.9", "3.10"] + fail-fast: false + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main + with: + runner: linux.12xlarge + repository: pytorch/rl + timeout: 90 + script: | + # Set env vars from matrix + export PYTHON_VERSION=${{ matrix.python_version }} + export CU_VERSION="cpu" + + echo "PYTHON_VERSION: $PYTHON_VERSION" + echo "CU_VERSION: $CU_VERSION" + + cd /work + + ## setup_env.sh + ./.circleci/unittest/linux/scripts/setup_env.sh + + ## install.sh + ./.circleci/unittest/linux/scripts/install.sh + + ## run_test.sh + ./.circleci/unittest/linux/scripts/run_test.sh + + ## post_process.sh + ./.circleci/unittest/linux/scripts/post_process.sh