ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/runParallel/runParallel.c
Revision: 2929
Committed: Wed Jul 12 22:01:11 2006 UTC (18 years, 1 month ago) by chuckv
Content type: text/plain
File size: 529 byte(s)
Log Message:
First commit of code to run multiple amber jobs in parallel

File Contents

# User Rev Content
1 chuckv 2929 #include "mpi.h"
2     #include <stdio.h>
3     #include <stdlib.h>
4     #include <unistd.h>
5     #include <dirent.h>
6    
7    
8    
9    
10     int main(int argc, char *argv[]){
11    
12     int myid,numprocs,i,rank;
13     extern char **environ;
14     char *newargv[] ={
15     "/bin/echo",
16     "Hey this now spews on multiple machines",
17     NULL
18     };
19     MPI_Init(&argc,&argv);
20     MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
21     MPI_Comm_rank(MPI_COMM_WORLD,&myid);
22    
23     for (rank = 0;rank<numprocs;rank++){
24     if (rank == myid){
25     execve(argv[0],newargv,environ);
26     }
27     }
28    
29     MPI_Finalize();
30    
31    
32     }