Tutorial: C + MySQL + MPI

From dftwiki3
Revision as of 15:30, 13 October 2013 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- =References= * http://www.cyberciti.biz/tips/linux-unix-connect-mysql-c-api-program.html =Verify that MPI works= * test your installation with the classic hello...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut (talk) 16:30, 13 October 2013 (EDT)


References

Verify that MPI works

  • test your installation with the classic hello world program.

Source


// mpi_hello.c

#include <mpi.h>
#include <stdio.h>
 
int main (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;
}


Compile & Run

mpicc -o hello mpi_hello.c
mpirun -np 2 ./hello
Hello world from process 0 of 2
Hello world from process 1 of 2