Skip to content

Commit

Permalink
create JIT compilation configs if necessary (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
ychfan authored May 29, 2024
1 parent d5af8be commit 0acd460
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions gsplat/cuda/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,23 @@ def cuda_toolkit_version():
return cuda_version


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"]
extra_cuda_cflags = ["-O3"]

_C = None
sources = list(glob.glob(os.path.join(PATH, "csrc/*.cu"))) + list(
glob.glob(os.path.join(PATH, "csrc/*.cpp"))
)
# sources = [
# os.path.join(PATH, "csrc/ext.cpp"),
# os.path.join(PATH, "csrc/rasterize.cu"),
# os.path.join(PATH, "csrc/bindings.cu"),
# os.path.join(PATH, "csrc/forward.cu"),
# os.path.join(PATH, "csrc/backward.cu"),
# ]

try:
# try to import the compiled module (via setup.py)
from gsplat import csrc as _C
except ImportError:
# if failed, try with JIT compilation
if cuda_toolkit_available():
name = "gsplat_cuda"
build_dir = _get_build_directory(name, verbose=False)
sources = list(glob.glob(os.path.join(PATH, "csrc/*.cu"))) + list(
glob.glob(os.path.join(PATH, "csrc/*.cpp"))
)
extra_include_paths = [os.path.join(PATH, "csrc/third_party/glm")]
extra_cflags = ["-O3"]
extra_cuda_cflags = ["-O3"]

# If JIT is interrupted it might leave a lock in the build directory.
# We dont want it to exist in any case.
try:
Expand Down

0 comments on commit 0acd460

Please sign in to comment.