[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end
From: |
Scott Robert Ladd |
Subject: |
RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end |
Date: |
Fri, 7 Feb 2003 18:37:12 -0500 |
Steven Bosscher and Neil Booth have written:
SB> ----------
SB> /* ERROR - The flush directive cannot be the immediate
SB> * substatement of an if statement. */
SB> if (x!=0)
SB> #pragma omp flush (x)
NB> Surely not. I think this is a *really really* bad idea; I
NB> wouldn't support it going into GCC. It's simply not the way
NB> C and C++ work.
Well, this *is* the way OpenMP works. From the OpenMP standard for C and
C++:
[quote]
The directives, library functions, and environment variables defined in this
document will allow users to create and manage parallel programs while
permitting portability. The directives extend the C and C++ sequential
programming model with single program multiple data (SPMD) constructs,
work-sharing constructs, and synchronization constructs, and they provide
support for the sharing and privatization of data. Compilers that support
the OpenMP C and C++ API will include a command-line option to the compiler
that activates and allows interpretation of all OpenMP compiler directives.
[end quote]
I've always considered the OpenMP directives to be language extensions that
can be ignored by a compiler. Nothing in the C or C++ Standards prevents
pragmas from acting as do the ones defined by OpenMP. In Fortran, the OMP
directives exist as comments with a specific format.
SB> if (x!=0)
SB> {
SB> #pragma omp flush (x)
SB> }
NB> Ugh. Which @#$&*( thought of this?
A concept of OpenMP is that a program maintains its logic whether its is
compiled for serial or parallel execution. Thus the use of pragmas, which
can be ignored (or warned about) by any non-OpenMP compiler.
OpenMP is an outgrowth of an unfinished ANSI draft, X3H5. The OpenMP
Architecture Review Board is comprised of members from IBM, Sun, HP, Intel,
SGI, Fujitsu, and ASCI. No Microsoft, just as an interesting note. The
OpenMP Standard is implemented in C, C++, and Fortran compilers from these
companies.
..Scott
- [Gomp-discuss] Implementing OpenMP pragmas for the C front end, Steven Bosscher, 2003/02/07
- [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end, Neil Booth, 2003/02/07
- [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end, Steven Bosscher, 2003/02/07
- [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end, Pop Sébastian, 2003/02/08
- RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end, Scott Robert Ladd, 2003/02/08
- RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end, Steven Bosscher, 2003/02/08
- RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for the Cfront end, Scott Robert Ladd, 2003/02/08
- RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for the Cfront end, Steven Bosscher, 2003/02/08
- RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for theCfront end, Scott Robert Ladd, 2003/02/08
- RE: [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end, Steven Bosscher, 2003/02/08
[Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end, Zack Weinberg, 2003/02/11