This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
The Case for OpenMP in GCC
- From: Scott Robert Ladd <coyote at coyotegulch dot com>
- To: gcc mailing list <gcc at gcc dot gnu dot org>, gomp-discuss at nongnu dot org
- Date: Wed, 02 Jun 2004 11:54:17 -0400
- Subject: The Case for OpenMP in GCC
Hello!
In recent discussions of 3.5 and 4.0, I haven't addressed why certain
GCC enhancements may be desirable to both the user (i.e., someone who
compiles code with GCC) and developer (i.e., someone who works on GCC
itself) communities.
OpenMP (http://www.openmp.org) is one such enhancement.
The future of programming is clearly parallel. All of the major hardware
vendors -- IBM, AMD, Intel, and Sun -- have announced multicore
processors. Dual processor workstations, once only found in "scientific
workstations", have now found their way into digital signal processing
and data analysis applications. New supercomputer clusters are being
constructed from multiprocessor commodity hardware.
Note that I am writing in terms of SMP and NUMA systems, and not about
cluster applications. Yet even cluster-oriented code (built on MPI or
PVM) may encounter the need for local parallelization, when a cluster is
constructed from multiprocessor workstations.
Writing parallel code isn't simple; this is especially true if one wants
to create *portable* parallel code. It's possible to write a parallel
program using Windows or POSIX threads -- but doing so does not result
in cleanly readable or portable code.
Enter OpenMP, an industry standard for parallelization in C, C++, and
Fortran. OpenMP employs pragmas (in C and C++) or special comments
(Fortran) to implement a parallel constructs. A single OpenMP directive
can parallelize a loop, dramatically improving application performance.
Several OpenMP directives, with appropriate arguments, can handle very
complex parallel tasks.
OpenMP is scalable, automatically determining the number of threads to
be used based on the underlying hardware architecture and environment
settings. The syntax is simple, and OpenMP can be completely ignored
when compiled for a serial execution environment.
You'll find OpenMP implementations in compilers produced by Intel, SGI,
PGI, and Lahey. In my experience, most modern Fortran programmers expect
OpenMP to be built into their compiler -- and implementing OpenMP would
provide the tools required for automatic parallelization, a feature
found in High Performance Fortran compilers.
GOMP -- the GNU OpenMP project -- is an effort to implement OpenMP in
the tree-ssa (GCC 3.5/4.0) framework. The project is largely stalled due
to a lack of funding and time on the part of its participants. While
several of us have created or are working on design and library issues,
this effort less likely to succeed without the broader support of the
GCC community.
OpenMP support is, I believe, essential for GCC to be recognized as a
credible compiler in certain realms, and the inclusion of OpenMP will
benefit free software by making parallel development easier and more
portable.
--
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing