1
1
openmpi/examples/hello_cxx.cc
Brian Barrett fdc8f69b84 * need to include iostream as well as stdio.h when doing the tricks with
MPI::SEEK_* because iostreams (well, ios_base, but I don't think that
    should be included directly) can use SEEK_* as values in an enum, which
    means that 'const int' is bad for them.
  * Remove now useless comments in the cxx example programs
  * include iostream after mpi.h so that our examples work with other MPI
    implementations that don't try to be as friendly with the constants.

Refs trac:387

This commit was SVN r12125.

The following Trac tickets were found above:
  Ticket 387 --> https://svn.open-mpi.org/trac/ompi/ticket/387
2006-10-16 14:20:31 +00:00

25 строки
630 B
C++

//
// Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
//
// Sample MPI "hello world" application in C++
//
#include "mpi.h"
#include <iostream>
int main(int argc, char **argv)
{
int rank, size;
MPI::Init();
rank = MPI::COMM_WORLD.Get_rank();
size = MPI::COMM_WORLD.Get_size();
std::cout << "Hello, world! I am " << rank << " of " << size << std::endl;
MPI::Finalize();
return 0;
}