uci-rendering / psdr-cuda

Path-space differentiable renderer
BSD 3-Clause "New" or "Revised" License
155 stars 11 forks source link

pybind11 error with enoki #3

Closed hyeonjang closed 2 years ago

hyeonjang commented 2 years ago

Hello,

I have encountered the error like below, during running the included test code.

Traceback (most recent call last):
  File "psdr_test.py", line 99, in <module>
    process(name, value)
  File "psdr_test.py", line 77, in process
    direct_test(name, args)
  File "psdr_test.py", line 55, in direct_test
    run_orig(integrator, sc, dirname + "/direct_orig.exr", args)
  File "/home/hyeonjang/psdr-cuda/examples/run_test.py", line 28, in run_orig
    img = integrator.renderC(sc, sensor_id)
TypeError: Unable to convert function return value to a Python type! The signature was
        (self: psdr_cuda.Integrator, scene: psdr_cuda.Scene, sensor_id: int = 0) -> enoki::Array<enoki::CUDAArray<float>, 3ul>

I think that there is no pybind11 casting with enoki in the build. I have installed psdr-cuda in the enviroment Ubuntu 20.04.

Could you give me a help?

andyyankai commented 2 years ago

This is usually caused by the inconsistent version of the compiler(like GCC) between enoki and psdr_cuda. And you double-check if enoki and psdr_cuda are built using the same compiler with the same version?

hyeonjang commented 2 years ago

Thanks! I found the problem from https://github.com/mitsuba-renderer/enoki/issues/57. And It was Clang problem in my case.

starbit-coder commented 2 years ago

@hyeonjang could you please clarify what you mean by “It was Clang problem in my case”?

This problem still persists even when compiling enoki and psdr-cuda with exactly the same compiler (clang-9) and stdlib (-stdlib=libc++).

hyeonjang commented 2 years ago

@starbit-coder In my cases, the problem was that I tried to compile the sources with gcc, even if enoki was build by clang.

If you compile the both source in the same setting, there should be no problem. I recommend to add enoki as a submodule under the "ext" directory and use cmake command "add_subdirectory(/ext)" And, as you know, there is no specific options about clang in the CMakeLists.txt file. It may be better to compile source with g++.

starbit-coder commented 2 years ago

Thanks for the response @hyeonjang. I've added enoki as a submodule to the psdr-cuda project to try ensure the settings are exactly the same and compiled with g++-9. However, it still gives exactly the same error as in your first post.

Could you maybe provide your CMakeLists.txt for enoki and psdr-cuda?