Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torch 2 or Torch 1? #1

Open
navinelahi opened this issue Sep 19, 2023 · 1 comment
Open

Torch 2 or Torch 1? #1

navinelahi opened this issue Sep 19, 2023 · 1 comment

Comments

@navinelahi
Copy link

navinelahi commented Sep 19, 2023

Hi!

I am trying to setup the repo but when I run build.sh, I get some errors related to the torch c++ header files and files inside the pytorch installation directory of the conda env:

/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:593:6: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
  593 |   if constexpr (num_boxed_args != 0) {
      |      ^~~~~~~~~
In file included from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/ATen.h:11,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:4,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:9,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/include/common.h:19,
                 from /home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/debug.h:1,
                 from /home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/bindings.cpp:1:
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/activation.h: In lambda function:
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
   56 |     if constexpr (!at::should_include_kernel_dtype(   \
      |        ^~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’
  221 |       __VA_ARGS__                                                           \
      |       ^~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’
   68 |     AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type);                        \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’
   74 |   AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, __VA_ARGS__)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:233:3: note: in expansion of macro ‘AT_DISPATCH_CASE’
  233 |   AT_DISPATCH_CASE(at::ScalarType::Double, __VA_ARGS__) \
      |   ^~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:237:34: note: in expansion of macro ‘AT_DISPATCH_CASE_FLOATING_TYPES’
  237 |   AT_DISPATCH_SWITCH(TYPE, NAME, AT_DISPATCH_CASE_FLOATING_TYPES(__VA_ARGS__))
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/activation.h:895:27: note: in expansion of macro ‘AT_DISPATCH_FLOATING_TYPES’
  895 |     attn_output_weights = AT_DISPATCH_FLOATING_TYPES(
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
   56 |     if constexpr (!at::should_include_kernel_dtype(   \
      |        ^~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’
  221 |       __VA_ARGS__                                                           \
      |       ^~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’
   68 |     AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type);                        \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’
   74 |   AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, __VA_ARGS__)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:234:3: note: in expansion of macro ‘AT_DISPATCH_CASE’
  234 |   AT_DISPATCH_CASE(at::ScalarType::Float, __VA_ARGS__)
      |   ^~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:237:34: note: in expansion of macro ‘AT_DISPATCH_CASE_FLOATING_TYPES’
  237 |   AT_DISPATCH_SWITCH(TYPE, NAME, AT_DISPATCH_CASE_FLOATING_TYPES(__VA_ARGS__))
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/activation.h:895:27: note: in expansion of macro ‘AT_DISPATCH_FLOATING_TYPES’
  895 |     attn_output_weights = AT_DISPATCH_FLOATING_TYPES(
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/bindings.cpp:1:
/home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/debug.h: In function ‘void check_tiledepth_host(size_t, int*, double*)’:
/home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/debug.h:6:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
    6 |   printf("N : %d\n", N);
      |               ~^     ~
      |                |     |
      |                int   size_t {aka long unsigned int}
      |               %ld
/home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/debug.h:10:30: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   10 |     for (size_t j = start; j < end - 1; j++) {
      |                            ~~^~~~~~~~~
/home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/debug.h:12:38: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
   12 |         printf("[DEBUG] [CUDA] tile %d==%d n = %d depth = %f\n", i,
      |                                     ~^                           ~
      |                                      |                           |
      |                                      int                         size_t {aka long unsigned int}
      |                                     %ld
/home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/debug.h:20:36: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
   20 |       printf("[DEBUG] [CUDA] tile %d==%d n = %d depth = %f\n", i,
      |                                   ~^                           ~
      |                                    |                           |
      |                                    int                         size_t {aka long unsigned int}
      |                                   %ld
In file included from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/c10/util/StringUtil.h:6,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:5,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/c10/core/Device.h:5,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/core/TensorBody.h:11,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/core/Tensor.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/ATen/Tensor.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/autograd/function_hook.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/autograd/cpp_hook.h:2,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/autograd/variable.h:6,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/autograd/autograd.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/autograd.h:3,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/include/common.h:19,
                 from /home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/debug.h:1,
                 from /home/n/gaussian_splatting/gaussian_splatting_3d/gs/src/bindings.cpp:1:
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/c10/util/string_view.h: In instantiation of ‘std::basic_ostream<CharT>& c10::operator<<(std::basic_ostream<CharT>&, c10::basic_string_view<CharT>) [with CharT = char]’:
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/c10/util/typeid.h:600:34:   required from here
/home/n/anaconda3/envs/gaussian_splatting_3d/lib/python3.10/site-packages/torch/include/c10/util/string_view.h:577:35: error: ‘std_string_type’ was not declared in this scope
  577 |   return stream << std_string_type(sv.data(), sv.size());
      |                    ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

I am thinking if this has to do with the C++ 14 dependency or the torch version themselves? Also please clarify which version of CUDA, Pytorch, CMAKE, NINJA and G++ you are using. Can you please help? Thank you

@heheyas
Copy link
Owner

heheyas commented Sep 19, 2023

Hi navinelahi,

Thank you so much for your interest. I have tested this extension with torch==1.12.1 and torch==2.0.1 and both work fine for me. From the outputs you provided, it seems that some of the header files should be included in c++17 standard (such as string_view.h) , I recommend you change the compile flags in gs/setup.py ("-std=c++14" to "-std=c++17" in nvcc_flags). For the versions:

torch==1.12.1
CUDA==11.3
cmake==3.26.4
ninja==1.11.1.git.kitware.jobserver-1
g++==9.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants