예제 #1
0
파일: kmriolb.c 프로젝트: tnishinaga/kmr
/* Calculates (x,y) coordinates of the specified rank.
 */
static int
kmr_iolb_calc_xy_of_rank(int rank)
{
    int x, y, z, a, b, c;
    int cc = FJMPI_Topology_sys_rank2xyzabc(rank, &x, &y, &z, &a, &b, &c);
    assert(cc == MPI_SUCCESS);
    return (x << 16) + y;
}
예제 #2
0
int main(int argc, char **argv)
{
	MPI_Init(&argc, &argv);
	int comm_size, comm_rank;
	MPI_Comm_size(MPI_COMM_WORLD, &comm_size);
	MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank);
	if(comm_rank == 0)
	{
		// print the tofu coords
		for(int i = 0 ; i < comm_size; i++)
		{
			//find coords of this rank
			int x,y,z,a,b,c;
			FJMPI_Topology_sys_rank2xyzabc(i,&x,&y,&z,&a,&b,&c);
			fprintf(stdout,"%d: %d %d %d %d %d %d\n",i,x,y,z,a,b,c);
		}
	}
	MPI_Barrier(MPI_COMM_WORLD);
	MPI_Finalize();
	return 0;
}