Thanks to visit codestin.com
Credit goes to github.com

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
4 changes: 0 additions & 4 deletions .github/scripts/pre-build-script-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
pip install --upgrade setuptools

export TORCHRL_BUILD_VERSION=0.8.0

${CONDA_RUN} pip install "pybind11[global]"
${CONDA_RUN} conda install anaconda::cmake -y
${CONDA_RUN} pip install git+https://github.com/pytorch/tensordict.git -U
19 changes: 5 additions & 14 deletions .github/scripts/td_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,20 @@ ARCH=${ARCH:-} # This sets ARCH to an empty string if it's not defined
if pip list | grep -q torch; then
echo "Torch is installed."

${CONDA_RUN} pip install "pybind11[global]"
# ${CONDA_RUN} conda install 'anaconda::cmake>=3.22' -y

if conda list cmake | grep -q 'cmake'; then
echo "CMake is already installed."
else
echo "CMake is not installed. Installing now..."
${CONDA_RUN} conda install anaconda::cmake -y --no-update-deps
fi
${CONDA_RUN} pip install "pybind11[global]"

${CONDA_RUN} pip install git+https://github.com/pytorch/tensordict.git -U --no-deps
elif [[ -n "${SMOKE_TEST_SCRIPT:-}" ]]; then
${CONDA_RUN} ${PIP_INSTALL_TORCH}
# TODO: revert when nightlies of tensordict are fixed
# if [[ "$ARCH" == "aarch64" ]]; then

${CONDA_RUN} pip install "pybind11[global]"

if conda list cmake | grep -q 'cmake'; then
echo "CMake is already installed."
else
echo "CMake is not installed. Installing now..."
${CONDA_RUN} conda install anaconda::cmake -y --no-update-deps
fi
# ${CONDA_RUN} conda install 'anaconda::cmake>=3.22' -y

${CONDA_RUN} pip install "pybind11[global]"

${CONDA_RUN} pip install git+https://github.com/pytorch/tensordict.git -U --no-deps
else
Expand Down
5 changes: 2 additions & 3 deletions .github/unittest/linux_libs/scripts_gym/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
apt-get update && apt-get install -y git wget gcc g++

apt-get install -y libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev libsdl2-dev libsdl2-2.0-0
apt-get install -y libegl-dev libegl
apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2 xvfb
apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2 xvfb libegl-dev libx11-dev freeglut3-dev

git config --global --add safe.directory '*'
root_dir="$(git rev-parse --show-toplevel)"
Expand Down Expand Up @@ -92,7 +91,7 @@ conda env config vars set \
# make env variables apparent
conda deactivate && conda activate "${env_dir}"

pip install pip --upgrade
# pip install pip --upgrade

conda env update --file "${this_dir}/environment.yml" --prune
#conda install -c conda-forge fltk -y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ channels:
- pytorch
- defaults
dependencies:
- pip<25.0
- pip
- protobuf
- pip:
- hypothesis
Expand Down
8 changes: 4 additions & 4 deletions .github/unittest/linux_olddeps/scripts_gym_0_13/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ printf "* Installing vim - git - wget\n"
apt-get install -y vim git wget

printf "* Installing glfw - glew - osmesa part 1\n"
apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2 xvfb
apt-get install -y libglvnd0 libgl1 libglx0 libegl1 libgles2 xvfb libx11-dev libegl-dev

#printf "* Installing glfw - glew - osmesa part 2\n"
#apt-get install -y libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev libsdl2-dev libsdl2-2.0-0

printf "* Installing glfw - glew - osmesa part 2\n"
apt-get install -y libglfw3 libgl1-mesa-glx libosmesa6 libglew-dev libsdl2-dev libsdl2-2.0-0 libegl-dev libx11-dev
#
if [ "${CU_VERSION:-}" == cpu ] ; then
# solves version `GLIBCXX_3.4.29' not found for tensorboard
# apt-get install -y gcc-4.9
Expand Down
1 change: 0 additions & 1 deletion .github/unittest/windows_optdepts/scripts/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies:
- pytest-instafail
- pytest-rerunfailures
- expecttest
- pybind11[global]
- pyyaml
- scipy
- coverage
9 changes: 5 additions & 4 deletions .github/unittest/windows_optdepts/scripts/unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ fi

# install tensordict
if [[ "$RELEASE" == 0 ]]; then
git clone https://github.com/pytorch/tensordict
cd tensordict
python setup.py develop
cd ..
conda install anaconda::cmake -y

python -m pip install "pybind11[global]"

python -m pip install git+https://github.com/pytorch/tensordict
else
pip3 install tensordict
fi
Expand Down
58 changes: 48 additions & 10 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ jobs:

benchmark_cpu:
name: CPU Pytest benchmark
runs-on: ubuntu-20.04
runs-on: linux.g5.4xlarge.nvidia.cpu
defaults:
run:
shell: bash -l {0}
container:
image: nvidia/cuda:12.3.0-base-ubuntu22.04
options: --cpus all
steps:
- name: Who triggered this?
run: |
echo "Action triggered by ${{ github.event.pull_request.html_url }}"
- name: Check ldd --version
run: ldd --version
- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -38,24 +46,54 @@ jobs:
python-version: '3.10'
- name: Setup Environment
run: |
python3.10 -m venv ./py310
export TZ=Europe/London
export DEBIAN_FRONTEND=noninteractive # tzdata bug
apt-get update -y
apt-get install software-properties-common cmake -y
add-apt-repository ppa:git-core/candidate -y
apt-get update -y
apt-get upgrade -y
apt-get -y install libglu1-mesa libgl1-mesa-glx libosmesa6 gcc curl g++ unzip wget libglfw3-dev libgles2-mesa-dev libglew-dev sudo git cmake libz-dev libpython3.10-dev
- name: Setup git
run: git config --global --add safe.directory /__w/rl/rl
- name: setup Path
run: |
echo /usr/local/bin >> $GITHUB_PATH
- name: Setup benchmarks
run: |
echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
- name: Run
run: |
python3.10 -m venv --system-site-packages ./py310
source ./py310/bin/activate
export PYTHON_INCLUDE_DIR=/usr/include/python3.10

python3 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
python3 -m pip install git+https://github.com/pytorch/tensordict
python3 setup.py develop
python3 -m pip install pytest pytest-benchmark
python3 -m pip install "gym[accept-rom-license,atari]"
python3 -m pip install "dm_control" "mujoco"
python3.10 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128 -U
python3.10 -m pip install ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
python3 -m pip install "pybind11[global]"
python3.10 -m pip install git+https://github.com/pytorch/tensordict
python3.10 setup.py develop

# test import
python3 -c """import torch
assert torch.cuda.device_count()
"""

cd benchmarks/
export TORCHDYNAMO_INLINE_INBUILT_NN_MODULES=1
export COMPOSITE_LP_AGGREGATE=0
export CUDA_VISIBLE_DEVICES=
export TD_GET_DEFAULTS_TO_NONE=1
python3 -m pytest -vvv --rank 0 --benchmark-json output.json --ignore test_collectors_benchmark.py
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
env:
GIT_WORK_TREE: /__w/rl/rl
with:
name: CPU Benchmark Results
tool: 'pytest'
Expand All @@ -68,7 +106,6 @@ jobs:
gh-pages-branch: gh-pages
auto-push: true


benchmark_gpu:
name: GPU Pytest benchmark
runs-on: linux.g5.4xlarge.nvidia.gpu
Expand Down Expand Up @@ -121,7 +158,8 @@ jobs:
export PYTHON_INCLUDE_DIR=/usr/include/python3.10

python3.10 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128 -U
python3.10 -m pip install cmake ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
python3.10 -m pip install ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
python3 -m pip install "pybind11[global]"
python3.10 -m pip install git+https://github.com/pytorch/tensordict
python3.10 setup.py develop

Expand Down
66 changes: 55 additions & 11 deletions .github/workflows/benchmarks_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,30 @@ jobs:

benchmark_cpu:
name: CPU Pytest benchmark
runs-on: ubuntu-20.04
runs-on: linux.g5.4xlarge.nvidia.cpu
defaults:
run:
shell: bash -l {0}
container:
image: nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
options: --cpus all
steps:
- name: Set GITHUB_BRANCH environment variable
run: |
if [ "${{ github.event_name }}" == "push" ]; then
export GITHUB_BRANCH=${{ github.event.branch }}
elif [ "${{ github.event_name }}" == "pull_request" ]; then
export GITHUB_BRANCH=${{ github.event.pull_request.head.ref }}
else
echo "Unsupported event type"
exit 1
fi
echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV
- name: Who triggered this?
run: |
echo "Action triggered by ${{ github.event.pull_request.html_url }}"
- name: Check ldd --version
run: ldd --version
- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -27,28 +46,50 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Setup Environment
run: |
export TZ=Europe/London
export DEBIAN_FRONTEND=noninteractive # tzdata bug
apt-get update -y
apt-get install software-properties-common cmake -y
add-apt-repository ppa:git-core/candidate -y
apt-get update -y
apt-get upgrade -y
apt-get -y install libglu1-mesa libgl1-mesa-glx libosmesa6 gcc curl g++ unzip wget libglfw3-dev libgles2-mesa-dev libglew-dev sudo git cmake libz-dev libpython3.10-dev
- name: Setup git
run: git config --global --add safe.directory /__w/rl/rl
- name: setup Path
run: |
echo /usr/local/bin >> $GITHUB_PATH
- name: Setup benchmarks
run: |
echo "BASE_SHA=$(echo ${{ github.event.pull_request.base.sha }} | cut -c1-8)" >> $GITHUB_ENV
echo "HEAD_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_ENV
echo "BASELINE_JSON=$(mktemp)" >> $GITHUB_ENV
echo "CONTENDER_JSON=$(mktemp)" >> $GITHUB_ENV
echo "PR_COMMENT=$(mktemp)" >> $GITHUB_ENV
- name: Setup Environment and tests
- name: Run
run: |
python3.10 -m venv ./py310
python3.10 -m venv --system-site-packages ./py310
source ./py310/bin/activate
export PYTHON_INCLUDE_DIR=/usr/include/python3.10

python3.10 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128 -U
python3.10 -m pip install ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
python3.10 -m pip install "pybind11[global]"
python3.10 -m pip install git+https://github.com/pytorch/tensordict
python3.10 setup.py develop
# python3.10 -m pip install git+https://github.com/pytorch/rl@$GITHUB_BRANCH

# test import
python3 -c """import torch
assert torch.cuda.device_count()
"""

python3 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
python3 -m pip install git+https://github.com/pytorch/tensordict
python3 setup.py develop
python3 -m pip install pytest pytest-benchmark
python3 -m pip install "gym[accept-rom-license,atari]"
python3 -m pip install "dm_control" "mujoco"

cd benchmarks/
export TORCHDYNAMO_INLINE_INBUILT_NN_MODULES=1
export COMPOSITE_LP_AGGREGATE=0
export CUDA_VISIBLE_DEVICES=
export TD_GET_DEFAULTS_TO_NONE=1
RUN_BENCHMARK="python3 -m pytest -vvv --rank 0 --ignore test_collectors_benchmark.py --benchmark-json "
git checkout ${{ github.event.pull_request.base.sha }}
Expand All @@ -57,6 +98,8 @@ jobs:
$RUN_BENCHMARK ${{ env.CONTENDER_JSON }}
- name: Publish results
uses: apbard/pytest-benchmark-commenter@v3
env:
GIT_WORK_TREE: /__w/rl/rl
with:
token: ${{ secrets.GITHUB_TOKEN }}
benchmark-file: ${{ env.CONTENDER_JSON }}
Expand Down Expand Up @@ -130,7 +173,8 @@ jobs:
export PYTHON_INCLUDE_DIR=/usr/include/python3.10

python3.10 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128 -U
python3.10 -m pip install cmake ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
python3.10 -m pip install ninja pytest pytest-benchmark mujoco dm_control "gym[accept-rom-license,atari]"
python3.10 -m pip install "pybind11[global]"
python3.10 -m pip install git+https://github.com/pytorch/tensordict
python3.10 setup.py develop
# python3.10 -m pip install git+https://github.com/pytorch/rl@$GITHUB_BRANCH
Expand Down
Loading
Loading