rbharath:~/Tensorflow-singularity-container-with-GPU-support$ sudo singularity shell -w ubuntu_tensorflow_GPU.imgSingularity: Invoking an interactive shell within container...Singularity.ubuntu_tensorflow_GPU.img> # nvidia-smiSun Dec 25 07:35:43 2016+-----------------------------------------------------------------------------+| NVIDIA-SMI 367.57 Driver Version: 367.57 ||-------------------------------+----------------------+----------------------+| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC || Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. ||===============================+======================+======================|| 0 GeForce GTX 1080 Off | 0000:01:00.0 On | N/A || 27% 37C P8 12W / 180W | 62MiB / 8110MiB | 0% Default |+-------------------------------+----------------------+----------------------+| 1 GeForce GTX 1080 Off | 0000:02:00.0 Off | N/A || 27% 34C P8 11W / 180W | 1MiB / 8113MiB | 0% Default |+-------------------------------+----------------------+----------------------++-----------------------------------------------------------------------------+| Processes: GPU Memory || GPU PID Type Process name Usage ||=============================================================================|| 0 3509 G /usr/lib/xorg/Xorg 60MiB |+-----------------------------------------------------------------------------+Singularity.ubuntu_tensorflow_GPU.img> # ldconfig -p | grep libcudalibcudart.so.8.0 (libc6,x86-64) => /usr/local/cuda/lib64/libcudart.so.8.0libcudart.so (libc6,x86-64) => /usr/local/cuda/lib64/libcudart.solibcuda.so.1 (libc6,x86-64) => /usr/local/NVIDIA-Linux-x86_64-367.57/libcuda.so.1libcuda.so (libc6,x86-64) => /usr/local/NVIDIA-Linux-x86_64-367.57/libcuda.soSingularity.ubuntu_tensorflow_GPU.img> # ipython/usr/local/lib/python2.7/dist-packages/IPython/paths.py:69: UserWarning: IPython parent '/home/rbharath' is not a writable location, using a temp directory." using a temp directory.".format(parent))Python 2.7.6 (default, Oct 26 2016, 20:30:19)Type "copyright", "credits" or "license" for more information.IPython 5.1.0 -- An enhanced Interactive Python.? -> Introduction and overview of IPython's features.%quickref -> Quick reference.help -> Python's own help system.object? -> Details about 'object', use 'object??' for extra details.In [1]: import tensorflow as tfIn [2]: tf.Session(config=tf.ConfigProto(log_device_placement=True))Device mapping: no known devices.I tensorflow/core/common_runtime/direct_session.cc:255] Device mapping:Out[2]: <tensorflow.python.client.session.Session at 0x7f97c853b210>
sh build.sh############# build.shecho "Removing old GPU image"sudo rm -f ubuntu_tensorflow_GPU.imgecho "Creating GPU image"sudo singularity create -s 5000 ubuntu_tensorflow_GPU.imgecho "Bootstrapping image"sudo singularity bootstrap ubuntu_tensorflow_GPU.img tf-gpu.defecho "Running tensorflow install script"sudo singularity exec -B `pwd`:/mnt -w ubuntu_tensorflow_GPU.img sh /mnt/tensorflow.sh############# tf-gpu.def# Copyright (c) 2015-2016, Gregory M. Kurtzer. All rights reserved.## "Singularity" Copyright (c) 2016, The Regents of the University of California,# through Lawrence Berkeley National Laboratory (subject to receipt of any# required approvals from the U.S. Dept. of Energy). All rights reserved.BootStrap: dockerFrom: tensorflow/tensorflow:latest-gpuIncludeCmd: yes%runscriptexec /usr/bin/python "$@"%postapt-get update && apt-get -y upgradeapt-get install git -y############# tensorflow.shdriver_version=367.57cuda_version=8.0.44_linuxcudnn_version=8.0-linux-x64-v5.1sh /mnt/NVIDIA-Linux-x86_64-$driver_version.run -xmv NVIDIA-Linux-x86_64-$driver_version /usr/local/sh /mnt/links.sh $driver_versionsh /mnt/cuda_$cuda_version.run --toolkit --silenttar xvf /mnt/cudnn-$cudnn_version.tgz -C /usr/localdriver_path=/usr/local/NVIDIA-Linux-x86_64-$driver_versionsudo echo "/usr/local/cuda/lib64" >> /etc/ld.so.confsudo echo "$driver_path" >> /etc/ld.so.conf# ldconfig doesn't list lubcuda*/libcudnn* without explicit commandssudo ldconfig /usr/local/cuda/lib64sudo ldconfig $driver_pathecho " " >> /environmentecho "LD_LIBRARY_PATH=/usr/local/cuda/lib64:$driver_path:$LD_LIBRARY_PATH" >> /environmentecho "PATH=$driver_path:\$PATH" >> /environmentecho "export CUDA_HOME=/usr/local/cuda" >> /environmentecho "export PATH LD_LIBRARY_PATH" >> /environment############# links.sh#!/usr/bin/bashdir=/usr/local/NVIDIA-Linux-x86_64-$1cd $dirln -s libcuda.so.$1 libcuda.soln -s libEGL.so.$1 libEGL.soln -s libGLESv1_CM.so.$1 libGLESv1_CM.soln -s libGLESv2.so.$1 libGLESv2.soln -s libGL.so.$1 libGL.soln -s libglx.so.$1 libglx.soln -s libnvcuvid.so.$1 libnvcuvid.soln -s libnvidia-cfg.so.$1 libnvidia-cfg.soln -s libnvidia-compiler.so.$1 libnvidia-compiler.soln -s libnvidia-eglcore.so.$1 libnvidia-eglcore.soln -s libnvidia-encode.so.$1 libnvidia-encode.soln -s libnvidia-fbc.so.$1 libnvidia-fbc.soln -s libnvidia-glcore.so.$1 libnvidia-glcore.soln -s libnvidia-glsi.so.$1 libnvidia-glsi.soln -s libnvidia-gtk2.so.$1 libnvidia-gtk2.soln -s libnvidia-gtk3.so.$1 libnvidia-gtk3.soln -s libnvidia-ifr.so.$1 libnvidia-ifr.soln -s libnvidia-ml.so.$1 libnvidia-ml.soln -s libnvidia-ml.so.$1 libnvidia-ml.so.1ln -s libnvidia-opencl.so.$1 libnvidia-opencl.soln -s libnvidia-tls.so.$1 libnvidia-tls.soln -s libnvidia-wfb.so.$1 libnvidia-wfb.soln -s libvdpau_nvidia.so.$1 libvdpau_nvidia.soln -s libvdpau.so.$1 libvdpau.soln -s libvdpau_trace.so.$1 libvdpau_trace.soln -s libcuda.so.$1 libcuda.so.1
--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.
rbharath@tensorbr0:~/Tensorflow-singularity-container-with-GPU-support$ sudo singularity run ubuntu_tensorflow_GPU.img[sudo] password for rbharath:
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import tensorflow as tf
>>> tf.Session(config=tf.ConfigProto(log_device_placement=True))Device mapping: no known devices.I tensorflow/core/common_runtime/direct_session.cc:255] Device mapping:
<tensorflow.python.client.session.Session object at 0x7f07bf8c1e90>
rbharath@tensorbr0:~/Tensorflow-singularity-container-with-GPU-support$ /usr/bin/pythonPython 2.7.12 (default, Nov 19 2016, 06:48:10)[GCC 5.4.0 20160609] on linux2Type "help", "copyright", "credits" or "license" for more information.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
I was hitting the same problem. This seems very odd, but it appears the Docker image being returned does not include a version of TensorFlow built for GPUs.
I tried the version being used on Sherlock (tensorflow/tensorflow:0.11.0rc2-gpu) as well as a new version that is listed on DockerHub (tensorflow/tensorflow:latest-gpu). Neither seems to include GPU support.
If you take the Singularity container from above and run the following commands, you should end up with a version that works:
pip uninstall tensorflow protobuf
pip install --upgrade
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl
To test, run the Singularity and enter this into the Python
interpreter:
import tensorflow as tf
sess =
tf.Session(config=tf.ConfigProto(log_device_placement=True))
The way to tell whether you've got a GPU-enabled TensorFlow is to see if any CUDA messages are printed when the tensorflow Python module is imported. A non-GPU version will look like this:
>>> import tensorflow as tf
>>>
A GPU-enabled version will look something like this:
>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:111]
successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111]
successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111]
successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111]
successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111]
successfully opened CUDA library libcurand.so locally
>>>
P.S. I was also hitting the issue of the nvidia-uvm
Linux kernel module needing to be loaded before the GPUs could be
accessed from within the container. The nvidia-smi
utility does not need uvm loaded, so it's not the best test that
CUDA is operational. Better to use some of the samples included
with CUDA (they'll return CUDA errors). Once the host had loaded
nvidia-uvm, all ran fine.