|
|
@@ -86,8 +86,8 @@ int main(int argc, char **argv)
|
|
|
// Init MPI
|
|
|
MPI_Init(&argc, &argv);
|
|
|
|
|
|
- if (argc < 2) {
|
|
|
- printf("You must pass at least one argument (the number of workers to start).\n");
|
|
|
+ if (argc < 3) {
|
|
|
+ printf("You must pass at least two arguments (the number of workers and number of dpnodes to start per node/rank).\n");
|
|
|
printf("The remaining arguments will be passed to the controller.\n");
|
|
|
|
|
|
MPI_Finalize();
|
|
|
@@ -109,6 +109,7 @@ int main(int argc, char **argv)
|
|
|
char boundportaddr[259];
|
|
|
|
|
|
unsigned int num_workers = strtol(argv[1], NULL, 10);
|
|
|
+ unsigned int num_dpnodes = strtol(argv[2], NULL, 10);
|
|
|
|
|
|
if (rank == 0) {
|
|
|
// Start the controller
|
|
|
@@ -121,8 +122,8 @@ int main(int argc, char **argv)
|
|
|
close_highfds_except(controllerfds[1]);
|
|
|
|
|
|
char name[] = "controller";
|
|
|
- argv[1] = name;
|
|
|
- execv("./controller", argv+1);
|
|
|
+ argv[2] = name;
|
|
|
+ execv("./controller", argv+2);
|
|
|
return 1;
|
|
|
} else {
|
|
|
// Parent; close the write half of the pipe
|
|
|
@@ -159,11 +160,13 @@ int main(int argc, char **argv)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (fork_and_remember(children) == 0) {
|
|
|
- // And a dpnode
|
|
|
- close_highfds_except(-1);
|
|
|
- execl("./dpnode", "./dpnode", boundaddr, portstr, NULL);
|
|
|
- return 1;
|
|
|
+ // And dpnodes
|
|
|
+ for (int i=0; i<num_dpnodes; i++) {
|
|
|
+ if (fork_and_remember(children) == 0) {
|
|
|
+ close_highfds_except(-1);
|
|
|
+ execl("./dpnode", "./dpnode", boundaddr, portstr, NULL);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Now wait for all the children
|