hello.cpp for mpi

master
patrick 9 years ago
parent 210aeb7874
commit 34c4615fa4

@ -0,0 +1,22 @@
#define _MPI_CPP_BINDINGS
#include <mpi.h>
#include <iostream>
int main(int argc, char* argv[])
{
MPI::Init(argc, argv);
int rank = MPI::COMM_WORLD.Get_rank();
int size = MPI::COMM_WORLD.Get_size();
int length;
char* pName = new char[MPI::MAX_PROCESSOR_NAME+1];
MPI::Get_processor_name(pName, length);
std::string name(pName);
delete [] pName;
std::cout << "Hello World! I am " << rank << " of " << size;
std::cout << " running on host " << name.c_str() << std::endl;
MPI::Finalize();
}

@ -0,0 +1,4 @@
zotac1
zotac2
zotac3
zotac4
Loading…
Cancel
Save