13.07.2015 Views

CUDA Libraries and MPI+OpenMP+CUDA - Prace Training Portal

CUDA Libraries and MPI+OpenMP+CUDA - Prace Training Portal

CUDA Libraries and MPI+OpenMP+CUDA - Prace Training Portal

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

fft3Dtest.cu – Code Snippet (C++)long h_offset=0;for(int i=0; i < totalFFT; i += nGPU*nPerCall) {for(int j=0; j < nGPU; j++) {cudaSetDevice(j);cudaMemcpyAsync(d_data[j], ((char*)h_data)+h_offset,bytesPerGPU, cudaMemcpyDefault,streams[j]);cforwardFFT_(fftPlanMany[j],d_data[j], d_data[j]);cinverseFFT_(fftPlanMany[j],d_data[j], d_data[j]);}}cudaMemcpyAsync(((char*)h_data)+h_offset, d_data[j],bytesPerGPU, cudaMemcpyDefault,streams[j]);h_offset += bytesPerGPU;cudaDeviceSynchronize();cudaSetDevice(0);Courtesy of R. FarberFebruary 10, 2012 PRACE Winter School 201215

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!