OpenMP on Clusters

By Jay Hoeflinger and Larry Meadows

May 19, 2006

Abstract

OpenMP* was designed to unify the directive languages of shared memory multiprocessors across the industry to make it easier to write portable parallel programs.  OpenMP represents a high-level language of parallelism compared to programming with Posix threads or Windows threads.  It also represents a much easier programming model than does MPI.  This effort has been successful and OpenMP has gained many users around the world.  Yet, thus far OpenMP has only been useful for programming systems with hardware shared memories.  Now, Intel is offering Cluster OpenMP*, which extends the OpenMP programming model to clusters.  This article describes the extension to OpenMP that makes this possible, how the system manages to simulate a shared memory across a cluster, how the user ports an OpenMP program to Cluster OpenMP, and ends with a discussion of the amount of effort required to port a code.

Introduction

In the 1980s and 90s, multiprocessor computer manufacturers tried to address the difficulties of programming their computers by supplying directives that could be placed in serial programs that would instruct the compiler to produce parallel code.  Each manufacturer produced its own unique set of directives.  As programmers moved their programs from machine to machine, they found that they had to recode the directives.  To remedy this situation, major players in the industry formed a working group in the mid-90s to unify the directives.  The result was the 1997 OpenMP specification for Fortran and the 1998 specification for C/C++.  This effort has been successful, and the OpenMP directive language has been adopted across the industry.

The OpenMP paradigm for parallel programming differs significantly from the earlier message passing solutions (such as PVM and MPI), and from explicit threading (Posix* threads or Windows* threads).  The first difference that people notice is that OpenMP consists mostly of directives, whereas PVM, MPI and the threading methods consist solely of library routines.  The effect of this is that OpenMP's effects can be switched off by a compiler switch, removing the OpenMP parallelism, whereas programs using library-based parallelism are permanently changed into parallel programs.

Another obvious difference versus message passing is that data movement for message passing programs must be explicitly programmed by the programmer, while data movement in OpenMP programs happens automatically when threads read and write variables.  This means that in addition to the code for the problem being solved, the message passing programmer must write a program layer to move the data between processors.

Both of these differences translate directly into lower programming costs and lower maintenance costs for OpenMP programs.  With OpenMP, you program “what” to do, while with message passing and explicit threading you program “how” to do it.

In this sense, OpenMP could be said to be a high-level language of parallel programming, while explicit threading and message-passing programming is more akin to an “assembly language” of parallel programming. 

A drawback to OpenMP is that it requires a shared memory, so up-to-now this has limited its use to a single multiprocessor machine.  Now, Intel's Cluster OpenMP removes that limitation.  Cluster OpenMP makes it possible to run an OpenMP program across a cluster of multiprocessors.  The shared memory is simulated by a software layer implementing a distributed shared memory (DSM).

Cluster OpenMP Extension to OpenMP

Cluster OpenMP extends OpenMP by a single directive: the sharable directive.  This directive indicates that the named variables are to have the “sharable” attribute.  That is, their values are kept consistent between threads in the program.  All variables that are shared within an OpenMP parallel region, either by virtue of appearing in a shared clause, or by being shared through the default rules of OpenMP must be made sharable in Cluster OpenMP. 

Under some circumstances the compiler can automatically determine that variables must be sharable and can make them sharable automatically.  Other variables must be made sharable by some action of the programmer, either by using compiler options, or by the programmer explicitly placing sharable directives in the code.

How it Works

Cluster OpenMP is based upon an exclusively licensed version of the TreadMarks* DSM system (originating at Rice University), specially enhanced to handle larger amounts of sharable data, larger numbers of processors, multiple threads per process, and to run on modern cluster interconnects.

The basic idea of the consistency mechanism is that the Linux mprotect() mechanism is used to protect pages containing sharable data, whenever the page is not fully up-to-date on a given process.  All sharable data is placed together on sharable pages.  When the program references any data on a protected page, a segmentation fault signal is delivered to the program, which is caught by the Cluster OpenMP runtime library.  The library then sends requests for changes to all of the processes that have modified that page.  When those changes arrive, they are applied to the page, the page protection is removed, and the instruction is restarted.  The data access will succeed this time, yielding the correct value of the variable, and the program will proceed.

Performance Considerations

Obviously, any memory access that triggers the consistency mechanism is much more expensive than an ordinary access to a processor's memory.  In fact, a memory access requiring the consistency mechanism can be hundreds to thousands of times slower than access to any level of cache or hardware memory.  So, how can we expect any program to get reasonable performance with such expensive memory operations?  There are a number of ways that programs can get good performance despite such a heavy memory access cost. 

First, the relaxed memory consistency model of OpenMP makes it possible to hide the latency of memory operations.  According to the OpenMP memory model, memory seen by multiple threads in an OpenMP program need not be made consistent except at the points where threads synchronize.  So, in an OpenMP program, the consistency mechanism is only necessary at barriers and around the use of locks.  This allows other memory accesses to be significantly overlapped.

Second, a single segmentation fault on a page causes the whole page to be brought up-to-date.  This tends to amortize the accesses to that page.  If the program is written in a style that maximizes memory locality, then the data on a page that is brought up-to-date might be accessed a large number of times at memory speeds before it needs to be refreshed.

Third, whole classes of applications exist that, by their very nature are well-suited to Cluster OpenMP.  Any application that accesses a large amount of read-only sharable data and only a small amount of read/write sharable data, and uses synchronization sparingly, has the potential for good performance.  This is true because for most of the sharable data, the application only pays one large latency penalty per page, and thereafter accesses the read-only data at memory (or cache) speeds.  In fact, we have seen many examples of programs that have these characteristics and provide good performance with Cluster OpenMP.  Examples are applications doing rendering, data-mining, all kinds of parallel search, speech and visual recognition, and genetic sequencing.

Porting a Code to Cluster OpenMP

Cluster OpenMP is an additional-cost component of the Intel 9.1 compiler.  A special option in the compiler (-cluster-openmp) causes the compiler to generate code for Cluster OpenMP.  Since the user must potentially add sharable directives to the code, a pure OpenMP code will not necessarily run as-is with the -cluster-openmp option.  Typically a porting step must be done on an OpenMP code before all variables are made sharable that need to be made sharable.

First, the programmer should simply try the -cluster-openmp option and check whether the program runs.  It may run because, as stated above, the compiler can automatically make some variables sharable. 

If it does not run, the user should re-build the application with the “-clomp-sharable-propagation -ipo” options.  This triggers an interprocedural compilation that attempts to track down the allocation point of each variable used in a shared way inside a parallel region.  The compiler will report the situations it finds where a variable needs to be made sharable, and list the source file and line number information, allowing the user to make it sharable.

If -clomp-sharable-propagation does not find all sharable variables, then a run-time tool is available that can find more such variables.  The user would compile with “-g”, set the environment variable KMP_DISJOINT_HEAPSIZE with a size large enough for each process' private heap, then run the program.  At runtime, the program will report instances of uses of a dynamically allocated variable that needs to be made sharable.

If these two techniques don't yet find all sharable variables, then the final task depends on the language being used.  For Fortran, there are special options that make all COMMON variables, MODULE variables, and SAVE variables sharable by default.  That is almost always sufficient to complete the port of a Fortran program.  For C/C++, the programmer should inspect any routines being called within a parallel region (for instance, method calls in C++), and determine whether any static data is being used in them.  If so, such data needs to be made sharable.

Porting Effort

The amount of effort required to port an OpenMP application to Cluster OpenMP is entirely dependent on the application itself.   Applications that make extensive use of pointers are more difficult because it is more difficult to determine where the actual data being used in parallel regions ultimately resides.  In any case, identifying the sharable variables in a program is a useful exercise because it illuminates data access characteristics that are often hidden because of the procedural focus of OpenMP.  In this sense, identifying sharable data adds a data focus that is a critical step in performance tuning for OpenMP programs.

The table below shows the number of files and lines that had to be modified to insert sharable directives in a set of OpenMP programs written in Fortran, C, and C++, to port them to Cluster OpenMP.  Fortran programs are usually easier to port than C or C++ programs because the compiler options that make Fortran global variables sharable are sometimes enough to port a Fortran program.  Notice that the largest code of the group in the table, fma3d (60,000 lines of Fortran) required no modifications at all.

Overall, the table shows that about 2 percent of original source lines needed to be modified.  For Fortran, only 1.5 percent of source lines needed modification, while for C and C++ about 3.5 percent of source lines needed modification.

When compared with the drastic modification needed to convert an OpenMP program to a message passing code or an explicitly-threaded code, the effort to port an OpenMP program to Cluster OpenMP form is very small.

--------------------------------------------------------------------- -                                    Original          Modified -                                 -------------  -------------------- -                                                            % Lines -  Code        Appl area   Lang     Files Lines  Files Lines   mod -------------  ----------  -------  ----- -----  ----- ----- --------  AMR renderer   Graphics      C++     145  35100   12    36   0.102564 -------------  ----------  -------  ----- -----  ----- ----- -------- 332.ammp       Chemistry/    C        31  13500    5    29   0.214815                Biology -------------  ----------  -------  ----- -----  ----- ----- -------- 316.applu      Fluid       Fortran    20   4000    0     0          0                dynamics -------------  ----------  -------  ----- -----  ----- ----- -------- 324.apsi       Air         Fortran     1   7500    1   101   1.346667                pollution -------------  ----------  -------  ----- -----  ----- ----- -------- 330.art        Image         C         1   1300    1   138   10.61538                recognition -------------  ----------  -------  ----- -----  ----- ----- -------- 328.fma3d      Crash       Fortran   101  60000    0     0          0                simulation -------------  ----------  -------  ----- -----  ----- ----- -------- 326.gafort     Genetic     Fortran     1   1500    1     2   0.133333                algorithm -------------  ----------  -------  ----- -----  ----- ----- -------- 318.galgel     Fluid       Fortran    39  15300    8    74    0.48366                dynamics -------------  ----------  -------  ----- -----  ----- ----- -------- 320.equake     Earthquake    C         1   1500    1    44   2.933333                modeling -------------  ----------  -------  ----- -----  ----- ----- -------- 314.mgrid      Multigrid   Fortran     1    500    1     3   0.6                solver -------------  ----------  -------  ----- -----  ----- ----- -------- 312.swim       Shallow     Fortran     1    400    1    24   6                water -------------  ----------  -------  ----- -----  ----- ----- -------- 310.wupwise    QCD         Fortran    25   2200   12    78   3.545455 -------------  ----------  -------  ----- -----  ----- -----  -------  -                                                      avg   2.164601 -                                                     ------ -------- -                                                      avg   1.513639 -                                                     Fortran -                                                     ------ -------- -                                                      avg   3.466524 -                                                     C/C++ ----------------------------------------------------------------------- 

Conclusion

Cluster OpenMP is currently the only commercial system available to extend OpenMP programs to run on clusters.  The old thinking was that there were two ways to make use of large numbers of processors with a program: buy a large shared memory multiprocessor and use OpenMP, or buy a cluster and use message passing.  The first requires expensive hardware, while the second requires expensive program development and maintenance.  Now, Cluster OpenMP offers a new option:  buy a cluster and use OpenMP.  This offers the best of both worlds: a less expensive hardware purchase and a less expensive programming option.

* Other names and brands may be claimed as the property of others.

Subscribe to HPCwire's Weekly Update!

Be the most informed person in the room! Stay ahead of the tech trends with industy updates delivered to you every week!

Supercomputer Research Reveals Star Cluster Born Outside Our Galaxy

July 11, 2020

The Milky Way is our galactic home, containing our solar system and continuing into a giant band of densely packed stars that stretches across clear night skies around the world – but, it turns out, not all of those st Read more…

By Oliver Peckham

Max Planck Society Begins Installation of Liquid-Cooled Supercomputer from Lenovo

July 9, 2020

Lenovo announced today that it is supplying a new high performance computer to the Max Planck Society, one of Germany's premier research organizations. Comprised of Intel Xeon processors and Nvidia A100 GPUs, and featuri Read more…

By Tiffany Trader

Xilinx Announces First Adaptive Computing Challenge

July 9, 2020

A new contest is challenging the computing world. Xilinx has announced the first Xilinx Adaptive Computing Challenge, a competition that will task developers and startups with finding creative workload acceleration solutions. Xilinx is running the Adaptive Computing Challenge in partnership with Hackster.io, a developing community... Read more…

By Staff report

Reviving Moore’s Law? LBNL Researchers See Promise in Heterostructure Oxides

July 9, 2020

The reality of Moore’s law’s decline is no longer doubted for good empirical reasons. That said, never say never. Recent work by Lawrence Berkeley National Laboratory researchers suggests heterostructure oxides may b Read more…

By John Russell

President’s Council Targets AI, Quantum, STEM; Recommends Spending Growth

July 9, 2020

Last week the President Council of Advisors on Science and Technology (PCAST) met (webinar) to review policy recommendations around three sub-committee reports: 1) Industries of the Future (IotF), chaired be Dario Gil (d Read more…

By John Russell

AWS Solution Channel

Best Practices for Running Computational Fluid Dynamics (CFD) Workloads on AWS

The scalable nature and variable demand of CFD workloads makes them well-suited for a cloud computing environment. Many of the AWS instance types, such as the compute family instance types, are designed to include support for this type of workload.  Read more…

Intel® HPC + AI Pavilion

Supercomputing the Pandemic: Scientific Community Tackles COVID-19 from Multiple Perspectives

Since their inception, supercomputers have taken on the biggest, most complex, and most data-intensive computing challenges—from confirming Einstein’s theories about gravitational waves to predicting the impacts of climate change. Read more…

Penguin Computing Brings Cascade Lake-AP to OCP Form Factor

July 7, 2020

Penguin Computing, a subsidiary of SMART Global Holdings, Inc., announced yesterday (July 6) a new Tundra server, Tundra AP, that is the first to implement the Intel Xeon Scalable 9200 series processors (codenamed Cascad Read more…

By Tiffany Trader

Max Planck Society Begins Installation of Liquid-Cooled Supercomputer from Lenovo

July 9, 2020

Lenovo announced today that it is supplying a new high performance computer to the Max Planck Society, one of Germany's premier research organizations. Comprise Read more…

By Tiffany Trader

President’s Council Targets AI, Quantum, STEM; Recommends Spending Growth

July 9, 2020

Last week the President Council of Advisors on Science and Technology (PCAST) met (webinar) to review policy recommendations around three sub-committee reports: Read more…

By John Russell

Google Cloud Debuts 16-GPU Ampere A100 Instances

July 7, 2020

On the heels of the Nvidia’s Ampere A100 GPU launch in May, Google Cloud is announcing alpha availability of the A100 “Accelerator Optimized” VM A2 instance family on Google Compute Engine. The instances are powered by the HGX A100 16-GPU platform, which combines two HGX A100 8-GPU baseboards using... Read more…

By Tiffany Trader

Q&A: HLRS’s Bastian Koller Tackles HPC and Industry in Germany and Europe

July 6, 2020

In this exclusive interview for HPCwire – sadly not face to face – Steve Conway, senior advisor for Hyperion Research, talks with Dr.-Ing Bastian Koller about the state of HPC and its collaboration with Industry in Europe. Koller is a familiar figure in HPC. He is the managing director at High Performance Computing Center Stuttgart (HLRS) and also serves... Read more…

By Steve Conway, Hyperion

OpenPOWER Reboot – New Director, New Silicon Partners, Leveraging Linux Foundation Connections

July 2, 2020

Earlier this week the OpenPOWER Foundation announced the contribution of IBM’s A21 Power processor core design to the open source community. Roughly this time Read more…

By John Russell

Hyperion Forecast – Headwinds in 2020 Won’t Stifle Cloud HPC Adoption or Arm’s Rise

June 30, 2020

The semiannual taking of HPC’s pulse by Hyperion Research – late fall at SC and early summer at ISC – is a much-watched indicator of things come. This yea Read more…

By John Russell

Racism and HPC: a Special Podcast

June 29, 2020

Promoting greater diversity in HPC is a much-discussed goal and ostensibly a long-sought goal in HPC. Yet it seems clear HPC is far from achieving this goal. Re Read more…

Top500 Trends: Movement on Top, but Record Low Turnover

June 25, 2020

The 55th installment of the Top500 list saw strong activity in the leadership segment with four new systems in the top ten and a crowning achievement from the f Read more…

By Tiffany Trader

Supercomputer Modeling Tests How COVID-19 Spreads in Grocery Stores

April 8, 2020

In the COVID-19 era, many people are treating simple activities like getting gas or groceries with caution as they try to heed social distancing mandates and protect their own health. Still, significant uncertainty surrounds the relative risk of different activities, and conflicting information is prevalent. A team of Finnish researchers set out to address some of these uncertainties by... Read more…

By Oliver Peckham

[email protected] Turns Its Massive Crowdsourced Computer Network Against COVID-19

March 16, 2020

For gamers, fighting against a global crisis is usually pure fantasy – but now, it’s looking more like a reality. As supercomputers around the world spin up Read more…

By Oliver Peckham

[email protected] Rallies a Legion of Computers Against the Coronavirus

March 24, 2020

Last week, we highlighted [email protected], a massive, crowdsourced computer network that has turned its resources against the coronavirus pandemic sweeping the globe – but [email protected] isn’t the only game in town. The internet is buzzing with crowdsourced computing... Read more…

By Oliver Peckham

Supercomputer Simulations Reveal the Fate of the Neanderthals

May 25, 2020

For hundreds of thousands of years, neanderthals roamed the planet, eventually (almost 50,000 years ago) giving way to homo sapiens, which quickly became the do Read more…

By Oliver Peckham

DoE Expands on Role of COVID-19 Supercomputing Consortium

March 25, 2020

After announcing the launch of the COVID-19 High Performance Computing Consortium on Sunday, the Department of Energy yesterday provided more details on its sco Read more…

By John Russell

Honeywell’s Big Bet on Trapped Ion Quantum Computing

April 7, 2020

Honeywell doesn’t spring to mind when thinking of quantum computing pioneers, but a decade ago the high-tech conglomerate better known for its control systems waded deliberately into the then calmer quantum computing (QC) waters. Fast forward to March when Honeywell announced plans to introduce an ion trap-based quantum computer whose ‘performance’ would... Read more…

By John Russell

Neocortex Will Be First-of-Its-Kind 800,000-Core AI Supercomputer

June 9, 2020

Pittsburgh Supercomputing Center (PSC - a joint research organization of Carnegie Mellon University and the University of Pittsburgh) has won a $5 million award Read more…

By Tiffany Trader

Global Supercomputing Is Mobilizing Against COVID-19

March 12, 2020

Tech has been taking some heavy losses from the coronavirus pandemic. Global supply chains have been disrupted, virtually every major tech conference taking place over the next few months has been canceled... Read more…

By Oliver Peckham

Leading Solution Providers

Contributors

10nm, 7nm, 5nm…. Should the Chip Nanometer Metric Be Replaced?

June 1, 2020

The biggest cool factor in server chips is the nanometer. AMD beating Intel to a CPU built on a 7nm process node* – with 5nm and 3nm on the way – has been i Read more…

By Doug Black

Nvidia’s Ampere A100 GPU: Up to 2.5X the HPC, 20X the AI

May 14, 2020

Nvidia's first Ampere-based graphics card, the A100 GPU, packs a whopping 54 billion transistors on 826mm2 of silicon, making it the world's largest seven-nanom Read more…

By Tiffany Trader

‘Billion Molecules Against COVID-19’ Challenge to Launch with Massive Supercomputing Support

April 22, 2020

Around the world, supercomputing centers have spun up and opened their doors for COVID-19 research in what may be the most unified supercomputing effort in hist Read more…

By Oliver Peckham

Australian Researchers Break All-Time Internet Speed Record

May 26, 2020

If you’ve been stuck at home for the last few months, you’ve probably become more attuned to the quality (or lack thereof) of your internet connection. Even Read more…

By Oliver Peckham

15 Slides on Programming Aurora and Exascale Systems

May 7, 2020

Sometime in 2021, Aurora, the first planned U.S. exascale system, is scheduled to be fired up at Argonne National Laboratory. Cray (now HPE) and Intel are the k Read more…

By John Russell

Summit Supercomputer is Already Making its Mark on Science

September 20, 2018

Summit, now the fastest supercomputer in the world, is quickly making its mark in science – five of the six finalists just announced for the prestigious 2018 Read more…

By John Russell

TACC Supercomputers Run Simulations Illuminating COVID-19, DNA Replication

March 19, 2020

As supercomputers around the world spin up to combat the coronavirus, the Texas Advanced Computing Center (TACC) is announcing results that may help to illumina Read more…

By Staff report

$100B Plan Submitted for Massive Remake and Expansion of NSF

May 27, 2020

Legislation to reshape, expand - and rename - the National Science Foundation has been submitted in both the U.S. House and Senate. The proposal, which seems to Read more…

By John Russell

  • arrow
  • Click Here for More Headlines
  • arrow
Do NOT follow this link or you will be banned from the site!
Share This