The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Parfor loops and h5write
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

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

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]);
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] );

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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.