running blocks of code in parallel?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

running blocks of code in parallel?

Jared Stofflett-2
I have the following code that I need to run on several matrices. Is
there a way to run the code in some kind of parallel fashion so that I
don't need to wait for one block to finish before the other starts?
for i=1:length(DJI)
DJI2(i,1)=datenum(char(DJI(i,2)),'yyyy-mm-dd');
DJI2(:,2:6) = reshape(str2num(strvcat(DJI(:,3:7)(:)), length(DJI(:,3:7))));
end



_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: running blocks of code in parallel?

Jaroslav Hajek-2
On Mon, Dec 8, 2008 at 5:15 PM, Jared <[hidden email]> wrote:

> I have the following code that I need to run on several matrices. Is
> there a way to run the code in some kind of parallel fashion so that I
> don't need to wait for one block to finish before the other starts?
> for i=1:length(DJI)
> DJI2(i,1)=datenum(char(DJI(i,2)),'yyyy-mm-dd');
> DJI2(:,2:6) = reshape(str2num(strvcat(DJI(:,3:7)(:)), length(DJI(:,3:7))));
> end
>
>
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>

Currently, Octave itself is not multithread capable. The only
possibility is to explot multithreaded libraries (like BLAS) or to
write a multithreaded compiled function.


--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: running blocks of code in parallel?

c.-2
In reply to this post by Jared Stofflett-2

On 08/dic/08, at 16:15, Jared wrote:

> I have the following code that I need to run on several matrices. Is
> there a way to run the code in some kind of parallel fashion so that I
> don't need to wait for one block to finish before the other starts?
> for i=1:length(DJI)
> DJI2(i,1)=datenum(char(DJI(i,2)),'yyyy-mm-dd');
> DJI2(:,2:6) = reshape(str2num(strvcat(DJI(:,3:7)(:)), length(DJI(:,
> 3:7))));
> end

Yes, with MPITB:
http://atc.ugr.es/javier-bin/mpitb
c.

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: running blocks of code in parallel?

Bill Denney-5
In reply to this post by Jared Stofflett-2
Jared wrote:
> I have the following code that I need to run on several matrices. Is
> there a way to run the code in some kind of parallel fashion so that I
> don't need to wait for one block to finish before the other starts?
> for i=1:length(DJI)
> DJI2(i,1)=datenum(char(DJI(i,2)),'yyyy-mm-dd');
> DJI2(:,2:6) = reshape(str2num(strvcat(DJI(:,3:7)(:)), length(DJI(:,3:7))));
> end
Hi Jared,

FYI, when I sent the suggestion earlier, I meant

for i=1:length(DJI)
  DJI2(i,1)=datenum(char(DJI(i,2)),'yyyy-mm-dd');
end
DJI2(:,2:6) = reshape(str2num(strvcat(DJI(:,3:7)(:)), length(DJI(:,3:7))));

And now that I've had a chance to take a couple minutes off of my day
job, the better way to do this would be:

tmp = strvcat(DIJ(:,2));
y = str2num(tmp(:,1:4));
m = str2num(tmp(:,6:7));
d = str2num(tmp(:,9:10))
DJI2(i,1)=datenum(y, m, d);
DJI2(:,2:6) = reshape(str2num(strvcat(DJI(:,3:7)(:)), length(DJI(:,3:7))));

That should be much faster than the loop and than having datenum do the
string processing.

Have a good day,

Bill
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave