| 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 |
|
extern char **environ; |
| 17 |
|
char *newargv[] ={ |
| 18 |
|
"/bin/echo", |
| 23 |
|
MPI_Comm_size(MPI_COMM_WORLD,&numprocs); |
| 24 |
|
MPI_Comm_rank(MPI_COMM_WORLD,&myid); |
| 25 |
|
|
| 26 |
< |
for (rank = 0;rank<numprocs;rank++){ |
| 27 |
< |
if (rank == myid){ |
| 28 |
< |
execve(argv[0],newargv,environ); |
| 29 |
< |
} |
| 30 |
< |
} |
| 31 |
< |
|
| 26 |
> |
// for (rank = 0;rank<numprocs;rank++){ |
| 27 |
> |
// if (rank == myid){ |
| 28 |
> |
// execve(argv[0],newargv,environ); |
| 29 |
> |
// } |
| 30 |
> |
// } |
| 31 |
> |
nrst_files = nfiles(&dirname,myid); |
| 32 |
> |
for (i=0;i<nrst_files;i++){ |
| 33 |
> |
getfilename(i,fname); |
| 34 |
> |
newargv[1] = *fname; |
| 35 |
> |
execve(argv[0],newargv,environ); |
| 36 |
> |
} |
| 37 |
> |
|
| 38 |
|
MPI_Finalize(); |
| 39 |
< |
|
| 31 |
< |
|
| 39 |
> |
return(0); |
| 40 |
|
} |