MATLAB Answers

Maximum variable size on GPU exceeded on one machine and not others

33 ビュー (過去 30 日間)
Benjamin
Benjamin 2018 年 1 月 5 日
I have run into a "maximum variable size allowed on device is exceeded" error.
Problem:
zeros([7676,7420,37],'single','gpuArray') is fine.
zeros([7676,7420,38],'single','gpuArray') produces the error.
The device is a tesla k40 with ~ 12Gb memory available. 64 bit matlab (17b/16b) 64 bit Linux OS (Ubuntu and Fedora.)
Given the size of the arrays above, whos product straddle the value intmax('int32') my best guess is that the limit is being set assuming the array might be reshaped into one dimension? The maximum grid size.
MaxGridSize: [2.1475e+09 65535 65535] %
And %
sizeToMake = double(intmax('int32'))
g = zeros([sizeToMake,1],'single','gpuArray'); % works
g = zeros([sizeToMake+1,1],'single','gpuArray'); % fails
So is the maximum size intentionally set to the first dimension allowed by max grid size? Can this be avoided?
Thanks, Ben

  0 件のコメント

サインインしてコメントする。

回答 (1 件)

Alison Eele
Alison Eele 2018 年 1 月 8 日
You are correct that the limit you are hitting is intmax('int32'). This does impose a hard limit on the size of gpuArrays. This limit stems from CUDA's CUBLAS/CUFFT APIs which MATLAB utilises.
I would advise splitting the size of your grids into multiple variables.

  1 件のコメント

Francisco Ramírez Gil
Francisco Ramírez Gil 2020 年 2 月 20 日
Is there any way to setup this limit directly in CUDA?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by