Skip to content

Commit

Permalink
rename to gsplat (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
maturk authored Oct 12, 2023
1 parent bb9003c commit fdd2391
Show file tree
Hide file tree
Showing 51 changed files with 56 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/core_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
pip install torch==2.0.0 --index-url https://download.pytorch.org/whl/cpu
BUILD_NO_CUDA=1 pip install .
- name: Run Black Format Check
run: black . diff_rast/ tests/ examples/ --check
run: black . gsplat/ tests/ examples/ --check
- name: Run Tests.
run: pytest tests/
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "diff_rast/cuda/csrc/third_party/glm"]
path = diff_rast/cuda/csrc/third_party/glm
[submodule "gsplat/cuda/csrc/third_party/glm"]
path = gsplat/cuda/csrc/third_party/glm
url = https://github.com/g-truc/glm.git
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
recursive-include diff_rast/cuda/csrc *
recursive-include gsplat/cuda/csrc *
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# diff_rast
# gsplat

Our version of differentiable gaussian rasterizer

Expand Down Expand Up @@ -40,7 +40,7 @@ The curret tests that will be triggered by PR:
Because we check for black formatting, it is recommend to run black before commit in the code:

```bash
black . diff_rast/ tests/ examples/
black . gsplat/ tests/ examples/
```

Since there is no GPU supported on github workflow container, we don't test against those cuda unit tests under `tests/` in PR. So it is recommended to check test pass locally before committing:
Expand All @@ -67,11 +67,11 @@ sphinx-build docs/source _build

# Brief walkthrough

The main python bindings for rasterization are found by importing diff_rast
The main python bindings for rasterization are found by importing gsplat

```
import diff_rast
help(diff_rast)
import gsplat
help(gsplat)
```

# clangd setup (for Neovim)
Expand Down Expand Up @@ -117,7 +117,7 @@ sudo apt install bear
#
# This will save a file at 3dgs-exercise/compile_commands.json, which clangd
# should be able to detect.
bear -- pip install -e diff_rast/
bear -- pip install -e gsplat/

# Make sure the file is not empty!
cat compile_commands.json
Expand Down
1 change: 0 additions & 1 deletion diff_rast/cuda/csrc/third_party/glm
Submodule glm deleted from 47585f
2 changes: 1 addition & 1 deletion docs/source/apis/proj.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ProjectGaussians
===================================

.. currentmodule:: diff_rast
.. currentmodule:: gsplat

Given 3D gaussians parametrized by means :math:`μ`, covariances :math:`Σ`, colors :math:`c`, and opacities :math:`o`, the
ProjectGaussians function computes the projected 2D gaussians in the camera frame with means :math:`μ'`, covariances :math:`Σ'`, and depths :math:`z`
Expand Down
2 changes: 1 addition & 1 deletion docs/source/apis/rast.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RasterizeGaussians
===================================

.. currentmodule:: diff_rast
.. currentmodule:: gsplat

Given 2D gaussians that are parametrized by their means :math:`μ'` and covariances :math:`Σ'` as well as their radii and conic parameters,
the RasterizeGaussians function first sorts each gaussian such that all gaussians within the bounds of a tile are grouped and sorted by increasing depth :math:`z`,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/apis/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Utils
In addition to the main projection and rasterization functions, a few CUDA kernel and helper functions are exposed to python with the following bindings:


.. currentmodule:: diff_rast
.. currentmodule:: gsplat

.. autoclass:: BinAndSortGaussians

Expand Down
8 changes: 4 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
__version__ = None
exec(open("../../diff_rast/version.py", "r").read())
exec(open("../../gsplat/version.py", "r").read())

# -- Project information

project = "diff_rast"
copyright = "2023, Vickie"
author = "Vickie"
project = "gsplat"
copyright = "2023, nerfstudio team"
author = "nerfstudio"

release = __version__

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conventions/data_conventions.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Data Conventions
===================================

.. currentmodule:: diff_rast
.. currentmodule:: gsplat

Here we explain the various data conventions used in our repo.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/simple_trainer.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Simple Trainer
===================================

.. currentmodule:: diff_rast
.. currentmodule:: gsplat

Training on an image
-----------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
diff_rast
gsplat
===================================

.. image:: imgs/training.gif
Expand All @@ -8,7 +8,7 @@ diff_rast
Overview
--------

*diff_rast* is an open-source library for CUDA accelerated rasterization of gaussians with python bindings. It is inspired by the SIGGRAPH paper "3D Gaussian Splatting for Real-Time Rendering of Radiance Fields" :cite:p:`kerbl3Dgaussians`.
*gsplat* is an open-source library for CUDA accelerated rasterization of gaussians with python bindings. It is inspired by the SIGGRAPH paper "3D Gaussian Splatting for Real-Time Rendering of Radiance Fields" :cite:p:`kerbl3Dgaussians`.
This libary contains the neccessary components for efficient 3D to 2D projection, sorting, and alpha compositing of gaussians and their associated backward passes for inverse rendering.

Contributing
Expand Down
4 changes: 2 additions & 2 deletions examples/simple_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import numpy as np
import torch
import tyro
from diff_rast.project_gaussians import ProjectGaussians
from diff_rast.rasterize import RasterizeGaussians
from gsplat.project_gaussians import ProjectGaussians
from gsplat.rasterize import RasterizeGaussians
from PIL import Image
from torch import Tensor, optim

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class BinAndSortGaussians(Function):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class ComputeCumulativeIntersects(Function):
Expand Down
2 changes: 1 addition & 1 deletion diff_rast/cov2d_bounds.py → gsplat/cov2d_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class ComputeCov2dBounds(Function):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions diff_rast/cuda/_backend.py → gsplat/cuda/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def cuda_toolkit_version():
return cuda_version


name = "diff_rast_cuda"
name = "gsplat_cuda"
build_dir = _get_build_directory(name, verbose=False)
extra_include_paths = [os.path.join(PATH, "csrc/third_party/glm")]
extra_cflags = ["-O3"]
Expand All @@ -53,7 +53,7 @@ def cuda_toolkit_version():

try:
# try to import the compiled module (via setup.py)
from diff_rast import csrc as _C
from gsplat import csrc as _C
except ImportError:
# if failed, try with JIT compilation
if cuda_toolkit_available():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12) # You can adjust the minimum required version
set(CMAKE_CUDA_ARCHITECTURES 70 75 89) # Ti 2080 uses 75. V100 uses 70. RTX 4090 uses 89.

project(diff_rast CXX CUDA)
project(gsplat CXX CUDA)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CUDA_STANDARD 17)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class GetTileBinEdges(Function):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class MapGaussiansToIntersects(Function):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class ProjectGaussians(Function):
Expand Down
2 changes: 1 addition & 1 deletion diff_rast/rasterize.py → gsplat/rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class RasterizeGaussians(Function):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import Tensor
from torch.autograd import Function

import diff_rast.cuda as _C
import gsplat.cuda as _C


class RasterizeForwardKernel(Function):
Expand Down
2 changes: 1 addition & 1 deletion diff_rast/sh.py → gsplat/sh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Python bindings for SH"""

import diff_rast.cuda as _C
import gsplat.cuda as _C

from jaxtyping import Float
from torch import Tensor
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from setuptools import find_packages, setup

__version__ = None
exec(open("diff_rast/version.py", "r").read())
exec(open("gsplat/version.py", "r").read())

URL = "" # TODO

Expand All @@ -26,7 +26,7 @@ def get_extensions():
from torch.__config__ import parallel_info
from torch.utils.cpp_extension import CUDAExtension

extensions_dir = osp.join("diff_rast", "cuda", "csrc")
extensions_dir = osp.join("gsplat", "cuda", "csrc")
sources = glob.glob(osp.join(extensions_dir, "*.cu")) + glob.glob(
osp.join(extensions_dir, "*.cpp")
)
Expand All @@ -44,7 +44,7 @@ def get_extensions():
define_macros = []

if sys.platform == "win32":
define_macros += [("diff_rast_EXPORTS", None)]
define_macros += [("gsplat_EXPORTS", None)]

extra_compile_args = {"cxx": ["-O3"]}
if not os.name == "nt": # Not on Windows:
Expand Down Expand Up @@ -83,7 +83,7 @@ def get_extensions():
extra_compile_args["nvcc"] = nvcc_flags

extension = CUDAExtension(
f"diff_rast.csrc",
f"gsplat.csrc",
sources,
include_dirs=[osp.join(extensions_dir, "third_party", "glm")],
define_macros=define_macros,
Expand All @@ -96,7 +96,7 @@ def get_extensions():


setup(
name="diff_rast",
name="gsplat",
version=__version__,
description=" Python package for differentiable rasterization of gaussians",
keywords="gaussian, splatting, cuda",
Expand All @@ -110,7 +110,7 @@ def get_extensions():
"typing_extensions; python_version<'3.8'",
],
extras_require={
# dev dependencies. Install them by `pip install diff_rast[dev]`
# dev dependencies. Install them by `pip install gsplat[dev]`
"dev": [
"black[jupyter]==22.3.0",
"isort==5.10.1",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_bin_and_sort_gaussians.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_bin_and_sort_gaussians():
from diff_rast import _torch_impl
from diff_rast.bin_and_sort_gaussians import BinAndSortGaussians
from gsplat import _torch_impl
from gsplat.bin_and_sort_gaussians import BinAndSortGaussians

torch.manual_seed(42)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cov2d_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_compare_binding_to_pytorch():
from diff_rast._torch_impl import compute_cov2d_bounds as _compute_cov2d_bounds
from diff_rast.cov2d_bounds import ComputeCov2dBounds
from gsplat._torch_impl import compute_cov2d_bounds as _compute_cov2d_bounds
from gsplat.cov2d_bounds import ComputeCov2dBounds

torch.manual_seed(42)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cumulative_intersects.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_cumulative_intersects():
from diff_rast.compute_cumulative_intersects import ComputeCumulativeIntersects
from gsplat.compute_cumulative_intersects import ComputeCumulativeIntersects

torch.manual_seed(42)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_get_tile_bin_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_get_tile_bin_edges():
from diff_rast import _torch_impl
from diff_rast.get_tile_bin_edges import GetTileBinEdges
from gsplat import _torch_impl
from gsplat.get_tile_bin_edges import GetTileBinEdges

torch.manual_seed(42)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_map_gaussians.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_map_gaussians():
from diff_rast import _torch_impl
from diff_rast.map_gaussian_to_intersects import MapGaussiansToIntersects
from gsplat import _torch_impl
from gsplat.map_gaussian_to_intersects import MapGaussiansToIntersects

torch.manual_seed(42)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_project_gaussians.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_project_gaussians_forward():
from diff_rast import _torch_impl
import diff_rast.cuda as _C
from gsplat import _torch_impl
import gsplat.cuda as _C

torch.manual_seed(42)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_rasterize_forward_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_rasterize_forward_kernel():
from diff_rast import _torch_impl
from diff_rast.rasterize_forward_kernel import RasterizeForwardKernel
from gsplat import _torch_impl
from gsplat.rasterize_forward_kernel import RasterizeForwardKernel

torch.manual_seed(42)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
def test_sh():
from diff_rast import _torch_impl
from diff_rast import sh
from gsplat import _torch_impl
from gsplat import sh

num_points = 1
degree = 4
Expand Down

0 comments on commit fdd2391

Please sign in to comment.