Created
July 31, 2014 20:50
-
-
Save jdherman/c24deff6386afb30c5bb to your computer and use it in GitHub Desktop.
run any program in parallel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mpi.h> | |
#include <stdio.h> | |
int main (argc, argv) | |
int argc; | |
char *argv[]; | |
{ | |
int rank,size; | |
char cmd[1000]; | |
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 */ | |
sprintf(cmd,"%s %d %d",argv[1],rank,size); | |
system(cmd); | |
MPI_Finalize(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment