Prerequisite

앞서 설명했던 MinkowskiEngine docker 환경에서 SPVNAS를 실행시키는 것을 목표로 해본다. Docker 환경에서 설치하기 때문에 sudo는 생략한다.

먼저, torchpack 명령어를 사용하기 위해서는 환경 상 OpenMPI가 설치되어 있어야 한다. 만약 mpirun을 쳤을 때, command가 없다고 뜬다면, 아래 명령어를 통해 설치한다.

apt-get update
apt-get install libpmix-dev
apt-get install openmpi-bin openmpi-common libopenmpi-dev

그 후, docker에서 mpirun을 입력하면 아래와 같은 화면이 나온다.

--------------------------------------------------------------------------
mpirun has detected an attempt to run as root.

Running as root is *strongly* discouraged as any mistake (e.g., in
defining TMPDIR) or bug can result in catastrophic damage to the OS
file system, leaving your system in an unusable state.

We strongly suggest that you run mpirun as a non-root user.

You can override this protection by adding the --allow-run-as-root option
to the cmd line or by setting two environment variables in the following way:
the variable OMPI_ALLOW_RUN_AS_ROOT=1 to indicate the desire to override this
protection, and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 to confirm the choice and
add one more layer of certainty that you want to do so.
We reiterate our advice against doing so - please proceed at your own risk.
--------------------------------------------------------------------------

잘 설치가 됐음을 확인했다면, torchpack을 설치한다.

pip3 install backports.cached_property backports.weakref
pip3 install torchpack

그 후, torchsparse를 설치해야 하는데, 나의 로컬 컴퓨터의 docker 환경에서는 2.2.1 버전의 Pytorch를 사용하고 있었다. torchsparse를 설치하기 위해서는 아래와 같이 github 레포지토리를 위해 직접 설치해주었다.

// Required package
apt-get install libsparsehash-dev
// Install torchsparse
git clone https://github.com/mit-han-lab/torchsparse.git
cd torchsparse && python3 setup.py install

apt-get install libsparsehash-dev를 실행하지 않으면, #include <google/dense_hash_map>가 안된다는 에러가 발생하니, 주의하자.