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!

Microsoft, Nvidia Launch Cloud HPC

November 20, 2019

Nvidia and Microsoft have joined forces to offer a cloud HPC capability based on the GPU vendor’s V100 Tensor Core chips linked via an Infiniband network scaling up to 800 graphics processors. The partners announced Read more…

By George Leopold

Hazra Retiring from Intel Data Center Group, Successor Unknown

November 20, 2019

This article is an update to a story published earlier today. Rajeeb Hazra, corporate VP of Intel’s Data Center Group and GM for the Enterprise and Government Group, is retiring after more than 24 years at the compa Read more…

By Doug Black

Jensen Huang’s SC19 – Fast Cars, a Strong Arm, and Aiming for the Cloud(s)

November 20, 2019

We’ve come to expect Nvidia CEO Jensen Huang’s annual SC keynote to contain stunning graphics and lively bravado (with plenty of examples) in support of GPU-accelerated computing. In recent years, AI has joined the s Read more…

By John Russell

SC19 Student Cluster Competition: Know Your Teams

November 19, 2019

I’m typing this live from Denver, the location of the 2019 Student Cluster Competition… and, oh yeah, the annual SC conference too. The attendance this year should be north of 13,000 people, with the majority attende Read more…

By Dan Olds

Top500: US Maintains Performance Lead; Arm Tops Green500

November 18, 2019

The 54th Top500, revealed today at SC19, is a familiar list: the U.S. Summit (ORNL) and Sierra (LLNL) machines, offering 148.6 and 94.6 petaflops respectively, remain in first and second place. The only new entrants in t Read more…

By Tiffany Trader

AWS Solution Channel

Making High Performance Computing Affordable and Accessible for Small and Medium Businesses with HPC on AWS

High performance computing (HPC) brings a powerful set of tools to a broad range of industries, helping to drive innovation and boost revenue in finance, genomics, oil and gas extraction, and other fields. Read more…

IBM Accelerated Insights

Data Management – The Key to a Successful AI Project

 

Five characteristics of an awesome AI data infrastructure

[Attend the IBM LSF & HPC User Group Meeting at SC19 in Denver on November 19!]

AI is powered by data

While neural networks seem to get all the glory, data is the unsung hero of AI projects – data lies at the heart of everything from model training to tuning to selection to validation. Read more…

ScaleMatrix and Nvidia Launch ‘Deploy Anywhere’ DGX HPC and AI in a Controlled Enclosure

November 18, 2019

HPC and AI in a phone booth: ScaleMatrix and Nvidia announced today at the SC19 conference in Denver a joint offering that puts up to 13 petaflops of Nvidia DGX-1 compute power in an air conditioned, water-cooled ScaleMa Read more…

By Doug Black

Hazra Retiring from Intel Data Center Group, Successor Unknown

November 20, 2019

This article is an update to a story published earlier today. Rajeeb Hazra, corporate VP of Intel’s Data Center Group and GM for the Enterprise and Governm Read more…

By Doug Black

Jensen Huang’s SC19 – Fast Cars, a Strong Arm, and Aiming for the Cloud(s)

November 20, 2019

We’ve come to expect Nvidia CEO Jensen Huang’s annual SC keynote to contain stunning graphics and lively bravado (with plenty of examples) in support of GPU Read more…

By John Russell

Top500: US Maintains Performance Lead; Arm Tops Green500

November 18, 2019

The 54th Top500, revealed today at SC19, is a familiar list: the U.S. Summit (ORNL) and Sierra (LLNL) machines, offering 148.6 and 94.6 petaflops respectively, Read more…

By Tiffany Trader

ScaleMatrix and Nvidia Launch ‘Deploy Anywhere’ DGX HPC and AI in a Controlled Enclosure

November 18, 2019

HPC and AI in a phone booth: ScaleMatrix and Nvidia announced today at the SC19 conference in Denver a joint offering that puts up to 13 petaflops of Nvidia DGX Read more…

By Doug Black

Intel Debuts New GPU – Ponte Vecchio – and Outlines Aspirations for oneAPI

November 17, 2019

Intel today revealed a few more details about its forthcoming Xe line of GPUs – the top SKU is named Ponte Vecchio and will be used in Aurora, the first plann Read more…

By John Russell

SC19: Welcome to Denver

November 17, 2019

A significant swath of the HPC community has come to Denver for SC19, which began today (Sunday) with a rich technical program. As is customary, the ribbon cutt Read more…

By Tiffany Trader

SC19’s HPC Impact Showcase Chair: AI + HPC a ‘Speed Train’

November 16, 2019

This year’s chair of the HPC Impact Showcase at the SC19 conference in Denver is Lori Diachin, who has spent her career at the spearhead of HPC. Currently deputy director for the U.S. Department of Energy’s (DOE) Exascale Computing Project (ECP), Diachin is also... Read more…

By Doug Black

Cray, Fujitsu Both Bringing Fujitsu A64FX-based Supercomputers to Market in 2020

November 12, 2019

The number of top-tier HPC systems makers has shrunk due to a steady march of M&A activity, but there is increased diversity and choice of processing compon Read more…

By Tiffany Trader

Supercomputer-Powered AI Tackles a Key Fusion Energy Challenge

August 7, 2019

Fusion energy is the Holy Grail of the energy world: low-radioactivity, low-waste, zero-carbon, high-output nuclear power that can run on hydrogen or lithium. T Read more…

By Oliver Peckham

Using AI to Solve One of the Most Prevailing Problems in CFD

October 17, 2019

How can artificial intelligence (AI) and high-performance computing (HPC) solve mesh generation, one of the most commonly referenced problems in computational engineering? A new study has set out to answer this question and create an industry-first AI-mesh application... Read more…

By James Sharpe

Cray Wins NNSA-Livermore ‘El Capitan’ Exascale Contract

August 13, 2019

Cray has won the bid to build the first exascale supercomputer for the National Nuclear Security Administration (NNSA) and Lawrence Livermore National Laborator Read more…

By Tiffany Trader

DARPA Looks to Propel Parallelism

September 4, 2019

As Moore’s law runs out of steam, new programming approaches are being pursued with the goal of greater hardware performance with less coding. The Defense Advanced Projects Research Agency is launching a new programming effort aimed at leveraging the benefits of massive distributed parallelism with less sweat. Read more…

By George Leopold

AMD Launches Epyc Rome, First 7nm CPU

August 8, 2019

From a gala event at the Palace of Fine Arts in San Francisco yesterday (Aug. 7), AMD launched its second-generation Epyc Rome x86 chips, based on its 7nm proce Read more…

By Tiffany Trader

D-Wave’s Path to 5000 Qubits; Google’s Quantum Supremacy Claim

September 24, 2019

On the heels of IBM’s quantum news last week come two more quantum items. D-Wave Systems today announced the name of its forthcoming 5000-qubit system, Advantage (yes the name choice isn’t serendipity), at its user conference being held this week in Newport, RI. Read more…

By John Russell

Ayar Labs to Demo Photonics Chiplet in FPGA Package at Hot Chips

August 19, 2019

Silicon startup Ayar Labs continues to gain momentum with its DARPA-backed optical chiplet technology that puts advanced electronics and optics on the same chip Read more…

By Tiffany Trader

Crystal Ball Gazing: IBM’s Vision for the Future of Computing

October 14, 2019

Dario Gil, IBM’s relatively new director of research, painted a intriguing portrait of the future of computing along with a rough idea of how IBM thinks we’ Read more…

By John Russell

Leading Solution Providers

ISC 2019 Virtual Booth Video Tour

CRAY
CRAY
DDN
DDN
DELL EMC
DELL EMC
GOOGLE
GOOGLE
ONE STOP SYSTEMS
ONE STOP SYSTEMS
PANASAS
PANASAS
VERNE GLOBAL
VERNE GLOBAL

Intel Confirms Retreat on Omni-Path

August 1, 2019

Intel Corp.’s plans to make a big splash in the network fabric market for linking HPC and other workloads has apparently belly-flopped. The chipmaker confirmed to us the outlines of an earlier report by the website CRN that it has jettisoned plans for a second-generation version of its Omni-Path interconnect... Read more…

By Staff report

Kubernetes, Containers and HPC

September 19, 2019

Software containers and Kubernetes are important tools for building, deploying, running and managing modern enterprise applications at scale and delivering enterprise software faster and more reliably to the end user — while using resources more efficiently and reducing costs. Read more…

By Daniel Gruber, Burak Yenier and Wolfgang Gentzsch, UberCloud

Cray, Fujitsu Both Bringing Fujitsu A64FX-based Supercomputers to Market in 2020

November 12, 2019

The number of top-tier HPC systems makers has shrunk due to a steady march of M&A activity, but there is increased diversity and choice of processing compon Read more…

By Tiffany Trader

Dell Ramps Up HPC Testing of AMD Rome Processors

October 21, 2019

Dell Technologies is wading deeper into the AMD-based systems market with a growing evaluation program for the latest Epyc (Rome) microprocessors from AMD. In a Read more…

By John Russell

Rise of NIH’s Biowulf Mirrors the Rise of Computational Biology

July 29, 2019

The story of NIH’s supercomputer Biowulf is fascinating, important, and in many ways representative of the transformation of life sciences and biomedical res Read more…

By John Russell

Xilinx vs. Intel: FPGA Market Leaders Launch Server Accelerator Cards

August 6, 2019

The two FPGA market leaders, Intel and Xilinx, both announced new accelerator cards this week designed to handle specialized, compute-intensive workloads and un Read more…

By Doug Black

When Dense Matrix Representations Beat Sparse

September 9, 2019

In our world filled with unintended consequences, it turns out that saving memory space to help deal with GPU limitations, knowing it introduces performance pen Read more…

By James Reinders

With the Help of HPC, Astronomers Prepare to Deflect a Real Asteroid

September 26, 2019

For years, NASA has been running simulations of asteroid impacts to understand the risks (and likelihoods) of asteroids colliding with Earth. Now, NASA and the European Space Agency (ESA) are preparing for the next, crucial step in planetary defense against asteroid impacts: physically deflecting a real asteroid. Read more…

By Oliver Peckham

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