Difference between revisions of "GPU"

From Dynamo
Jump to: navigation, search
(Using the GPU in an alignment project)
Line 56: Line 56:
  
 
Your execution environment should include a {{t|LD_LIBRARY_PATH}} environment variable that includes the location of the CUDA libraries.
 
Your execution environment should include a {{t|LD_LIBRARY_PATH}} environment variable that includes the location of the CUDA libraries.
You probably need to inform your UNIX shell with the command:
+
You probably need to inform your UNIX shell with a command similar to this:
  
 
<tt>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda75/lib</tt>
 
<tt>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda75/lib</tt>
  
(replace with the location of the CUDA libraries in your system).  
+
Here, replace with the location of the CUDA libraries in your system. If you have several CUDA installations, choose the one that you used to compile ''Dynamo'' in your system.
 
Also if you are going to work under Matlab you should update your {{t|LD_LIBRARY_PATH}} variable in the Linux shell before starting Matlab.
 
Also if you are going to work under Matlab you should update your {{t|LD_LIBRARY_PATH}} variable in the Linux shell before starting Matlab.
  

Revision as of 16:24, 12 July 2016

GPU stands for "Graphic Processing Unit". If you have access to a dedicated GPU device, the iteration procedure will run much faster. While Dynamo can run its GPU functionalities in most Nvidia cards, a real advantage will be measured for those cards that are conceived for scientific computation. The Tesla series and the Titan series are examples of this.

Installation

A regular distribution of Dynamo will include GPU precompiled GPU executables. As they need to be linked to libraries that might not be present in your system, it is advised that you recompile them:

After untarring the tar package in location DYNAMO_ROOT, go to

cd DYNAMO_ROOT/cuda

and make certain that you have CUDA active in your shell, for instance look for the NVIDIA nvcc compiler:

which nvcc

If this is succcessful run

source config.sh

This will automatically edit the makefile file in the folder, informing it on the location of CUDA in your system. In order to be sure, you can also edit the makefile text file and make sure that the line

CUDA_ROOT=/usr/local/cuda-7.5

have been edited to the correct CUDA libraries on your system. The CUDA_ROOT variable expected here can be infered from the path to the detected nvcc compiler by <CUDA_ROOT>/bin/nvcc

Once your makefile is correctly formated, you can just type:

make clean

to delete the executables already shipped in the distribution (which might not be compatible with your libraries), and then

make all

to recompile the executables in your system.

CUDA libraries

You need to have CUDA installed on your system. This might require coordinating with your system administrator.

Versions

Dynamo has been tested with most CUDA versions. CUDA 7.0 was found to show problems in the Fourier transform libraries: don't use it. We advice to use the highest available CUDA libraries, at least CUDA 7.5 per 18/04/2016.

Testing your system

In the Linux shell type: nvidia-smi to get a list of the GPU devices that your system is seeing, their status and the jobs currently running. This order also shows the device number assigned by the system to each device, which you need to enter in a Dynamo project through the parameter gpu_identifier_set

Speed up

This iis of course highly dependent on the system: which GPUs you are comparing against which CPU cores.

It also depends on the particle size and on the number of angles scanned per particle (higher number will yield higher speed up factors, i.e., the more intensive a computation, the more favorable for GPU)

Using the GPU in an alignment project

Your execution environment should include a LD_LIBRARY_PATH environment variable that includes the location of the CUDA libraries. You probably need to inform your UNIX shell with a command similar to this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda75/lib

Here, replace with the location of the CUDA libraries in your system. If you have several CUDA installations, choose the one that you used to compile Dynamo in your system. Also if you are going to work under Matlab you should update your LD_LIBRARY_PATH variable in the Linux shell before starting Matlab.

With the dcp GUI

Go to the Computing environment GUI. Select 'matlab gpu' or 'system gpu' Set the gpu identifier set field to the device numbers given to your GPUs by the operative system. You can select a subset of the available GPUs. If you have a GPU that controls the screen display, you can technically use it for GPU computations, but it is not advisable, as it will be typically much slower than GPUs intended for computation.

With the command line

There are two project parameters related the the GPU: the destination parameter and the gpu_identifier_set parameter. The destination must be set to matlab_gpu (to run projects inside Matlab) or to system_gpu

Checking your system

Main article: GPU identifiers

In a linux machine nvidia-smi will give you a status summary of the installed, reachable GPUs. In the example image, you would use an identifier_set of 1,2 to. Alternatively, you could run different projects on device 1 and 2. In any case, device 0 is not intended for GPU computing.

A screenshot on nvidia-smi showing three devices