CUDA is a parallel computing platform and programming model that makes using a GPU for general purpose computing simple and elegant. The developer still programs in the familiar C, C++, Fortran, or an ever expanding list of supported languages, and incorporates extensions of these languages in the form of a few basic keywords.

Versions and Availability

Module Names for cuda on smic
Machine Version Module Name
smic 6.0 cuda/6.0
smic 6.5 cuda/6.5
▶ **FIX-ME** FAQ?


Programming using GPU with CUDA depends on the language, choice of compilers, and toolset.

▶ Open Example?

Standard C:

void saxpy( int n, float a,
            float *x, float *y )
   for ( int i = 0; i < n; ++i )
      y[i] = a * x[i] + y[i];

int N = 1 << 20;

saxpy( N, 2.0, x, y );

C with CUDA Extensions:

void saxpy( int n, float a,
float *x, float *y )
   int i = blockIdx.x*blockDim.x + threadIdx.x;
   if ( i < n ) y[i] = a * x[i] + y[i];

int N = 1 << 20;
cudaMemcpy(x, d_x, N, cudaMemcpyHostToDevice);
cudaMemcpy(y, d_y, N, cudaMemcpyHostToDevice);

saxpy<<<4096,256>>>(N, 2.0, x, y);

cudaMemcpy(d_y, y, N, cudaMemcpyDeviceToHost);


Extensive trainings and tutorials available online, such as:

Last modified: August 14 2015 12:51:53.