/* * Spwans slave processes. */ void spawn_slaves(void) { int i; /* Loop index. */ char arg0[4]; /* Argument 0. */ char *args[2]; /* Arguments. */ /* Spawn slaves. */ args[1] = NULL; for (i = 0; i < nclusters; i++) { sprintf(arg0, "%d", i); args[0] = arg0; pids[i] = mppa_spawn(i, NULL, "is.slave", (const char **)args, NULL); assert(pids[i] != -1); } }
int main(int argc, char **argv) { int status; int pid; int i, j; int nb_clusters, nb_threads; pid = mppa_spawn(0, NULL, "stream_slave", NULL, NULL); assert(pid >= 0); status = 0; if ((status = mppa_waitpid(pid, &status, 0)) < 0) { printf("[I/O] Waitpid on cluster %d failed.\n", pid); mppa_exit(status); } mppa_exit(0); }