HP-MPI User's Guide (11th Edition)

Example applications
sort.C
Appendix A268
sort.C
This program does a simple integer sort in parallel. The sort input is
built using the "rand" random number generator. The program is
self-checking and can run with any number of ranks.
#define NUM_OF_ENTRIES_PER_RANK100
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <mpi.h>
#include <limits.h>
#include <iostream.h>
#include <fstream.h>
//
// Class declarations.
//
class Entry {
private:
int value;
public:
Entry()
{ value = 0; }
Entry(int x)
{ value = x; }
Entry(const Entry &e)
{ value = e.getValue(); }
Entry& operator= (const Entry &e)
{ value = e.getValue(); return (*this); }
int getValue() const { return value; }
int operator> (const Entry &e) const
{ return (value > e.getValue()); }
};
class BlockOfEntries {
private: