Difference between revisions of "Install MPI on a MacBook"

From dftwiki3
Jump to: navigation, search
(Extract and Install)
Line 24: Line 24:
  
 
This last command takes a while as well...
 
This last command takes a while as well...
 +
 +
=Testing=
 +
Create this file in the directory of your choice:
 +
<br />
 +
<source lang="C">
 +
/* C Example */
 +
#include <stdio.h>
 +
#include <mpi.h>
 +
 +
 +
int main (argc, argv)
 +
    int argc;
 +
    char *argv[];
 +
{
 +
  int rank, size;
 +
 +
  MPI_Init (&argc, &argv); /* starts MPI */
 +
  MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */
 +
  MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */
 +
  printf( "Hello world from process %d of %d\n", rank, size );
 +
  MPI_Finalize();
 +
  return 0;
 +
}
 +
</source>
 +
<br />

Revision as of 11:50, 7 October 2013

--D. Thiebaut (talk) 12:43, 7 October 2013 (EDT)


Download

Extract and Install

  • Assume that the downloaded file is in your ~/Downloads directory
  • Just follow the directions in the INSTALL file, which are summarized below. The installation was done on *my* machine, and assumes the user is thiebaut. Change and plug-in your own user name.
cd
mkdir mpi
mkdir mpi/download
cd mpi/download
mv ../Downloads/openmpi-1.6.5.tar.gz .
tar -xzvf openmpi-1.6.5.tar.gz 
cd openmpi-1.6.5
./configure --prefix=/Users/thiebaut/mpi/    (replace thiebaut by your user name on your Mac)
 

The last command will take 10 minutes or so. When it is done, make all and install

make all install

This last command takes a while as well...

Testing

Create this file in the directory of your choice:

/* C Example */
#include <stdio.h>
#include <mpi.h>


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

  MPI_Init (&argc, &argv);	/* starts MPI */
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);	/* get current process id */
  MPI_Comm_size (MPI_COMM_WORLD, &size);	/* get number of processes */
  printf( "Hello world from process %d of %d\n", rank, size );
  MPI_Finalize();
  return 0;
}