From f493e15da360e904ddee4adb1ddb81d796a69923 Mon Sep 17 00:00:00 2001 From: lucky <17835344407@163.com> Date: Mon, 26 Aug 2024 19:26:54 +0800 Subject: [PATCH] fix: fix some build bugs --- cuda_rasterizer/rasterizer_impl.h | 101 +++++++++++++++--------------- setup.py | 35 +++++++---- 2 files changed, 72 insertions(+), 64 deletions(-) diff --git a/cuda_rasterizer/rasterizer_impl.h b/cuda_rasterizer/rasterizer_impl.h index bc3f0ec..0a64e33 100644 --- a/cuda_rasterizer/rasterizer_impl.h +++ b/cuda_rasterizer/rasterizer_impl.h @@ -3,7 +3,7 @@ * GRAPHDECO research group, https://team.inria.fr/graphdeco * All rights reserved. * - * This software is free for non-commercial, research and evaluation use + * This software is free for non-commercial, research and evaluation use * under the terms of the LICENSE.md file. * * For inquiries contact george.drettakis@inria.fr @@ -11,64 +11,61 @@ #pragma once -#include -#include #include "rasterizer.h" +#include #include +#include +#include -namespace CudaRasterizer -{ - template - static void obtain(char*& chunk, T*& ptr, std::size_t count, std::size_t alignment) - { - std::size_t offset = (reinterpret_cast(chunk) + alignment - 1) & ~(alignment - 1); - ptr = reinterpret_cast(offset); - chunk = reinterpret_cast(ptr + count); - } +namespace CudaRasterizer { +template +static void obtain(char *&chunk, T *&ptr, std::size_t count, + std::size_t alignment) { + std::size_t offset = + (reinterpret_cast(chunk) + alignment - 1) & + ~(alignment - 1); + ptr = reinterpret_cast(offset); + chunk = reinterpret_cast(ptr + count); +} - struct GeometryState - { - size_t scan_size; - float* depths; - char* scanning_space; - bool* clamped; - int* internal_radii; - float2* means2D; - float* cov3D; - float4* conic_opacity; - float* rgb; - uint32_t* point_offsets; - uint32_t* tiles_touched; +struct GeometryState { + size_t scan_size; + float *depths; + char *scanning_space; + bool *clamped; + int *internal_radii; + float2 *means2D; + float *cov3D; + float4 *conic_opacity; + float *rgb; + uint32_t *point_offsets; + uint32_t *tiles_touched; - static GeometryState fromChunk(char*& chunk, size_t P); - }; + static GeometryState fromChunk(char *&chunk, size_t P); +}; - struct ImageState - { - uint2* ranges; - uint32_t* n_contrib; - float* accum_alpha; +struct ImageState { + uint2 *ranges; + uint32_t *n_contrib; + float *accum_alpha; - static ImageState fromChunk(char*& chunk, size_t N); - }; + static ImageState fromChunk(char *&chunk, size_t N); +}; - struct BinningState - { - size_t sorting_size; - uint64_t* point_list_keys_unsorted; - uint64_t* point_list_keys; - uint32_t* point_list_unsorted; - uint32_t* point_list; - char* list_sorting_space; +struct BinningState { + size_t sorting_size; + uint64_t *point_list_keys_unsorted; + uint64_t *point_list_keys; + uint32_t *point_list_unsorted; + uint32_t *point_list; + char *list_sorting_space; - static BinningState fromChunk(char*& chunk, size_t P); - }; + static BinningState fromChunk(char *&chunk, size_t P); +}; - template - size_t required(size_t P) - { - char* size = nullptr; - T::fromChunk(size, P); - return ((size_t)size) + 128; - } -}; \ No newline at end of file +template size_t required(size_t P) { + char *size = nullptr; + T::fromChunk(size, P); + return ((size_t)size) + 128; +} +}; // namespace CudaRasterizer \ No newline at end of file diff --git a/setup.py b/setup.py index bb7220d..d438926 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ # GRAPHDECO research group, https://team.inria.fr/graphdeco # All rights reserved. # -# This software is free for non-commercial, research and evaluation use +# This software is free for non-commercial, research and evaluation use # under the terms of the LICENSE.md file. # # For inquiries contact george.drettakis@inria.fr @@ -12,23 +12,34 @@ from setuptools import setup from torch.utils.cpp_extension import CUDAExtension, BuildExtension import os + os.path.dirname(os.path.abspath(__file__)) setup( name="diff_gaussian_rasterization", - packages=['diff_gaussian_rasterization'], + packages=["diff_gaussian_rasterization"], ext_modules=[ CUDAExtension( name="diff_gaussian_rasterization._C", sources=[ - "cuda_rasterizer/rasterizer_impl.cu", - "cuda_rasterizer/forward.cu", - "cuda_rasterizer/backward.cu", - "rasterize_points.cu", - "ext.cpp"], - extra_compile_args={"nvcc": ["-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), "third_party/glm/")]}) - ], - cmdclass={ - 'build_ext': BuildExtension - } + "cuda_rasterizer/rasterizer_impl.cu", + "cuda_rasterizer/forward.cu", + "cuda_rasterizer/backward.cu", + "rasterize_points.cu", + "ext.cpp", + ], + extra_compile_args={ + "nvcc": [ + "-I" + + os.path.join( + os.path.dirname(os.path.abspath(__file__)), "third_party/glm/" + ), + "-std=c++17", + "-ccbin=/usr/bin/gcc-13", + ], + "cxx": ["-std=c++17", "-fabi-version=18"], + }, + ) + ], + cmdclass={"build_ext": BuildExtension}, )