Skip to content

Commit 9e531b0

Browse files
authored
Merge pull request #2045 from swahtz/fvdb_update
2 parents 39d2c17 + c2eb7e6 commit 9e531b0

File tree

102 files changed

+3817
-1476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3817
-1476
lines changed

fvdb/.clangd

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# https://clangd.llvm.org/config
2+
3+
# Apply a config conditionally to all C files
4+
If:
5+
PathMatch: .*\.(c|h)$
6+
7+
---
8+
9+
# Apply a config conditionally to all C++ files
10+
If:
11+
PathMatch: .*\.(c|h)pp
12+
13+
---
14+
15+
# Apply a config conditionally to all CUDA files
16+
If:
17+
PathMatch: .*\.cuh?
18+
CompileFlags:
19+
Add:
20+
- "-x"
21+
- "cuda"
22+
# No error on unknown CUDA versions
23+
- "-Wno-unknown-cuda-version"
24+
# Allow variadic CUDA functions
25+
- "-Xclang=-fcuda-allow-variadic-functions"
26+
Diagnostics:
27+
Suppress:
28+
- "variadic_device_fn"
29+
- "attributes_not_allowed"
30+
- "unknown_cuda_version"
31+
- "unknown_type_name"
32+
- "implicit_return_from_non_void_function"
33+
- "no_template_args_on_forwarding_function"
34+
35+
---
36+
37+
# Tweak the clangd parse settings for all files
38+
CompileFlags:
39+
Add:
40+
# report all errors
41+
- "-ferror-limit=0"
42+
- "-fmacro-backtrace-limit=0"
43+
- "-ftemplate-backtrace-limit=0"
44+
# Skip the CUDA version check
45+
- "--no-cuda-version-check"
46+
Remove:
47+
# remove gcc's -fcoroutines
48+
- -fcoroutines
49+
# remove nvc++ flags unknown to clang
50+
- "-gpu=*"
51+
- "-stdpar*"
52+
# remove nvcc flags unknown to clang
53+
- "-arch*"
54+
- "-gencode*"
55+
- "--generate-code*"
56+
- "-ccbin*"
57+
- "-t=*"
58+
- "--threads*"
59+
- "-Xptxas*"
60+
- "-Xcudafe*"
61+
- "-Xfatbin*"
62+
- "-Xcompiler*"
63+
- "--diag-suppress*"
64+
- "--diag_suppress*"
65+
- "--compiler-options*"
66+
- "--extended-lambda"
67+
- "--expt-extended-lambda"
68+
- "--expt-relaxed-constexpr"
69+
- "-forward-unknown-to-host-compiler"
70+
- "-Werror=cross-execution-space-call"

fvdb/.vscode/extensions.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"llvm-vs-code-extensions.vscode-clangd",
8+
"ms-vscode.cpptools-extension-pack"
9+
],
10+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
11+
"unwantedRecommendations": [
12+
13+
]
14+
}

fvdb/.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
},
113113
"files.trimTrailingWhitespace": true,
114114
"editor.rulers": [ 100 ],
115-
"C_Cpp.intelliSenseEngine": "default",
115+
"C_Cpp.intelliSenseEngine": "disabled",
116116
"C_Cpp.enhancedColorization": "enabled",
117117
"C_Cpp.errorSquiggles": "enabledIfIncludesResolve",
118118
"C_Cpp.autocomplete": "default",
@@ -123,11 +123,11 @@
123123
"cmake.configureOnOpen": false,
124124
"C_Cpp.default.compilerPath": "${env:CONDA_PREFIX}/envs/fvdb/bin/x86_64-conda-linux-gnu-c++",
125125
"[cpp]": {
126-
"editor.defaultFormatter": "ms-vscode.cpptools",
126+
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd",
127127
"editor.formatOnSave": true
128128
},
129129
"[cuda-cpp]": {
130-
"editor.defaultFormatter": "ms-vscode.cpptools",
130+
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd",
131131
"editor.formatOnSave": true
132132
},
133133
"[python]": {
@@ -158,4 +158,5 @@
158158
"C_Cpp.formatting": "clangFormat",
159159
"C_Cpp.clang_format_path": "${env:CONDA_PREFIX}/envs/fvdb/bin/clang-format-18",
160160
"files.insertFinalNewline": true,
161+
"clangd.path": "${env:CONDA_PREFIX}/envs/fvdb/bin/clangd",
161162
}

fvdb/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ find_package(Python3 COMPONENTS Development Interpreter)
1313
message(STATUS "CMAKE_BUILD_PARALLEL_LEVEL: ${CMAKE_BUILD_PARALLEL_LEVEL}")
1414

1515
include(${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/get_cpm.cmake)
16+
include(${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/get_nvtx.cmake)
1617
include(${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/get_torch.cmake)
1718
include(${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/get_pybind11.cmake)
1819
include(${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/configure_torch_pybind11.cmake)

fvdb/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ ENV CONDA_OVERRIDE_CUDA=12.0
1414
# copy env/dev_environment.yml to /tmp/
1515
COPY fvdb/env/dev_environment.yml /tmp/
1616
RUN conda env create -f /tmp/dev_environment.yml
17+
18+
RUN conda init
19+
RUN echo "conda activate fvdb" >> ~/.bashrc

fvdb/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ sphinx-build -E -a docs/ build/sphinx
145145
open build/sphinx/index.html
146146
```
147147

148+
### Setting up Intellisense with clangd in Visual Studio Code
149+
150+
Please see the guide [`Clangd for Intellisense in fVDB`](docs/markdown/clangd.md)
148151

149152

150153
## Usage Examples

fvdb/build.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,31 @@ setup_parallel_build_jobs() {
4848
# Ensure that the build is done with the conda environment
4949
# Get any additional command line arguments after $1
5050
shift
51-
ADDITIONAL_ARGS="$@"
52-
export PIP_ARGS="-v --no-build-isolation $ADDITIONAL_ARGS"
51+
52+
CONFIG_SETTINGS=""
53+
PASS_THROUGH_ARGS=""
54+
55+
while (( "$#" )); do
56+
if [[ "$BUILD_TYPE" == "install" ]]; then
57+
if [[ "$1" == "gtests" ]]; then
58+
echo "Detected 'gtests' flag for install build. Enabling FVDB_BUILD_TESTS."
59+
CONFIG_SETTINGS+=" --config-settings=cmake.define.FVDB_BUILD_TESTS=ON"
60+
elif [[ "$1" == "benchmarks" ]]; then
61+
echo "Detected 'benchmarks' flag for install build. Enabling FVDB_BUILD_BENCHMARKS."
62+
CONFIG_SETTINGS+=" --config-settings=cmake.define.FVDB_BUILD_BENCHMARKS=ON"
63+
else
64+
# Append other arguments, handling potential spaces safely
65+
PASS_THROUGH_ARGS+=" $(printf "%q" "$1")"
66+
fi
67+
else
68+
# Append other arguments, handling potential spaces safely
69+
PASS_THROUGH_ARGS+=" $(printf "%q" "$1")"
70+
fi
71+
shift
72+
done
73+
74+
# Construct PIP_ARGS with potential CMake args and other pass-through args
75+
export PIP_ARGS="-v --no-build-isolation$CONFIG_SETTINGS$PASS_THROUGH_ARGS"
5376

5477
if [ "$BUILD_TYPE" != "ctest" ]; then
5578
setup_parallel_build_jobs
@@ -62,7 +85,7 @@ if [ "$BUILD_TYPE" == "wheel" ]; then
6285
pip wheel . --wheel-dir dist/ $PIP_ARGS
6386
elif [ "$BUILD_TYPE" == "install" ]; then
6487
echo "Build and install package"
65-
echo "pip install --force-reinstall $PIP_ARGS ."
88+
echo "pip install --force-reinstall $PIP_ARGS ."
6689
pip install --force-reinstall $PIP_ARGS .
6790
# TODO: Fix editable install
6891
# else

fvdb/compile_commands.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/cp311-cp311-linux_x86_64/compile_commands.json

fvdb/docs/markdown/clangd.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Clangd for "Intellisense" in fVDB
2+
3+
In fVDB we typically develop using Visual Studio Code (VSCode), both local, in containers, and
4+
remove via SSH. To aid development we use `clangd` for intellisense (code navigation) and to
5+
detect syntax and usage errors before compiling. With `clangd` active, you will see "red squiggles"
6+
under actual syntax / compilation errors in your code as you edit; you will get code completion
7+
suggestions; and you will get tooltips for definitions when you mouse over code.
8+
9+
The fVDB VSCode workspace includes configuration for clangd but developers new to fVDB should follow
10+
these instructions.
11+
12+
## Setting up clangd in your environment
13+
14+
The fvdb Conda development environment installs the CUDA toolkit, but clangd runs outside the
15+
environment and so may not find the correct CUDA installation. Therefore you should create the file
16+
17+
To fix this, you need to create a user clangd config file to point to the CUDA installation in the
18+
FVDB conda environment: Create ~/.config/clangd/config.yaml with these contents. This assumes you
19+
use the `dev_environment.yml` to create the `fvdb` Conda environment.
20+
21+
```yaml
22+
# https://clangd.llvm.org/config
23+
24+
# Apply a config conditionally to all CUDA files
25+
If:
26+
PathMatch: .*\.cuh?
27+
CompileFlags:
28+
Add:
29+
- "--cuda-path=/home/mharris/miniforge3/envs/fvdb"
30+
```
31+
32+
The first time you load the fVDB VSCode workspace, it should prompt you to install recommended
33+
extensions. Specifically: "llvm-vs-code-extensions.vscode-clangd", and
34+
"ms-vscode.cpptools-extension-pack", as defined in the `extensions.json` file. Install these
35+
extensions. With Clangd, the MS CPPTools is only used for syntax highlighting. Clangd is used for
36+
intellisense and (CUDA) C++ file formatting.
37+
38+
## Troubleshooting Intellisense
39+
40+
Clangd uses the file `compile_commands.json` to determine the compiler command line used so that it
41+
can build an index of the source code for "intellisense" navigation. This file is generated by
42+
CMake when you configure the build. This happens when you run fVDB's `build.sh`. Here are some
43+
tips for troubleshooting intellisense issues.
44+
45+
- If you get a red squiggle on the first character of a file, it’s usually a major failure. For
46+
example when clangd fails to find the CUDA installation. This is often a configuration problem.
47+
- A common problem is when you are editing a file that is not in `compile_commands.json`. if this is
48+
the case, you may not have CMake-configured your build.
49+
- A key indicator of this is seeing a message about ‘inferred’ commands like this in the clangd
50+
output log `ASTWorker building file XXX with command inferred from YYY`
51+
- Switching conda environments: if you activate a conda environment, e.g. `fvdb_build` and build
52+
(or cmake configure), then switch to another conda environment, your `compile_commands.json` will
53+
be out of date with the wrong include paths. You need to rerun cmake configure or rebuild in the
54+
active conda environment.
55+
- red squiggles in google test .cpp : did you build the tests? Are they in compile_commands.cpp?
56+
Make sure you add the `gtests` argument to your `build.sh` command line:
57+
58+
```sh
59+
./build.sh install gtests
60+
```

fvdb/env/build_environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies:
1919
- libcublas-dev
2020
- libcusolver-dev
2121
- libcusparse-dev
22+
- libpng
2223
- linkify-it-py
2324
- make
2425
- myst-parser

fvdb/env/dev_environment.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ channels:
55
dependencies:
66
- ca-certificates
77
- certifi
8+
- clang=18
89
- clang-format=18
10+
- clang-tools=18
911
- cmake
1012
- cuda-command-line-tools
1113
- cuda-compiler
@@ -19,6 +21,7 @@ dependencies:
1921
- gxx_linux-64=11
2022
- ipython
2123
- jupyterlab
24+
- libclang=18
2225
- libcublas-dev
2326
- libcurand-dev
2427
- libcusolver-dev
@@ -57,12 +60,17 @@ dependencies:
5760
- scikit-learn
5861
- torchmetrics
5962
- tyro
63+
- gdal
64+
- utm
65+
- pyproj
66+
- open3d
6067
- pip:
6168
- point-cloud-utils
6269
- https://nksr.s3.ap-northeast-1.amazonaws.com/dev-whls/pt24cu120/torchsparse-2.1.0-cp311-cp311-linux_x86_64.whl
6370
- https://nksr.s3.ap-northeast-1.amazonaws.com/dev-whls/pt24cu120/torchsparse_20-2.0.0b0-cp311-cp311-linux_x86_64.whl
6471
- https://nksr.s3.ap-northeast-1.amazonaws.com/dev-whls/pt24cu120/torch_scatter-2.1.2-cp311-cp311-linux_x86_64.whl
6572
## 3dgs
6673
- viser
74+
- srt
6775
## 3dgs tests
6876
- oiio-static-python

fvdb/env/test_environment.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,33 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- python=3.11
7-
- pytorch-gpu=2.4.1[build=cuda120*]
8-
- tensorboard
6+
- ca-certificates
7+
- certifi
98
- cuda-version=12.0
10-
- pip>=23.3.1
119
- git
1210
- gitpython
13-
- ca-certificates
14-
- certifi
15-
- openssl
16-
- parameterized
11+
- imageio
1712
- ipython
13+
- libpng
14+
- linkify-it-py
1815
- matplotlib
19-
- tqdm
20-
- sphinx>=7.0.0
21-
- sphinx_rtd_theme
2216
- myst-parser
23-
- pandas
24-
- rich
25-
- pytest-benchmark
2617
- numpy
27-
- linkify-it-py
18+
- openssl
19+
- pandas
20+
- parameterized
21+
- pip>=23.3.1
2822
- polyscope
2923
- py-opencv=4.10[build=headless*]
30-
- imageio
24+
- pytest-benchmark
25+
- python=3.11
26+
- pytorch-gpu=2.4.1[build=cuda120*]
27+
- rich
3128
- scikit-learn
29+
- sphinx_rtd_theme
30+
- sphinx>=7.0.0
31+
- tensorboard
32+
- tqdm
3233
- zlib
3334
- pip:
3435
- gsplat

fvdb/fvdb/nn/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from .vdbtensor import VDBTensor, vdbtensor_from_dense
2626

2727
__all__ = [
28-
"GaussianSplat3D",
2928
"VDBTensor",
3029
"vdbtensor_from_dense",
3130
"MaxPool",

0 commit comments

Comments
 (0)