Dockerfile_cuda 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
  2. RUN apt-get clean && apt-get update && apt-get install -y locales
  3. RUN locale-gen en_US.UTF-8
  4. ENV LANG en_US.UTF-8
  5. ENV LANGUAGE en_US:en
  6. ENV LC_ALL en_US.UTF-8
  7. # Install all dependencies for OpenCV
  8. RUN apt-get -y update && \
  9. apt-get -y install \
  10. python3 \
  11. python3-dev \
  12. git \
  13. wget \
  14. unzip \
  15. cmake \
  16. build-essential \
  17. pkg-config \
  18. libatlas-base-dev \
  19. gfortran \
  20. libgtk-3-dev \
  21. libavcodec-dev \
  22. libavformat-dev \
  23. libswscale-dev \
  24. libjpeg-dev \
  25. libpng-dev \
  26. libtiff-dev \
  27. libv4l-dev \
  28. && \
  29. # install python dependencies
  30. wget https://bootstrap.pypa.io/get-pip.py && \
  31. python3 get-pip.py && \
  32. rm get-pip.py && \
  33. pip3 install numpy && \
  34. pip3 install matplotlib && \
  35. pip3 install Pillow && \
  36. pip3 install glob2 && \
  37. pip3 install scikit-image && \
  38. pip3 install numba && \
  39. pip3 install vtk && \
  40. pip3 install pyCUDA && \
  41. # Install OpenCV
  42. git clone https://github.com/opencv/opencv.git && \
  43. cd opencv && \
  44. git checkout 4.2.0 && \
  45. cd .. && \
  46. git clone https://github.com/opencv/opencv_contrib.git && \
  47. cd opencv_contrib && \
  48. git checkout 4.2.0 && \
  49. cd .. && \
  50. cd opencv && \
  51. # Prepare build
  52. mkdir build && cd build && \
  53. cmake -D CMAKE_BUILD_TYPE=RELEASE \
  54. -D BUILD_PYTHON_SUPPORT=ON \
  55. -D CMAKE_INSTALL_PREFIX=/usr/local \
  56. -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
  57. -D BUILD_EXAMPLES=OFF \
  58. -D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \
  59. -D BUILD_opencv_python3=ON \
  60. -D BUILD_opencv_python2=OFF \
  61. -D WITH_IPP=OFF \
  62. -D WITH_FFMPEG=ON \
  63. -D WITH_CUDA=ON \
  64. -DCUDA_ARCH=35 \
  65. -DCUDA_ARCH_BIN=6.1,7.0,7.5 \
  66. -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.1 \
  67. -D WITH_CUBLAS=ON \
  68. -D WITH_V4L=ON .. \
  69. && \
  70. # Install
  71. make -j$(nproc) && \
  72. make install && \
  73. ldconfig \
  74. && \
  75. # Clean
  76. apt-get -y remove \
  77. python3-dev \
  78. libatlas-base-dev \
  79. gfortran \
  80. libgtk-3-dev \
  81. libavcodec-dev \
  82. libavformat-dev \
  83. libswscale-dev \
  84. libjpeg-dev \
  85. libpng-dev \
  86. libtiff-dev \
  87. libv4l-dev \
  88. && \
  89. apt-get clean && \
  90. rm -rf /opencv /opencv_contrib /var/lib/apt/lists/*
  91. COPY lossy_image_cuda.py /
  92. COPY vtk_test.py /
  93. CMD [ "python3", "./lossy_image_cuda.py" ]