Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Parfor loops and h5write
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Vânia

Posts: 1
Registered: 5/9/13
Parfor loops and h5write
Posted: May 9, 2013 6:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello!
I'm trying to to use the parfor loop in the matlab parallelism package using 8 cores of my computer. I have a big matrix (129*129*1000*80) - 'Input' - so I decided to save my data in h5 file in order to not have memory problems.

So, the problem is: I used parfor and inside the loop I want to load the Input data and save the Output data in h5write file, but it takes a long time and the CPU USage isn't more than 20%. Anyone can help me, how can I improve the performance of my script?

The code:

matlabpool open 8
h5create('Output.h5','/'Output', [129, 129, 39, 80]);
w_size=50;
tic
parfor l = 1:129
for c = 1:129
for w= 1:39
for t= 1:80


val = h5read( 'Input.h5','/'Input',[l c (w-1)*(w_size/2)+1 t], [1 1 w_size-1 1] );

output = mean(val) ;

h5write('Output.h5','/'Output', output, [l c w t], [1 1 1 1] );
end
end
end
end
toc


Thanks in advance!
Have a nice day!



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.