Exemple #1
0
 int Group::run()
 {
   if (_master_mode) {
     return masterRun();
   }
   else {
     return memberRun();
   }
 }
int main(int argc, char** argv) {
    setvbuf(stdout, NULL, _IONBF, 0);
    int err;
    int myrank;

    if(argc != 1) {
        printf("Usage: %s\nThe env var POWERACTUATOR_BOUND sets the global bound\n",argv[0]);
        return 1;
    }
    bound = strtod(getenv("POWERACTUATOR_BOUND"),NULL);
    printf("Actuator settings:\n\tbound: %f\n",bound);

    myrapl_init();

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);

    err = gethostname(hostname, HOST_NAME_MAX);
    if(err) {
        printf("%s fails due to gethostname() error...\n",argv[0]);
        return 1;
    }

    err = EXPOSE_init();
    if(err) {
        printf("EXPOSE_init() failure\n");
        return 1;
    }

    int toggle=0;
    err = EXPOSE_bcasthaltwait(&running, &toggle);
    if(err) {
        printf("shutdown will not work.\n");
    }

    if(myrank==0) {
        // subscribe for kicks and control exec
        MPI_Comm_size(MPI_COMM_WORLD, &commsize);
        allocations=(double*)malloc(sizeof(double)*commsize*2);
        masterRun();
    } else {
        // enter the barrier to wait on the leader
        workerRun();
    }

    MPI_Finalize();
}