Hang seen in cmake while compiling pytorch from source

Hi Everyone,

I am seeing a hang while compiling pytorch from source:
sudo NO_CUDA=1 DEBUG=1 USE_MKLDNN=0 python3 setup.py build develop

The setup.py call stack is below which is calling cmake:
/usr/bin/pdb3(1688)()
-> pdb.main()
/usr/lib/python3.5/pdb.py(1661)main()
-> pdb._runscript(mainpyfile)
/usr/lib/python3.5/pdb.py(1542)_runscript()
-> self.run(statement)
/usr/lib/python3.5/bdb.py(431)run()
-> exec(cmd, globals, locals)
(1)()
/home/spodder/Code/pytorch_root/8thMay/pytorch/setup.py(153)()
-> from future import print_function
/home/spodder/Code/pytorch_root/8thMay/pytorch/setup.py(294)build_deps()
-> build_dir=‘build’)
/home/spodder/Code/pytorch_root/8thMay/pytorch/tools/build_pytorch_libs.py(269)build_caffe2()
-> my_env)
/home/spodder/Code/pytorch_root/8thMay/pytorch/tools/build_pytorch_libs.py(249)run_cmake()
-> check_call(cmake_args, cwd=build_dir, env=my_env)
/usr/lib/python3.5/subprocess.py(576)check_call()
-> retcode = call(*popenargs, **kwargs)
/usr/lib/python3.5/subprocess.py(559)call()
-> return p.wait(timeout=timeout)
/usr/lib/python3.5/subprocess.py(1658)wait()
-> (pid, sts) = self._try_wait(0)
/usr/lib/python3.5/subprocess.py(1608)_try_wait()
-> (pid, sts) = os.waitpid(self.pid, wait_flags)
/usr/lib/python3.5/pdb.py(191)sigint_handler()
-> signal.signal(signal.SIGINT, self._previous_sigint_handler)

/usr/lib/python3.5/signal.py(45)signal()

Cmake is stuck in below call stack:
#0 0x00007f09b2a995b3 in select () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x0000000000741fb2 in cmsysProcess_WaitForData ()
#2 0x0000000000542514 in cmSystemTools::RunSingleCommand(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int*, char const*, cmSystemTools::OutputOption, double) ()
#3 0x00000000005736a1 in cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile*) ()
#4 0x00000000006b79f1 in cmGlobalGenerator::EnableLanguage(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&, cmMakefile*, bool) ()
#5 0x000000000057380a in cmGlobalNinjaGenerator::EnableLanguage(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&, cmMakefile*, bool) ()
#6 0x00000000004f4a41 in cmMakefile::EnableLanguage(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&, bool) ()
#7 0x00000000005e8e58 in cmProjectCommand::InitialPass(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&, cmExecutionStatus&) ()
#8 0x00000000004fd86d in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#9 0x00000000004fdeb8 in cmMakefile::ReadListFile(cmListFile const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) ()
#10 0x00000000004ffe68 in cmMakefile::Configure() ()
#11 0x00000000006bf69b in cmGlobalGenerator::Configure() ()
#12 0x000000000055ba29 in cmake::ActualConfigure() ()
#13 0x000000000055c3b4 in cmake::Configure() ()
#14 0x0000000000561740 in cmake::Run(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&, bool) ()
#15 0x00000000004bdf94 in do_cmake(int, char const* const*) ()
#16 0x00000000004b98e6 in main ()

The cmake commandline is:
root 9981 0.0 0.0 151628 10884 pts/19 S+ 13:58 0:00 cmake -GNinja -DBUILDING_WITH_TORCH_LIBS=ON -DBUILD_BINARY=False -DBUILD_CAFFE2_OPS=True -DBUILD_PYTHON=True -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=True -DBUILD_TORCH=ON -DCAFFE2_STATIC_LINK_CUDA=False -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS= -DCMAKE_C_FLAGS= -DCMAKE_EXE_LINKER_FLAGS= -DCMAKE_INSTALL_PREFIX=/home/spodder/Code/pytorch_root/8thMay/pytorch/torch -DCMAKE_PREFIX_PATH=/usr/lib/python3/dist-packages -DCMAKE_SHARED_LINKER_FLAGS= -DINSTALL_TEST=True -DNCCL_EXTERNAL=False -DNUMPY_INCLUDE_DIR=/usr/local/lib/python3.5/dist-packages/numpy/core/include -DONNX_ML=False -DONNX_NAMESPACE=onnx_torch -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m -DPYTHON_LIBRARY=/usr/lib/libpython3.5m.so.1.0 -DTHD_SO_VERSION=1 -DTORCH_BUILD_VERSION=1.1.0a0+26dd65e -DUSE_CUDA=False -DUSE_DISTRIBUTED=True -DUSE_FBGEMM=True -DUSE_FFMPEG=False -DUSE_LEVELDB=False -DUSE_LMDB=False -DUSE_MKLDNN=False -DUSE_NCCL=False -DUSE_NNPACK=True -DUSE_NUMPY=True -DUSE_OPENCV=False -DUSE_QNNPACK=True -DUSE_ROCM=False -DUSE_SYSTEM_EIGEN_INSTALL=OFF -DUSE_SYSTEM_NCCL=False -DUSE_TENSORRT=False /home/spodder/Code/pytorch_root/8thMay/pytorch

I have seen this cmake issue being discussed online, but did not find any solution.
Has anyone else encountered this issue?

Thanks

1 Like