Skip to content

Commit

Permalink
Builds on macOS (but crashes)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Mar 21, 2024
1 parent 2979671 commit ecc96cf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
if(GPU_RUNTIME STREQUAL "CUDA")
set(CMAKE_CUDA_ARCHITECTURES 70 75)
find_package(CUDAToolkit)
if (CUDAToolkit-NOTFOUND)
if (NOT CUDAToolkit_FOUND)
message(WARNING "CUDA toolkit not found, building with CPU support only")
set(GPU_RUNTIME "CPU")
endif()
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ Optional: Edit cuda target (only if required) before `cmake --build .`
C:/path_to/OpenSplat/build/gsplat.vcxproj
for example: arch=compute_75,code=sm_75

### macOS

Support for macOS is very experimental.

If you're using [brew], you can install OpenCV by running:

```bash
brew install opencv
```

Then run:

```
git clone https://github.com/pierotofy/OpenSplat OpenSplat
cd OpenSplat
mkdir build && cd build
cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch/ .. && make -j$(nproc)
./opensplat
```

:warning: You will probably get a *libc10.dylib can’t be opened because apple cannot check it for malicious software* error message on first run. Open System Settings and go to Privacy & Security and find the "Allow" button. You might need to repeat this several times until all torch libraries are loaded.

## Docker Build

### CUDA
Expand Down
4 changes: 2 additions & 2 deletions rasterize_gaussians.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "rasterize_gaussians.hpp"
#include "gsplat.hpp"

#if defined(USE_HIP) || defined(USE_CUDA)

std::tuple<torch::Tensor,
torch::Tensor,
torch::Tensor,
Expand Down Expand Up @@ -34,8 +36,6 @@ std::tuple<torch::Tensor,
return std::make_tuple(isectIds, gaussianIds, isectIdsSorted, gaussianIdsSorted, tileBins);
}

#if defined(USE_HIP) || defined(USE_CUDA)

torch::Tensor RasterizeGaussians::forward(AutogradContext *ctx,
torch::Tensor xys,
torch::Tensor depths,
Expand Down
3 changes: 2 additions & 1 deletion rasterize_gaussians.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

using namespace torch::autograd;

#if defined(USE_HIP) || defined(USE_CUDA)

std::tuple<torch::Tensor,
torch::Tensor,
torch::Tensor,
Expand All @@ -17,7 +19,6 @@ std::tuple<torch::Tensor,
torch::Tensor cumTilesHit,
TileBounds tileBounds);

#if defined(USE_HIP) || defined(USE_CUDA)

class RasterizeGaussians : public Function<RasterizeGaussians>{
public:
Expand Down

0 comments on commit ecc96cf

Please sign in to comment.