ex7
This commit is contained in:
parent
89326dd329
commit
2467b9ae03
44 changed files with 22631 additions and 0 deletions
33
ex7/code/task2/first.template/main.cpp
Normal file
33
ex7/code/task2/first.template/main.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// MPI code in C++.
|
||||
// See [Gropp/Lusk/Skjellum, "Using MPI", p.33/41 etc.]
|
||||
// and /opt/mpich/include/mpi2c++/comm.h for details
|
||||
|
||||
#include "greetings.h"
|
||||
#include <iostream> // MPI
|
||||
#include <mpi.h>
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
MPI_Comm icomm = MPI_COMM_WORLD;
|
||||
MPI_Init(&argc, &argv);
|
||||
int myrank, numprocs;
|
||||
// numprocs = 1; // delete this line when uncommenting the next line
|
||||
MPI_Comm_rank(icomm, &myrank); // my MPI-rank
|
||||
MPI_Comm_size(icomm, &numprocs);
|
||||
|
||||
if (0==myrank) {
|
||||
cout << "\n There are " << numprocs << " processes running.\n \n";
|
||||
}
|
||||
|
||||
// greetings(icomm);
|
||||
greetings_cpp(icomm);
|
||||
|
||||
if (0==myrank) cout << endl;
|
||||
|
||||
MPI_Finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue