Is there a limit in the available GPU memory in mex files using cuda code?

5 views (last 30 days)
I've write a code to perform 3d linear interpolation in the GPU using the texture feature. The code runs correctly for images of about 128x128x120, but for images of greater size the mex function returns an image filled with zeros, and no error message appears. I allocate GPU memory using cudaMalloc(), in total 9 times the size of the initial image size. So for an image of 128x128x121 the total amount of memory I would allocate in the GPU (float elements) is 128*128*121*9*4 ~ 72MB which is way below the memory size of my GPU (2GB). So I was wondering if Matlab limits somehow the amount of memory I can use ina mex function using CUDA. Otherwise I would like to know if you could help me in finding the error. Thanks
  1 Comment
Alan Miranda
Alan Miranda on 31 May 2018
The error is already solved. I changed the size of one of my thread blocks from 32 to 64 and now bigger image sizes are correctly handled. However I don't understand what is the problem since, using a block size of 32, my grid size is way below the limit of the grid size (2^31-1).

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!