NVlabs / planercnn

PlaneRCNN detects and reconstructs piece-wise planar surfaces from a single RGB image
Other
559 stars 124 forks source link

Docker image #65

Open mohammad-h-b opened 3 years ago

mohammad-h-b commented 3 years ago

Hi developers,

Can you please provide a docker image with the right version of CUDA and gcc?

I have an RTX 2080 GPU and CUDA 11.2 and gcc 7.5.0.

oOXpycTOo commented 3 years ago

I've created Dockerfile and it seems to work properly on K80 instance. Here it's:

FROM tobycheese/cuda:9.0-cudnn7-devel-ubuntu18.04

RUN apt-get update && apt-get install -y software-properties-common

RUN add-apt-repository ppa:deadsnakes/ppa -y

RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    tmux \
    nano \
        apt-utils \
        python3.6 \
        python3.6-dev \
        python3-pip \
        python3-setuptools \
        g++-6 \
        libsm6 \
        libxrender1 \
        libxtst6 \
        && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get update

RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 10 && \
    update-alternatives --set g++ /usr/bin/g++-6
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 10 && \
    update-alternatives --set gcc /usr/bin/gcc-6

RUN git clone https://github.com/NVlabs/planercnn.git

RUN cd planercnn && pip3 install -r requirements.txt && pip3 install h5py torch==0.4.0 -f https://download.pytorch.org/whl/cu92/torch_stable.html

RUN gcc -v && cat /usr/local/cuda/version.txt

RUN ls /usr/local | grep cuda

RUN cd planercnn && \
    cd nms/src/cuda/ && \
    nvcc -c -o nms_kernel.cu.o nms_kernel.cu -I /usr/local/cuda/include -x cu -Xcompiler -fPIC -arch=sm_37
RUN export LD_LIBRARY_PATH="/usr/local/cuda/include:$LD_LIBRARY_PATH" && \
    cd planercnn/nms && \
    sed -i 's|extra_objects=extra_objects|extra_objects=extra_objects,\n    include_dirs=["/usr/local/cuda/include"]|' build.py && \
    python3 build.py
RUN cd planercnn/roialign/roi_align/src/cuda && \
    nvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -I /usr/local/cuda/include -x cu -Xcompiler -fPIC -arch=sm_37
RUN cd planercnn/roialign/roi_align && \
    export LD_LIBRARY_PATH="/usr/local/cuda-9.2/include:$LD_LIBRARY_PATH" && \
    sed -i 's|extra_compile_args=extra_compile_args|extra_compile_args=extra_compile_args,\n    include_dirs=["/usr/local/cuda/include"]|' build.py && \
    python3 build.py

RUN pip3 install torch==0.4.1 -f https://download.pytorch.org/whl/cu92/torch_stable.html

However, when you're inside docker you'll have to rerun compilation and build of nms and roi_align as GPU is not visible to the while building docker.

So, just run:

cd planercnn
cd nms/src/cuda/
nvcc -c -o nms_kernel.cu.o nms_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
cd ../../
python build.py
cd ../

cd roialign/roi_align/src/cuda/
nvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
cd ../../
python build.py
cd ../../
GauravGajbhiye commented 1 year ago

Hi @oOXpycTOo, I am using dockerfile created by you for "planercnn" project. I am having a system with 4 GPU's with Cuda 11.4. While creating the image, I got following error for instruction RUN apt-get update && apt-get install -y software-properties-common:

W: GPG error: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC E: The repository 'https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease' is not signed. The command '/bin/sh -c apt-get update && apt-get install -y software-properties-common' returned a non-zero code: 100

I have tried a lot of experimentation but could not resolve it. Kindly help me to get out of it. Thanks.