Esempio n. 1
0
void
efp_balance_work(struct efp *efp, work_fn fn, void *data)
{
#ifdef WITH_MPI
	int rank, size;

	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
	MPI_Comm_size(MPI_COMM_WORLD, &size);

	if (size == 1)
		fn(efp, 0, efp->n_frag, data);
	else {
		MPI_Barrier(MPI_COMM_WORLD);

		if (rank == 0)
			do_master(efp, fn, data);
		else
			do_slave(efp, fn, data);

		MPI_Barrier(MPI_COMM_WORLD);
	}
#else
	fn(efp, 0, efp->n_frag, data);
#endif
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
    if ((argc < 3) || (strcmp(argv[1], "--help") == 0))
        help();

    f = open("/dev/rtnet", O_RDWR);

    if (f < 0) {
        perror("/dev/rtnet");
        exit(1);
    }

    strncpy(tdma_cfg.head.if_name, argv[1], IFNAMSIZ);

    if (strcmp(argv[2], "master") == 0)
        do_master(argc, argv);
    if (strcmp(argv[2], "slave") == 0)
        do_slave(argc, argv);
    if (strcmp(argv[2], "slot") == 0)
        do_slot(argc, argv);
    if (strcmp(argv[2], "detach") == 0)
        do_detach(argc, argv);

    help();

    return 0;
}
Esempio n. 3
0
int main(int argc,char *argv[]) {
	assert(argc>3);
	const int TL=atoi(argv[1]);
	assert(TL>=0);
	const long long ML=atoll(argv[2]);
	assert(ML>=-1);
	assert(setuid(0)==0);
	assert(setgid(0)==0);
	assert(system("swapoff -a")==0);
	slave=fork();
	if(slave==0) {
		char **args=malloc((argc+1)*sizeof(char*));
		args[0]="cgexec";
		args[1]="-g";
		args[2]="memory:/sandbox";
		for(int i=3;i<=argc;i++)args[i]=argv[i];
		do_slave(args);
	}
	assert(slave!=-1);
	do_master(TL,ML);
	return 0;
}