HPF: Programming Linux Clusters the Easy Way
Many programmers use Linux as their operating system of choice when developing applications software. Increasingly, they run the application on the same PC when it is developed. But what do they do if the application becomes too large or runs too long?
The obvious answer is to run it on a cluster of PCs, possibly linked by Ethernet. To do this, you need to write code for each processor. In principle, different code for each, but usually there is common code for all except a selected one or two. The code must include data passing from processor to processor as required. This type of coding uses a “message-passing paradigm” and is in common use on multiprocessor mainframes and workstation clusters. Standard message-passing libraries, PVM (parallel virtual machine) and MPI (message-passing interface), exist to ensure portability.
Writing message-passing code is much harder than writing serial code, and it is easy to show why. Most scientific and engineering programming makes heavy use of one and two dimensional arrays, so we add two vectors this way:
DO I = 1,10000 a(i) = b(i) + c(i) END DO
This is clearly a parallel operation: all the elements of b and c can be added in parallel. For this to occur on a PC or workstation cluster, or indeed any distributed-memory parallel system, the elements of b, c and, most likely, a must be distributed over the available processors. The programmer must arrange this in his code by dealing with bits of each vector on each processor and keeping track of the bits.
A better solution would be for the compiler to do the arranging for you. Then your code could still refer to the complete vector or matrix object and thereby be easier to write, understand and maintain.
The advantages of compiler-aided parallel programming are widely accepted. In the scientific/engineering community, these advantages have led to the development of a standard parallel language called HPF, High Performance FORTRAN, and of HPF compilers for a widening range of architectures.
For good reasons, HPF is deliberately based on the latest, greatly upgraded, version of FORTRAN: FORTRAN95. Beginning with FORTRAN90, FORTRAN contains a rich variety of array facilities so that the loop above becomes the one line:
a = b + c
which is easier for a compiler, as well as a human, to understand.
Compilers do have difficulty deciding how best to distribute arrays across the processors; thus, HPF gives the programmer a way of providing help. Given that help, the compiler can fully automate the production of a data parallel program from a single FORTRAN77/90/95 source.
HPF codes are portable across SIMD, MIMD shared memory and MIMD Distributed Memory architectures. In particular, you can use HPF on a Linux PC cluster.
Here is a concocted example to demonstrate the facilities provided by HPF:
REAL a(1000), b(1000), c(1000), &
x(500),y(0:501)
!HPF$ PROCESSORS procs(10)
!HPF$ DISTRIBUTE(BLOCK) ONTO procs :: a, b
!HPF$ DISTRIBUTE(CYCLIC) ONTO procs :: c
!HPF$ ALIGN x(i) WITH y(i+1)
...
a(:) = b(:) ! Statement 1
x(1:500) = y(2:501) ! Statement 2
a(:) = c(:) ! Statement 3
...
The lines starting with !HPF are HPF directives; the rest are standard FORTRAN90 and carry out three array operations. What are the directives doing?
The PROCESSORS directive specifies a linear arrangement of 10 virtual processors, which are mapped to the available physical processors in a manner not specified by the language. You might expect to need at least ten physical processors, but most HPF compilers will run the code happily on one or more (up to ten) physical processors. Grids of processors in any number of dimensions up to seven can be defined. They should match the problem being solved in some way—perhaps by helping to minimize communication costs. The processor directive is optional; the number of processors to use can be specified at runtime.
The DISTRIBUTE directives tell (actually, recommend to) the compiler how to distribute the elements of the arrays. Arrays a, b are distributed with blocks of 100 contiguous elements per processor, while c is distributed so that, for example, c(1), c(11), c(21), ... are on processor procs(1) and so on.
Note that the distribution of the arrays x and y is not specified explicitly, while the way they are aligned to each other is specified. The ALIGN statement causes x(i) and y(i+1) to be stored on the same processor for all values of i, regardless of the actual distribution.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- Validate an E-Mail Address with PHP, the Right Way
- Build a Skype Server for Your Home Phone System
- Why Python?
- Tech Tip: Really Simple HTTP Server with Python
- A Topic for Discussion - Open Source Feature-Richness?




2 hours 28 min ago
6 hours 16 min ago
6 hours 24 min ago
8 hours 38 min ago
11 hours 8 min ago
21 hours 11 min ago
1 day 1 hour ago
1 day 5 hours ago
1 day 5 hours ago
1 day 8 hours ago