Jesse
Jesse

Reputation: 11

CUDA implementation for MATLAB code

I have recently purchased a P100 GPU in hopes of speeding up parallel code and need some help deciding how to translate MATLAB code into a CUDA code ( I've moved away from plain gpuarrays in MATLAB ). I have experimented with .ptx kernels and MEX-files and have run into some roadblocks with both.

The parallel code has elementwise exponentiation, elementwise multiplication, and FFT and IFFT calls. It also incorporates complex numbers.

Are .ptx files compiled from CUDA-kernels or MEX CUDA files easier to work with and which will allow me to perform my necessary FFT, IFFT, exp, and mult calls?

Upvotes: 0

Views: 329

Answers (1)

Joss Knight
Joss Knight

Reputation: 322

It's simple really. You have to use MEX because you want to call into the NVIDIA cufft library, which you can only do from the host. However, there are basically no circumstances in which you will get a reasonable speed-up over calling FFT and IFFT from MATLAB, because those functions just call directly into cufft, with the added advantage of MATLAB's GPU memory pool and FFT plan cache. So maybe you should focus on the element-wise kernels.

Upvotes: 1

Related Questions