[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gomp-discuss] Dissecting OpenMP
From: |
Scott Robert Ladd |
Subject: |
[Gomp-discuss] Dissecting OpenMP |
Date: |
Thu, 08 Apr 2004 10:44:14 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040401 Debian/1.6-4 |
Here is a very simple OpenMP program; as I undertsnad it, one of our
first goals is to compile a program such as this with GOMP.
#include <stdio.h>
int main(void)
{
#pragma omp parallel
puts("Hello, world!");
return 0;
}
You can't get much simpler than that.
The OpenMP pragma is likely to do the following:
1) Take the associated code block (in this case, a single statement),
and convert it into a function. Let's call this par_reg_func.
2) Find out how many processors are available (or configured, since
environment variables can force a number of processors different from
the actual number recognized by the OS).
3) Launch a thread, per processor, that invokes par_reg_func.
The situation becomes more complex when parallalizing a loop, since the
extracted "parallel region function" would need to be parameterized,
shared variables passed, etc.
In a manner of speaking, OpenMP writes new code the replace what the
programmer has specified. Private variables must become local variables
in the generated parallel function, for example.
I am not certain what our policy should be in terms of discussing how
other compilers -- Intel, in particular -- generate code for code such
as the above. I've been tempted to look at how Intel implements OpenMP,
but an concerned with "clean room" issues.
--
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gomp-discuss] Dissecting OpenMP,
Scott Robert Ladd <=