Repository: cvat-ai/cvat
Pull request: updated CUDA to version 10
Resolve #1133

Problem statement:
Need to update CUDA to 10 version.
Currently Installed tensorflow 1.13.1 is incompatible with cuda9.
```
Traceback (most recent call last):
  File "/home/django/manage.py", line 21, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 361, in execute
    self.check()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 584, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 577, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/django/urls.py", line 3, in <module>
    from cvat.urls import *
  File "/home/django/cvat/urls.py", line 35, in <module>
    urlpatterns.append(path('tensorflow/annotation/', include('cvat.apps.tf_annotation.urls')))
  File "/usr/local/lib/python3.5/dist-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/django/cvat/apps/tf_annotation/urls.py", line 7, in <module>
    from . import views
  File "/home/django/cvat/apps/tf_annotation/views.py", line 20, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
```

Hints from issue discussion:

Commit message: updated CUDA to version 10

Patch to review:
diff --git a/components/cuda/docker-compose.cuda.yml b/components/cuda/docker-compose.cuda.yml
index 66445f12437c..6c1076bd83dc 100644
--- a/components/cuda/docker-compose.cuda.yml
+++ b/components/cuda/docker-compose.cuda.yml
@@ -15,4 +15,4 @@ services:
     environment:
       NVIDIA_VISIBLE_DEVICES: all
       NVIDIA_DRIVER_CAPABILITIES: compute,utility
-      NVIDIA_REQUIRE_CUDA: "cuda>=9.0"
+      NVIDIA_REQUIRE_CUDA: "cuda>=10.0 brand=tesla,driver>=384,driver<385 brand=tesla,driver>=410,driver<411"
diff --git a/components/cuda/install.sh b/components/cuda/install.sh
index 485ae989bdee..d80597d08c51 100755
--- a/components/cuda/install.sh
+++ b/components/cuda/install.sh
@@ -14,24 +14,25 @@ echo "$NVIDIA_GPGKEY_SUM  cudasign.pub" | sha256sum -c --strict - && rm cudasign
 echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/cuda.list && \
 echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
 
-CUDA_VERSION=9.0.176
-NCCL_VERSION=2.1.15
-CUDNN_VERSION=7.6.2.24
-CUDA_PKG_VERSION="9-0=${CUDA_VERSION}-1"
+CUDA_VERSION=10.0.130
+NCCL_VERSION=2.5.6
+CUDNN_VERSION=7.6.5.32
+CUDA_PKG_VERSION="10-0=$CUDA_VERSION-1"
 echo 'export PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}' >> ${HOME}/.bashrc
 echo 'export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}' >> ${HOME}/.bashrc
 
 apt-get update && apt-get install -y --no-install-recommends --allow-unauthenticated \
-    libprotobuf-dev \
-    libprotoc-dev \
-    protobuf-compiler \
     cuda-cudart-$CUDA_PKG_VERSION \
+    cuda-compat-10-0 \
     cuda-libraries-$CUDA_PKG_VERSION \
-    libnccl2=$NCCL_VERSION-1+cuda9.0 \
-    libcudnn7=$CUDNN_VERSION-1+cuda9.0 && \
-    ln -s cuda-9.0 /usr/local/cuda && \
+    cuda-nvtx-$CUDA_PKG_VERSION \
+    libnccl2=$NCCL_VERSION-1+cuda10.0 \
+    libcudnn7=$CUDNN_VERSION-1+cuda10.0 && \
+    ln -s cuda-10.0 /usr/local/cuda && \
+    apt-mark hold libnccl2 libcudnn7  && \
     rm -rf /var/lib/apt/lists/* \
     /etc/apt/sources.list.d/nvidia-ml.list /etc/apt/sources.list.d/cuda.list
 
 python3 -m pip uninstall -y tensorflow
 python3 -m pip install --no-cache-dir tensorflow-gpu==1.13.1
+


Code review comments:
diff_hunk: @@ -14,24 +14,25 @@ echo "$NVIDIA_GPGKEY_SUM  cudasign.pub" | sha256sum -c --strict - && rm cudasign
 echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/cuda.list && \
 echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
 
-CUDA_VERSION=9.0.176
-NCCL_VERSION=2.1.15
-CUDNN_VERSION=7.6.2.24
-CUDA_PKG_VERSION="9-0=${CUDA_VERSION}-1"
+CUDA_VERSION=10.0.130
+NCCL_VERSION=2.5.6
+CUDNN_VERSION=7.6.5.32
+CUDA_PKG_VERSION="10-0=$CUDA_VERSION-1"
 echo 'export PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}' >> ${HOME}/.bashrc
 echo 'export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}' >> ${HOME}/.bashrc
 
 apt-get update && apt-get install -y --no-install-recommends --allow-unauthenticated \
-    libprotobuf-dev \
-    libprotoc-dev \
-    protobuf-compiler \
     cuda-cudart-$CUDA_PKG_VERSION \
+    cuda-compat-10-0 \
     cuda-libraries-$CUDA_PKG_VERSION \
-    libnccl2=$NCCL_VERSION-1+cuda9.0 \
-    libcudnn7=$CUDNN_VERSION-1+cuda9.0 && \
-    ln -s cuda-9.0 /usr/local/cuda && \
+    cuda-nvtx-$CUDA_PKG_VERSION \
+    libnccl2=$NCCL_VERSION-1+cuda10.0 \
+    libcudnn7=$CUDNN_VERSION-1+cuda10.0 && \
+    ln -s cuda-10.0 /usr/local/cuda && \
+    apt-mark hold libnccl2 libcudnn7  && \
     rm -rf /var/lib/apt/lists/* \
     /etc/apt/sources.list.d/nvidia-ml.list /etc/apt/sources.list.d/cuda.list
 
 python3 -m pip uninstall -y tensorflow
 python3 -m pip install --no-cache-dir tensorflow-gpu==1.13.1
path: components/cuda/install.sh
text: @user1:
Can we update tensorflow with the patch till the latest version?