Keras Deep Learning Cookbook
上QQ阅读APP看书,第一时间看更新

Installing cuda

  1. Execute the following command to execute cuda:
sudo apt-get install -y cuda
  1. Check that cuda is installed and run a basic program:
ls /usr/local/cuda-8.0
bin extras lib64 libnvvp nvml README share targets version.txt
doc include libnsight LICENSE nvvm samples src tools
  1. Let's run one of the cuda samples after compiling it locally:
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
cd /usr/local/cuda-8.0/samples/5_Simulations/nbody
  1. Compile the sample and run it as follows:
sudo make

./nbody

You will see output similar to the following listing:

Run "nbody -benchmark [-numbodies=<numBodies>]" to measure performance.
-fullscreen (run n-body simulation in fullscreen mode)
-fp64 (use double precision floating point values for simulation)
-hostmem (stores simulation data in host memory)
-benchmark (run benchmark to measure performance)
-numbodies=<N> (number of bodies (>= 1) to run in simulation)
-device=<d> (where d=0,1,2.... for the CUDA device to use)
-numdevices=<i> (where i=(number of CUDA devices > 0) to use for simulation)
-compare (compares simulation results running once on the default GPU and once on the CPU)
-cpu (run n-body simulation on the CPU)
-tipsy=<file.bin> (load a tipsy model file for simulation)
  1. Next we install cudnn, which is a deep learning library from NVIDIA. You can find more information at https://developer.nvidia.com/cudnn.