Ubuntu18.04 编译 sparse-ncnet

依赖环境

  1. 系统环境
  • gcc/g++-7
  • cuda-10.1
  1. conda环境
conda create -n sparsencnet python=3.6.9=h265db76_0
conda activate sparsencnet
conda install numpy openblas
conda install libstdcxx-ng 

# set environment variables for the compilation of MinkowskiEngine
export CUDA_HOME=/your_path_to/cuda-10.1.243
export LD_LIBRARY_PATH="${CUDA_HOME}/lib64":"${CONDA_PREFIX}/lib":"/usr/lib/x86_64-linux-gnu/"
export PATH="${CONDA_PREFIX}/bin":"${CUDA_HOME}/bin":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# 这里我设置为系统的g++-7
export CPP="/usr/bin/g++ -E"
export CXX="/usr/bin/g++"
export LIBRARY_PATH=$LD_LIBRARY_PATH
export PYTHONPATH="${CONDA_PREFIX}/lib/python3.6/site-packages/"

# install PyTorch and ME ,ME源码安装
pip install torch==1.3.1 torchvision==0.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
python
import torch
torch.cuda.is_available()

git clone https://github.com/StanfordVL/MinkowskiEngine.git
cd MinkowskiEngine
export CXX=g++-7; python setup.py install

# 测试 MinkowskiEngine
python
import MinkowskiEngine as ME

# 改用源码编译faiss-gpu,用conda安装没跑成功
git clone https://github.com/facebookresearch/faiss.git
cd faiss
LDFLAGS=-L/home/jiajie/anaconda3/envs/sparsencnet-test/lib/ ./configure --with-cuda=/usr/local/cuda --with-python=python3.6m --with-cuda-arch="-gencode=arch=compute_75,code=sm_75"
make && sudo make install
make -C python
make -C python install


# install some additional libraries
conda install matplotlib scikit-image pandas

# replace pillow with pillow-simd
pip uninstall pillow
CC="cc -mavx2" pip install -U --force-reinstall "pillow-simd==6.2.2.post1" -i https://pypi.tuna.tsinghua.edu.cn/simple

# install jupyter lab for evaluation on HPatches-Seq
conda install -c conda-forge jupyterlab

相关推荐