title: Running a CUFFT rountine in Nvidia-Docker
body: <p>i'm new to Docker, especially to Nvidia-Docker. I'm trying to wrap my code into docker container and run it on some hosts. But apparently something goes wrong and i'm not able to run my code in docker. I have installed Nvidia-docker and Dockerfile is taken from <a href="https://gitlab.com/nvidia/container-images/cuda/blob/master/dist/ubuntu16.04/9.1/devel/Dockerfile" rel="nofollow noreferrer">here</a>. Here is my full docker code</p>
  
  <pre><code>FROM nvidia/cuda:9.1-runtime-ubuntu16.04
  RUN apt-get update &amp;&amp; apt-get install -y \
          cuda-command-line-tools-$CUDA_PKG_VERSION \
          cuda-libraries-dev-$CUDA_PKG_VERSION \
          cuda-minimal-build-$CUDA_PKG_VERSION \
  &amp;&amp; \
      rm -rf /var/lib/apt/lists/*
  
  ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs
  
  FROM python:3.7-slim
  RUN pip install numpy
  RUN apt update &amp;&amp; \
      apt-get -y install gcc &amp;&amp; \
      apt-get -y install g++
  ENV NVIDIA_VISIBLE_DEVICES all
  ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
  ADD helmsolver /helmsolver
  CMD dpkg -l | grep -i cuda
  CMD cd helmsolver &amp;&amp; bash tests.sh
  </code></pre>
  
  <p>And a bash script code where cudahelmf and cudahelmd are previously compiled by</p>
  
  <pre><code>nvcc helm3dcudafnd.cu -o cudahelm -I/usr/local/cuda/samples/common/inc/ -lcufft -lcufftw -D DOUBLE
  </code></pre>
  
  <pre><code>#!/bin/sh
  mkdir helmholtz
  cd helmholtz
          mkdir build
          mkdir workdir
          mkdir src
          mkdir scripts
          ls
          cp ../cudahelmf ./build
          cp ../cudahelmd ./build
          cp ../tmp.py ./scripts/
          cd workdir
          python3 ../scripts/script1.py 21 21 1
          ../build/cudahelmd config.cfg &gt;&gt; results_double.txt
          ../build/cudahelmf config.cfg &gt;&gt; results_float.txt
  </code></pre>
  
  <p>To build and run docker i use</p>
  
  <pre><code>nvidia-docker build -t helm .
  nvidia-docker run --rm -ti helm
  </code></pre>
  
  <p>And after running i have error</p>
  
  <pre><code>../build/cudahelmd: error while loading shared libraries: libcufft.so.9.1: cannot open shared object file: No such file or directory
  </code></pre>
  
  <p>What am i doing wrong? Does it happens because of the -lcufft compile option and docker doesn't know where to get it? And docker doesn't have /usr/local/cuda/ directory after installation. It seems strange due to cuda-libraries-dev include cufft library and installations ends successfully.</p>
  
  <p>Here is nvcc version on my computer where code was compiled and previously tested.</p>
  
  <pre><code>nvcc: NVIDIA (R) Cuda compiler driver
  Copyright (c) 2005-2017 NVIDIA Corporation
  Built on Fri_Nov__3_21:07:56_CDT_2017
  Cuda compilation tools, release 9.1, V9.1.85
  </code></pre>
  
  <p>And nvidia-docker version</p>
  
  <pre><code>Docker version 19.03.3, build a872fc2f86
  </code></pre>
  
  <p>P.S. Maybe there is an option to compile code in docker?</p>