reset password
Author Message
ahnman341
Posts: 22
Posted 17:12 Feb 21, 2015 |

For lab 4 I created a file:  lab4a.cpp

Compiled using: >mpiCC lab4a.cpp

Run using: >mpirun N a.out 


lab4a.cpp contains:

#include <stdio.h>
#include <mpi.h>
#include <iostream>

int main(int argc, char ** argv){
    int size, node, arr[size][size];

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &node);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    std::cout << "Hello world from " << node << std::endl;

    MPI_Finalize();
    return 0;
}


keep getting an error after run:

"It seems that [at least] one of the processes that was started with
mpirun did not invoke MPI_INIT before quitting (it is possible that
more than one process did not invoke MPI_INIT -- mpirun was only
notified of the first one, which was on node n0).

mpirun can *only* be used with MPI programs (i.e., programs that
invoke MPI_INIT and MPI_FINALIZE).  You can use the "lamexec" program
to run non-MPI programs over the lambooted nodes."


 

why am i getting this error?  

Adam Berman
Posts: 19
Posted 17:16 Feb 21, 2015 |

You're trying to compile a cpp file with a c compiler.

ahnman341
Posts: 22
Posted 17:27 Feb 21, 2015 |

i'm not sure why it's working now, but it's working now.  HAHA

i'm using mpiCC (make sure to capitalize the "CC") to compile cpp files.

mpicc is for .c files