ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/runParallel/runParallel.c
Revision: 2943
Committed: Mon Jul 17 23:55:43 2006 UTC (18 years, 1 month ago) by chuckv
Content type: text/plain
File size: 852 byte(s)
Log Message:
It's sort of working now.

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 chuckv 2933 #include "getfile.h"
7 chuckv 2929
8    
9    
10     int main(int argc, char *argv[]){
11    
12 chuckv 2933 int myid,numprocs,rank,i;
13     int nrst_files;
14 chuckv 2943 char * dirname = ".";
15     char *fname;
16     //char *fname;
17 chuckv 2929 extern char **environ;
18     char *newargv[] ={
19     "/bin/echo",
20     "Hey this now spews on multiple machines",
21     NULL
22     };
23     MPI_Init(&argc,&argv);
24     MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
25     MPI_Comm_rank(MPI_COMM_WORLD,&myid);
26    
27 chuckv 2933 // for (rank = 0;rank<numprocs;rank++){
28     // if (rank == myid){
29     // execve(argv[0],newargv,environ);
30     // }
31     // }
32     nrst_files = nfiles(&dirname,myid);
33 chuckv 2943 printf("Number of files nrst_files %d\n",nrst_files);
34 chuckv 2933 for (i=0;i<nrst_files;i++){
35 chuckv 2943 fname = getfilename(i);
36     newargv[1] = fname;
37 chuckv 2933 execve(argv[0],newargv,environ);
38     }
39    
40 chuckv 2929 MPI_Finalize();
41 chuckv 2933 return(0);
42 chuckv 2929 }