This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp] Support statically scheduled parallel loops


On 09/20/05 17:42, Andrew Pinski wrote:

How this interact with C99 VLAs or alloca?

It doesn't.


Also how does GOMP interact with nested functions?

It doesn't.


    #pragma omp for shared (a), private (i)
    for (int i = 0; i < N; i++)
      a[i] = ...

You don't need the private marker for 'i'. Loop controlling variables are implicitly private.


Those seems like places where GOMP can go wrong.

It's all designed to work. The language features that you mention do not affect the meaning of the data sharing and copying directives. The implementation is still very rough, so you will find places where we fail and shouldn't. But something like this should work today:


#include <omp.h>

main()
{
 void foo (int n)
   {
     int i;
     int c[n];
     char *x = alloca (10);

strcpy (x, "xxx");

#pragma omp parallel shared (c,x) private (i)
{
#pragma omp for
for (i = 0; i < 80; i++)
printf ("Thread %d, x = %s, i = %d\n", omp_get_thread_num (), x, i);
}
}



foo (80); }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]