ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/runParallel/runParallel.c
(Generate patch)

Comparing trunk/runParallel/runParallel.c (file contents):
Revision 2929 by chuckv, Wed Jul 12 22:01:11 2006 UTC vs.
Revision 2956 by chuckv, Wed Jul 19 16:08:12 2006 UTC

# Line 3 | Line 3
3   #include <stdlib.h>
4   #include <unistd.h>
5   #include <dirent.h>
6 + #include <sys/types.h>
7 + #include "getfile.h"
8  
9  
10  
9
11   int main(int argc, char *argv[]){
12  
13 <  int myid,numprocs,i,rank;
13 >  int myid,numprocs,rank,i;
14 >  int nrst_files;
15 >  int error;
16 >  char * dirname = ".";
17 >  char *fname;
18 >  //char *fname;
19    extern char **environ;
20    char *newargv[] ={
21      "/bin/echo",
22 <    "Hey this now spews on multiple machines",
22 >    "Filename",
23      NULL
24    };
25    MPI_Init(&argc,&argv);
26    MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
27    MPI_Comm_rank(MPI_COMM_WORLD,&myid);
28  
29 <  for (rank = 0;rank<numprocs;rank++){
30 <    if (rank == myid){
31 <      execve(argv[0],newargv,environ);
32 <    }
33 <  }
34 <
29 > //  for (rank = 0;rank<numprocs;rank++){
30 > //    if (rank == myid){
31 > //      execve(argv[0],newargv,environ);
32 > //    }
33 > //  }
34 >        nrst_files = nfiles(&dirname,myid);
35 >        printf("Number of files nrst_files %d\n",nrst_files);
36 >        for (i=0;i<nrst_files;i++){
37 >                fname = getfilename(i);
38 >                printf("Returned file name on loop %d %s\n",i,fname);
39 >                newargv[1] = fname;
40 >                if (fork() == 0){      
41 >                        error = execv(newargv[0],newargv);
42 >                        perror("Steve needs a mojito now");
43 >                        exit(1);
44 >                } else {
45 >                        wait(&error);
46 >                }
47 >        }
48    MPI_Finalize();
49 <
31 <
49 > return(0);
50   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines