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", |
24 |
|
MPI_Comm_size(MPI_COMM_WORLD,&numprocs); |
25 |
|
MPI_Comm_rank(MPI_COMM_WORLD,&myid); |
26 |
|
|
27 |
< |
for (rank = 0;rank<numprocs;rank++){ |
28 |
< |
if (rank == myid){ |
29 |
< |
execve(argv[0],newargv,environ); |
30 |
< |
} |
31 |
< |
} |
32 |
< |
|
27 |
> |
// 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 |
> |
printf("Number of files nrst_files %d\n",nrst_files); |
34 |
> |
for (i=0;i<nrst_files;i++){ |
35 |
> |
fname = getfilename(i); |
36 |
> |
newargv[1] = fname; |
37 |
> |
execve(argv[0],newargv,environ); |
38 |
> |
} |
39 |
> |
|
40 |
|
MPI_Finalize(); |
41 |
< |
|
31 |
< |
|
41 |
> |
return(0); |
42 |
|
} |