gsplat icon indicating copy to clipboard operation
gsplat copied to clipboard

automatically add the visual studio compiler folder to the environment path

Open martinResearch opened this issue 1 year ago • 3 comments
trafficstars

Problem: In some case gsplat needs to compile cuda/c++ code on the fly (just-in-time compilation), to handle different number of color channels for example, like done in the test test_rasterize_to_pixels when using channels=128.

In that case cl.exe needs to be on the path when on windows in order for pytorch to be able to do the compilation. One can follow the step documented here but that requires a manual step each time time one wants to use gsplat, which very unconvenient.

Solution: We can instead add the folder automatically to the path at runtime using a mechanism used in CuPy here to discover the folder that contains the cl.exe file.

Ideally this mechanism would be implemented in pytorch, but that may take a while to be completed. We can implement it in gsplat in the mean time.

martinResearch avatar Aug 21 '24 17:08 martinResearch

a possible implementation #351

martinResearch avatar Aug 21 '24 17:08 martinResearch

I realized the problem is in the nerfacc library, not in gsplat. The installation using pip install nerfacc uses the pipy.org file nerfacc-0.5.3-py3-none-any.whl and not nerfacc-0.5.3.tar.gz and as a results the CUDA code is not compiled during the installation, but compiled one the fly the first time nerfacc is imported. On windows, this requires cl.exe to be on the path at runtime. A workaround is to install nerfacc from source using pip install --no-binary=nerfacc nerfacc

martinResearch avatar Aug 22 '24 09:08 martinResearch

actually the problem also appears with gsplat if one used pip install gsplat because the published wheel does not come with precompiled CUDA binaries and the installation from the wheel does not run the compilation (one needs to install gsplat from source to compile the CUDA code during the installation, either using pip install --no-binary=gsplat gsplat or installing from the git clone )

martinResearch avatar Aug 22 '24 10:08 martinResearch