Why can'I put build in function (like sim..neural ) in arrayfun to compute with gpu?

Why can'I put build in function (like sim..neural ) in arrayfun to compute with gpu? It said that net can't be translated to gpu.How I supposed to do this? I really need this.I need to simulate many neural network in one time. And don't tell me use sim(net,x,'useGPU','yes') I have tried it. But it runs more slower. I think it owing to my net is too small. But my set is very large. Even when one 'sim' only take 0.01 second. When I run 1000 set,it runs for 10 second!! But they are paralleled.It's very inefficient.

 Accepted Answer

If you have a bicycle and you put a sticker on the frame that says "Turbo-charger enabled!" then that doesn't mean that the bicycle can actually use a turbo charger. At the very least you would need to reinforce the frame at strategic points to support the extra thrust.

6 Comments

I don't quite understand what you mean. I have nothing to reinforce the fram because it's a built-in function,unless I write a new one by myself. And by the way,I am implementing a algorithm called Neural fitted q.I have to put different kinds of input to check which way is good policy. If action are ten,and state are also ten. I need to put 100 kinds of input.But they are calculated by the same neural weight. I already used spmd with four cup to reinforce my performance,but I want to improve more. So I try to speed up with gpu, which many people said it is powerful.
There is a limited list of functions that you can use arrayfun() with to execute on the GPU. The rest are not designed for it and need to be tuned up by Mathworks to be executable on GPU. That takes time.
Remember that you can build your own GPU kernels.
Ok,thanks. Do you mean I write the "sim" function by myself?
You can profile to see what parts are consuming the time, and then you can figure out how to offload that to the GPU, writing your own GPU code. This would probably involve copying some of the existing folders so you could access internal functions and modify what you needed to.
Do I understand correctly that the difficulty is not in training your network, but rather that you are applying your trained network to many inputs? Would generating a function help?
Yes,you understand correctly. It seems not helpful. Maybe I should write by myself. But I have another question. It said arrayfun is element wise. a.*b+c. All a,b,c is a vector. But if I want c to be a modified constant. How should I do? If you have a little know about neural network,maybe you can figure out what I am talking about.That c is network's weight.All the weight are the same,but it will change after training.
Oh my god!! What am I so stupid. I have already found my answer.

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!