https://pytorch.org/cppdocs/installing.html
git clone --branch master https://github.com/pytorch/pytorch pytorch-1.6cd pytorch-1.6
# git checkout v1.6.0 # v1.5.1
mkdir build
cd build
#--
mkdir build
cd build
#--
# module load tool_dev/python37 # pip3 install pyyaml glog caffe
module load conda/conda3 # conda install pyyaml glog caffe
module load mpi/ompi4.0.5-gcc10.2
module load tool_dev/cmake-3.18.0
export PATH=$PATH:/home1/p001cao/local/app/openmpi/4.0.5-gcc10.2/bin
##--
cmake ../ -DUSE_MPI=ON \-DPYTHON_EXECUTABLE:FILEPATH=/home1/p001cao/local/app/miniconda3/bin/python \
-DCMAKE_PREFIX_PATH=/home1/p001cao/local/app/pytorch-1.6
make -j 8
make -k check
make install
## configure options
-DCMAKE_CXX_FLAGS="-static-libstdc++" \
-DPYTHON_EXECUTABLE:FILEPATH=/home1/p001cao/local/app/tool_dev/python37/bin/python3
Ref: