Skip to content

Commit

Permalink
pull in changes from internal repo
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilliams committed May 21, 2024
1 parent 1cce95c commit ccdfe0c
Show file tree
Hide file tree
Showing 16 changed files with 288 additions and 94 deletions.
10 changes: 8 additions & 2 deletions fvdb/.github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Run benchmarks
run: |
conda activate fvdb_test
MAX_JOBS=$(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}') python setup.py develop
MAX_JOBS=$(($(nproc) < $(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}') ? $(nproc) : $(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}'))) python setup.py develop
pytest tests/benchmark --benchmark-json tests/benchmark/output.json
shell:
bash -el {0}
Expand All @@ -48,4 +48,10 @@ jobs:
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@swahtz'
alert-comment-cc-users: '@swahtz'

- name: Clean Conda
run: |
conda clean -pty
shell:
bash -el {0}
68 changes: 40 additions & 28 deletions fvdb/.github/workflows/building.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,67 @@ jobs:
wheel:
runs-on:
- self-hosted
- ${{ matrix.cuda-version }}

strategy:
fail-fast: false
matrix:
# support version based on: https://download.pytorch.org/whl/torch/
python-version: ['3.10', '3.11']
torch-version: [2.1.0, 2.1.1, 2.1.2]
cuda-version: ['cu121']
# exclude:
# - torch-version: 2.0.1
# python-version: '3.10'
# - torch-version: 2.0.0
# python-version: '3.11'
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
torch-version: [2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0]
cuda-version: ['12.1.1']
exclude:
- torch-version: 2.1.2
python-version: '3.12'
- torch-version: 2.1.1
python-version: '3.12'
- torch-version: 2.1.0
python-version: '3.12'

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}


- name: Install PyTorch ${{ matrix.torch-version }}+${{ matrix.cuda-version }}
- name: Generate release_environment.yml
run: |
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/${{ matrix.cuda-version }}
python -c "import torch; print('PyTorch:', torch.__version__)"
python -c "import torch; print('CUDA:', torch.version.cuda)"
echo "cp env/release_base_environment.yml release_environment.yml"
cp env/release_base_environment.yml release_environment.yml
echo " - python=${{ matrix.python-version }}" >> release_environment.yml
echo " - pytorch=${{ matrix.torch-version }}" >> release_environment.yml
perl -E '"${{ matrix.cuda-version }}" =~ /^(\d+\.\d+)/; say " - pytorch-cuda=$1"' >> release_environment.yml
perl -E '"${{ matrix.cuda-version }}" =~ /^(\d+)\.(\d+)/; say " - cuda>=$1.$2.0, <$1." . ($2+1) . ".0"' >> release_environment.yml
perl -E '"${{ matrix.cuda-version }}" =~ /^(\d+)\.(\d+)/; say " - cuda-nvcc>=$1.$2.0, <$1." . ($2+1) . ".0"' >> release_environment.yml
- name: Set up fvdb_release Conda env
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
mamba-version: "*"
channels: nvidia,pytorch,conda-forge,defaults
channel-priority: true
activate-environment: fvdb_release
environment-file: release_environment.yml

- name: Set version
run: |
VERSION=`sed -n "s/^__version__ = '\(.*\)'/\1/p" fvdb/__init__.py`
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"`
CUDA_VERSION=`echo ${{ matrix.cuda-version }}`
CUDA_VERSION=`perl -E '"${{ matrix.cuda-version }}" =~ /^(\d+)\.(\d+)/; say "cu$1$2"'`
echo "New version name: $VERSION+$TORCH_VERSION$CUDA_VERSION"
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" fvdb/__init__.py
shell:
bash

- name: Install dependencies
run: |
pip install -r env/build_requirements.txt
bash -el {0}

- name: Build wheel
run: |
conda activate fvdb_release
mkdir dist
TORCH_CUDA_ARCH_LIST="6.1;7.0;7.5;8.0;8.6+PTX" python setup.py bdist_wheel --dist-dir=dist
shell:
bash
bash -el {0}

- name: Rename wheel
run: |
python scripts/rename_wheels.py ${{ matrix.torch-version }} ${{ matrix.cuda-version }}
python scripts/rename_wheels.py ${{ matrix.torch-version }} `perl -E '"${{ matrix.cuda-version }}" =~ /^(\d+)\.(\d+)/; say "cu$1$2"'`
shell:
bash
bash -el {0}

# - name: Push wheel to fvdb-wheels
# id: push_directory
Expand Down Expand Up @@ -111,3 +117,9 @@ jobs:
# - name: Upload wheel
# run: |
# aws s3 sync dist s3://nksr/whl/torch-${{ matrix.torch-version }}+${{ matrix.cuda-version }} --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers

- name: Clean Conda
run: |
conda clean -pty
shell:
bash -el {0}
8 changes: 7 additions & 1 deletion fvdb/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
- name: Run tests
run: |
conda activate fvdb_test
MAX_JOBS=$(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}') python setup.py test
MAX_JOBS=$(($(nproc) < $(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}') ? $(nproc) : $(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}'))) python setup.py test
shell:
bash -el {0}

- name: Clean Conda
run: |
conda clean -pty
shell:
bash -el {0}
2 changes: 1 addition & 1 deletion fvdb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ENV TORCH_CUDA_ARCH_LIST "6.1;7.0;7.5;8.0;8.6+PTX"
# used for cross-compilation in docker build
ENV FORCE_CUDA=1

WORKDIR /feature-vdb
WORKDIR /fvdb
COPY env/test_environment.yml .

RUN /opt/conda/bin/conda env create -f test_environment.yml \
Expand Down
13 changes: 13 additions & 0 deletions fvdb/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2023 NVIDIA Corporation

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Join Us

0 comments on commit ccdfe0c

Please sign in to comment.