1

After converting a 2D array from the CPU to the GPU's memory to run on the GPU I face multiple errors from Matlab's builtin functions such minmax(array) stating that my GPU variable is not an array or a cell:

??? Error using ==> minmax at 27 Data is not a matrix or cell array.

Though the passed variable is a converted 2D array, but the type is changed from <11x4096 double> to <11x4096 parallel.gpu.GPUArray>.

Anyone can help me make Matlab understand that the GPU variable is an array?

Thanks all.

1
  • If you switch to Jacket, you'll be able to run minmax. Jacket is better anyway: accelereyes.com/compare Commented Nov 29, 2011 at 17:17

1 Answer 1

1

Only a small subset of MATLAB commands are supported for arrays stored on the GPU (i.e. arrays of type GPUArray).

See this documentation page from Parallel Computing Toolbox for details of which functions are supported. You'll notice that the list contains exclusively functions from base MATLAB such as arithmetic, exponential, and trigonometric functions, linear algebra and Fourier transforms; nothing close to the higher-level toolbox functions such as minmax from Neural Network Toolbox.

Overloading a function for GPUArray input, so that it executes on the GPU rather than CPU, is a major job involving a reimplementation of the algorithm for the new and highly parallel architecture. In addition, only certain types of highly parallel algorithm will typically benefit from GPU parallelism. I therefore wouldn't expect MathWorks to provide GPUArray support in Neural Network Toolbox any time soon.

If you specifically need to parallelize minmax on the GPU, rather than neural networks in general, it wouldn't be that hard to do it yourself - probably just a couple of lines involving min, max and arrayfun.

Having said that, the error message could provide a lot more explanation of the problem. It looks like the developers know this as well: if you type edit nntype.data and look at line 93, which is where the error message comes from, you'll see the comment line % TODO - More detailed response. Nice!

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks alot, I have implemented minmax in another way to execute on the GPU, but minmax was the begining of many errors that were caused trying to run Self-Organizing-Map (SOM) from MATLAB on the GPU. Both were causing the same error so I thought if I could get an answer for one, then would be the same for the rest.
Great - glad it seems to have helped. If you think the answer was the correct one, could you mark it as accepted by clicking the tick mark by the voting buttons please? That helps others to find the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.