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