Torch dependencies when installing from source

I have installed PyTorch from source using an Anaconda environment.

I did setup CMAKE_PREFIX_PATH to point to anaconda’s root directory. After installation it seems that Torch dependencies are linked to system shared libraries, and not to those in anaconda3/lib/. Is this normal?

More precisely, should libiomp5.so.1 be linked to [...]/anaconda3/lib/libiomp5.so.1 and/or should libgomp.so.1 be linked to [...]/anaconda3/lib/libgomp.so.1 instead of /usr/lib/x86_64-linux-gnu/libgomp.so.1?

$ ldd torch/lib/libTHC.so.1 
	linux-vdso.so.1 =>  (0x00007fffeebe7000)
	libcudart.so.8.0 => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudart.so.8.0 (0x00007fb1aac3a000)
	libcublas.so.8.0 => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcublas.so.8.0 (0x00007fb1a8289000)
	libTH.so.1 => /home/tudor/pytorch/torch/lib/libTH.so.1 (0x00007fb1a7c92000)
	libcurand.so.8.0 => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcurand.so.8.0 (0x00007fb1a3d29000)
	libcusparse.so.8.0 => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcusparse.so.8.0 (0x00007fb1a121a000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb1a0e98000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb1a0b8f000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb1a0978000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb1a05af000)
	/lib64/ld-linux-x86-64.so.2 (0x0000562627347000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb1a03ab000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb1a018d000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb19ff85000)
	libmkl_intel_lp64.so => not found
	libmkl_intel_thread.so => not found
	libmkl_core.so => not found
	libiomp5.so => not found
	libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fb19fd61000)
1 Like

Which libgomp will be used depends on the compiler you used to build PyTorch. If you install gcc from anaconda, it will be linked with /anaconda3/lib/libgomp.so.1, if you use a system compiler, it will be linked with a system-wide lib dir. Both ways should work ok.

1 Like