-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Adding fvdb-core #31550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding fvdb-core #31550
Changes from all commits
522f654
93632a6
a1b16f8
0b092ba
ac0e31a
52933ae
8cff108
435544e
3934796
f4dff09
a01c27e
400ed39
31b5b82
d04b317
6260d82
613bbd5
0392223
b600f52
57243f5
a162aeb
472cd21
6f2f819
b366c1c
4df9512
89dc94a
273557a
8f29953
b956de0
2ebb4d3
f871fd9
ee9badb
d221f83
40757ee
0ac3ad8
c09240c
5bb4a7e
faee720
115a58a
293053d
6c2dca5
416d5a5
843b148
be89090
78da6b5
7424821
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| #!/bin/bash | ||
|
|
||
| setup_parallel_build_jobs() { | ||
| # Calculate the optimal number of parallel build jobs based on available RAM | ||
| RAM_GB=$(free -g | awk '/^Mem:/{print $7}') | ||
| if [ -z "$RAM_GB" ]; then | ||
| echo "Error: Unable to determine available RAM" | ||
| exit 1 | ||
| fi | ||
| JOB_RAM_GB=3 | ||
|
|
||
| # Get number of processors | ||
| NPROC=$(nproc) | ||
|
|
||
| # count the number of ';' in the TORCH_CUDA_ARCH_LIST | ||
| NUM_ARCH=$(echo "$TORCH_CUDA_ARCH_LIST" | tr ';' '\n' | wc -l) | ||
| if [ "$NUM_ARCH" -lt 1 ]; then | ||
| NUM_ARCH=1 | ||
| fi | ||
| NVCC_THREADS=$NUM_ARCH | ||
|
|
||
| # Check if we have enough RAM for even one job with full NVCC_THREADS | ||
| # Requirement: JOB_RAM_GB * NVCC_THREADS | ||
| MIN_RAM_REQUIRED=$((JOB_RAM_GB * NVCC_THREADS)) | ||
|
|
||
| if [ "$RAM_GB" -lt "$MIN_RAM_REQUIRED" ]; then | ||
| NVCC_THREADS=1 | ||
| fi | ||
|
|
||
| # Limit NVCC_THREADS to NPROC to ensure we don't oversubscribe | ||
| if [ "$NVCC_THREADS" -gt "$NPROC" ]; then | ||
| NVCC_THREADS=$NPROC | ||
| fi | ||
|
|
||
| # Determine max jobs based on CPU: | ||
| # We want CMAKE_BUILD_PARALLEL_LEVEL * NVCC_THREADS <= NPROC | ||
| MAX_JOBS_CPU=$((NPROC / NVCC_THREADS)) | ||
|
|
||
| # Determine max jobs based on RAM: | ||
| # Assume each job requires JOB_RAM_GB * NVCC_THREADS | ||
| MAX_JOBS_RAM=$((RAM_GB / (JOB_RAM_GB * NVCC_THREADS))) | ||
|
|
||
| # Take the minimum | ||
| PARALLEL_JOBS=$((MAX_JOBS_CPU < MAX_JOBS_RAM ? MAX_JOBS_CPU : MAX_JOBS_RAM)) | ||
|
|
||
| # Ensure at least 1 job | ||
| if [ "$PARALLEL_JOBS" -lt 1 ]; then | ||
| PARALLEL_JOBS=1 | ||
| fi | ||
|
|
||
| # if CMAKE_BUILD_PARALLEL_LEVEL is set, use that | ||
| if [ -n "$CMAKE_BUILD_PARALLEL_LEVEL" ]; then | ||
| echo "Using CMAKE_BUILD_PARALLEL_LEVEL=$CMAKE_BUILD_PARALLEL_LEVEL" | ||
| else | ||
|
|
||
| CMAKE_BUILD_PARALLEL_LEVEL=$PARALLEL_JOBS | ||
|
|
||
| echo "Setting nvcc --threads to $NVCC_THREADS based on the number of CUDA architectures ($NUM_ARCH)" | ||
| echo "Setting CMAKE_BUILD_PARALLEL_LEVEL to $CMAKE_BUILD_PARALLEL_LEVEL" | ||
| echo " Constraint: Total Threads ($((CMAKE_BUILD_PARALLEL_LEVEL * NVCC_THREADS))) <= NPROC ($NPROC)" | ||
| echo " Constraint: Estimated RAM ($((CMAKE_BUILD_PARALLEL_LEVEL * NVCC_THREADS * JOB_RAM_GB))) GB <= Available RAM ($RAM_GB GB)" | ||
|
|
||
| export CMAKE_BUILD_PARALLEL_LEVEL | ||
| export NVCC_THREADS | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| setup_parallel_build_jobs | ||
| export CMAKE_GENERATOR=Ninja | ||
| # GCC 14 false positive: -Wstringop-overflow in NanoVDB headers with deep template inlining at -O3 | ||
| # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118817 | ||
| export CXXFLAGS="${CXXFLAGS} -Wno-error=stringop-overflow" | ||
| $PYTHON -m pip install \ | ||
| --no-deps \ | ||
| --no-build-isolation \ | ||
| -vv \ | ||
| -C 'skbuild.ninja.make-fallback=false' \ | ||
| . |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| {% set name = "fvdb-core" %} | ||
| {% set version = "0.3.0" %} | ||
| {% set torch_proc_type = "cuda" if cuda_compiler_version != "None" else "cpu" %} | ||
|
|
||
| package: | ||
| name: {{ name }} | ||
| version: {{ version }} | ||
|
|
||
| source: | ||
| url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/fvdb_core-{{ version }}.tar.gz | ||
| sha256: f6ec0d5e6a2b601632720ed0be8aa7c8ba6f2d9bd63fac477cef2cfd088b5f16 | ||
|
|
||
| build: | ||
| skip: true # [cuda_compiler_version == "None" or win or osx or py!=312] | ||
| number: 0 | ||
| script_env: | ||
| - TORCH_CUDA_ARCH_LIST=7.5;8.0;9.0;10.0;12.0+PTX | ||
|
|
||
|
|
||
| requirements: | ||
| build: | ||
| - python # [build_platform != target_platform] | ||
| - cross-python_{{ target_platform }} # [build_platform != target_platform] | ||
| - {{ stdlib('c') }} | ||
| - {{ compiler('c') }} | ||
| - {{ compiler('cxx') }} | ||
| - {{ compiler('cuda') }} | ||
| - cuda-version {{ cuda_compiler_version }} | ||
| - cuda-command-line-tools | ||
| - cmake >=3.25 | ||
| - ninja | ||
| - pkg-config | ||
| - git | ||
| - procps-ng # provides 'free' | ||
| - coreutils # provides 'nproc', 'awk', etc. | ||
| host: | ||
| - python | ||
| - scikit-build-core | ||
| - pip | ||
| - pytorch | ||
| - pytorch =*=*{{ torch_proc_type }}* | ||
| - numpy | ||
| - pybind11 >=2.13 | ||
| - gitpython | ||
|
jakirkham marked this conversation as resolved.
|
||
| - cuda-version {{ cuda_compiler_version }} | ||
|
swahtz marked this conversation as resolved.
|
||
| - cuda-cudart-dev | ||
| - cuda-nvrtc-dev | ||
| - cuda-nvtx-dev | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this isn't getting detected by CMake So we may need to adjust the CMake options so it is found Alternatively we can use the If we need to push more changes here, we can include one of these fixes. Otherwise it is ok to handle in the feedstock
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd prefer to handle it in the feedstock just because we're gearing up for a new release in early March where I can make these build changes (as well as some of the other changes to support the conda-forge build better) and not have to patch the old 0.3.0 release.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have filed this as issue: conda-forge/fvdb-core-feedstock#3 |
||
| - libcublas-dev | ||
| - libcudnn-dev | ||
| - libcusolver-dev | ||
| - libcusparse-dev | ||
| - libpng | ||
| - zlib | ||
| run: | ||
| - python | ||
| - pytorch | ||
| - pytorch =*=*{{ torch_proc_type }}* | ||
| - {{ pin_compatible('numpy') }} | ||
| - cuda-version {{ cuda_compiler_version }} | ||
| - gitpython | ||
| - git | ||
| - parameterized | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anticipating more comments for the cudnn question, could we use a thread? I see the following in the CMake configure logs: But then later see Either way, could the conda create \
--name torch-test \
--yes \
'libtorch 2.9.1 cuda129_mkl_hf3b6726_305'
source activate torch-test
find ${CONDA_PREFIX} -name 'libtorch.so*' -exec ldd {} \+And if it is, shouldn't the I will try to look into this soon.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would have thought the same @jameslamb
Should I add
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the requirement to the run requirements and now we're back to passing checks!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok great! I think it's fine for now to just take on the dependency and to investigate removing it later in the feedstock. By the way, if you want (no pressure!) I'd be happy to join as a maintainer for this recipe if you'd like another set of hands to keep things moving.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be amazing, thank you! Someone who can lend a hand with knowledge in this domain would be fantastic
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok sure, thanks! You could add me in the Either is fine.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed an issue to follow up on cuDNN: conda-forge/fvdb-core-feedstock#4 |
||
| test: | ||
| commands: | ||
| - pip check | ||
| - python run_test.py | ||
| source_files: | ||
| - tests/ | ||
| requires: | ||
| - pip | ||
| - pytest | ||
| - parameterized | ||
| - git | ||
|
|
||
| about: | ||
| home: https://www.openvdb.org/ | ||
| license: Apache-2.0 | ||
| license_family: Apache | ||
| license_file: LICENSE | ||
| summary: "A deep learning framework for sparse, large-scale, high-performance spatial intelligence" | ||
| doc_url: https://fvdb.ai/ | ||
| dev_url: https://github.com/openvdb/fvdb-core | ||
|
|
||
| extra: | ||
| recipe-maintainers: | ||
| - swahtz | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import sys | ||
|
|
||
| # Check for fvdb (without importing) | ||
| import pkgutil | ||
| pkgutil.find_loader("fvdb") | ||
|
|
||
| # Try to import fvdb | ||
| try: | ||
| import fvdb | ||
| except ImportError: | ||
| print("Failed to import fvdb. Exiting without running tests.") | ||
| sys.exit(0) | ||
|
|
||
| print(f"fvdb {fvdb.__version__} imported successfully") | ||
|
|
||
| # Check for GPU availability | ||
| import torch | ||
|
|
||
| if not torch.cuda.is_available(): | ||
| print("No CUDA GPU available. Exiting without running fvdb's tests.") | ||
| sys.exit(0) | ||
|
|
||
| print(f"CUDA is available: {torch.cuda.get_device_name(0)}") | ||
|
|
||
| # Run fvdb's test suite | ||
| # Ignore tests with unavailable optional dependencies (OpenImageIO, point_cloud_utils, torch_scatter) | ||
| import pytest | ||
| sys.exit(pytest.main([ | ||
| "tests/unit", "-v", "--tb=short", | ||
| "--ignore=tests/unit/test_gsplat.py", | ||
| "--ignore=tests/unit/test_jagged_tensor.py", | ||
| ])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we use from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe just nvcc, I thought this was the appropriate way to pull in the CUDA compiler. I had found at some point that
{{ compiler('cuda') }}wasn't enoughThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah
{{ compiler('cuda') }}should be enough fornvccThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have filed this as issue: conda-forge/fvdb-core-feedstock#2