Graphics Processor Unit (GPU) Programming in MFCF GPU servers

GPU programming

A GPU device is used as a co-processor (or accelerator) to assist the multi-purpose CPU in highly parallelized tasks. The MFCF GPU servers have GPU software including CUDA, openCL, Python libraries, and MATLAB.

CUDA

CUDA is an NVIDIA development environment implemented as an extension of the C library. CUDA code files usually have .cu extension. The 'nvcc' command is used to compile the CUDA program. It is a compiler driver that simplifies the process of compiling C code and Parallel Thread Execution (PTX) code. As an example, to compile example.cu file use the following command:


 % nvcc  example.cu -o example

References

OpenCL

openCL is a framework for developing applications that execute across a range of device types made by different vendors. Files that contain openCL-specific code usually have .cl extension. Example of compiling openCL code is shown below:


 % gcc -I /usr/local/cuda/include  -L /usr/local/cuda/lib64 -lOpenCL -o hello hello.c

References

Python

Python has many libraries that work with GPUs, such as Tensorflow and Theano. Within the code, you specify which GPUs to use, then you run the python code, e.g.:


 % python tensorflow-python.py 

References:

MATLAB

MATLAB has GPU libraries that allow you to access GPUs.

References