Josh
Josh

Reputation: 3311

MPI basics program

Hi I wanted to learn using MPI in C. I am using Codeblocks on Windows 7

I ran this program:

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

void main (int argc, char *argv[]) {
   int err;
   err = MPI_Init(&argc, &argv);
   printf("Hello world!\n");
   err = MPI_Finalize();
}

but for some reason, i get an error at "mpi.h". Is there a way to add the library?

Upvotes: 3

Views: 3024

Answers (1)

Al H.
Al H.

Reputation: 96

First, install an implementation of MPI. In the past I've used MPICH, but there are other implementations available. I know another is LAM/MPI. Check out the Wikipedia page for additional information at:

http://en.wikipedia.org/wiki/Message_Passing_Interface#Implementations

After you install MPI, use the sample code provided in the Wikipedia article to get comfortable.

Good luck!

Al

Upvotes: 5

Related Questions