uci-rendering / psdr-cuda

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

Post compilation psdr_cuda not found #1

Closed dhawals1939 closed 2 years ago

dhawals1939 commented 3 years ago

Hi,

I have successfully installed the psdr but I am unable to import the module in python.

I am using Ubuntu 20.04, with Nvidia GPU. I used the system python rather than Anaconda installation.

@shuangz25 Can you please help?

andyyankai commented 3 years ago

Did you add the build/lib folder to your python path? which contains the psdr_cuda.so file after your build

dhawals1939 commented 3 years ago

Yes, still there is no change, I am still receiving the import error. My python path PYTHONPATH=/home/dhawals/repos/mitsuba2/dist/python:/home/dhawals/repos/mitsuba2/build/dist/python:/home/dhawals1939/repos/psdr-cuda/build/lib

the build folder has following contents

.
├── bin
│   └── ptx
├── CMakeCache.txt
├── CMakeFiles
│   ├── 3.16.3
│   ├── 3.18.4
│   ├── cmake.check_cache
│   ├── CMakeDirectoryInformation.cmake
│   ├── CMakeError.log
│   ├── CMakeOutput.log
│   ├── CMakeRuleHashes.txt
│   ├── CMakeTmp
│   ├── Makefile2
│   ├── Makefile.cmake
│   ├── progress.marks
│   ├── psdr_cuda.dir
│   ├── ptx.dir
│   └── TargetDirectories.txt
├── cmake_install.cmake
├── lib
│   ├── psdr_cuda.so
│   └── ptx
└── Makefile

9 directories, 14 files
andyyankai commented 3 years ago

emmm, looks fine. Make sure you also add enoki to the correct path btw. Are you even able to import psdr_cuda or import enoki if you start your python shell in /lib/ folder? If not, try ldd psdr_cuda.so and see what is the output. This command will show you if there is any dependency problem.

dhawals1939 commented 3 years ago

Hi, This is the result I get when I run the import from lib directory.

>>> import psdr_cuda
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/dhawals/repos/psdr-cuda/build/lib/psdr_cuda.so: undefined symbol: _ZN7Imf_2_317globalThreadCountEv

The output of ldd is as follows

 linux-vdso.so.1 (0x00007ffc1dddf000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efe34885000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007efe3487a000)
        libenoki-cuda.so => /home/dhawals/repos/mitsuba2/build/ext_build/enoki/libenoki-cuda.so (0x00007efe3472c000)
        libenoki-autodiff.so => /home/dhawals/repos/mitsuba2/build/ext_build/enoki/libenoki-autodiff.so (0x00007efe34640000)
        libHalf.so => /lib/x86_64-linux-gnu/libHalf.so (0x00007efe345fb000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efe345d6000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efe343f4000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efe342a5000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efe3428a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efe34098000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efe34b22000)
        libcuda.so.1 => /lib/x86_64-linux-gnu/libcuda.so.1 (0x00007efe329b2000)
        libcudart.so.11.0 => /usr/local/cuda-11.2/lib64/libcudart.so.11.0 (0x00007efe32721000)
        libc++.so.1 => /lib/x86_64-linux-gnu/libc++.so.1 (0x00007efe3265f000)
        libc++abi.so.1 => /lib/x86_64-linux-gnu/libc++abi.so.1 (0x00007efe32627000)

When I run from other directories/location other than build/lib I still get module not found error.

My LD_PATH_LIBRARY is as follows /home/dhawals/repos/mitsuba2/build/ext_build/tbb:/usr/local/cuda-11.2/lib64:/home/dhawals/repos/mitsuba2/build/ext_build/enoki which includes the required enoki cuda and enoki autodiff packages

I am able to import enoki without any issues mitsuba as well

andyyankai commented 3 years ago

It looks like you have an old/inconsistant openEXR version with system and psdr_cuda, or maybe your openEXR didn't add to LD path? Try to upgrade your openEXR and make sure you are using that openEXR version while you call cmake psdr_cuda (with path added) I recommand using openexr 2.5 with and find its Imf...-2_5.so with path included. Again, make sure the building openEXR version for psdr_cuda should be same as the system default. For example, if you build psdr_cuda with openexr 2.5 but you system find 2.3 as default, you will get this import error. (and if you are outside this folder you will see no found error without telling you what happened in details)