[Omp] parallelize the code.........

Marcel Beemster marcel at ace.nl
Fri Jun 15 06:26:05 PDT 2007


Hi frenz Sidhart,

You wrote:
> can somebody
> help me to make this loop parallelize ....code is given below.....
> 
> omp_set_num_threads(16);
> #pragma omp parallel for
> for(a=1;a<100;a++)
> {
>  b[a]=1+a;
> c[a]=b[a-1]+a;
> d[a]=c[a-1]+a;
> printf("\n thread is %d a %d Output %d %d  %d " , omp_get_thread_num()
> ,a,b[a],c[a],d[a]);
> }

I can think of two ways, using either forward substitution
or loop skewing. Where does that code come from? Looks like
a classroom assignment to me.

Best,
	Marcel


-- 
Dr. Marcel Beemster, Senior Software Engineer, marcel at ace.nl,www.ace.nl
Associated Compiler Experts bv. Amsterdam, Netherlands. +31 20 6646416.
-----------------------------------------------------------------------
This e-mail and any  files transmitted  with it are  confidential.  Any
technical information contained herein is supplied as-is, and no rights
can be  derived therefrom.  If you have received this message in error,
please notify  the sender by reply  e-mail immediately,  and delete the
message and all copies thereof.




More information about the Omp mailing list