I am new to MPI and trying to run 'hello world' program. Here is my program
#include <iostream>
#include <mpi.h>
using namespace std;
int main(int argc, char ** argv)
{
int mynode, totalnodes;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &totalnodes);
MPI_Comm_rank(MPI_COMM_WORLD, &mynode);
cout << "Hello world from process " << mynode;
cout << " of " << totalnodes << endl;
MPI_Finalize();
}
The output is just
Hello world from process 0 of 1
I have multi-core CPU and I think there should be at least 4 processes running. So Output should be:
Hello world from process 0 of 4
Hello world from process 1 of 4
Hello world from process 2 of 4
Hello world from process 3 of 4
or something similar. Can anyone comment what did I miss in the program or compile command? By the way I am running on Windows, MSMPI, gcc compiler on Code::Blocks IDE.
When I use
to run, it runs properly. So I need to give some arguments to code::blocks and I am missing those. Can anyone tell me these settings in code::blocks for Windows?
Thanks in advance.
Thanks.