15 int AL_Decomp_2d_(
int nproc,
int npdim,
int *ldims,
int *gdims);
16 int AL_Decomp_3d_(
int nproc,
int npdim,
int *ldims,
int *gdims);
75 int pow3, powz, myrank;
76 int ndim, minxy, maxxy, nproc2, minp2, maxp2, nprocz;
77 int nprocx_old, nprocy_old, nprocz_old;
82 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
90 pow3 = floor( log((
double) nproc)/log(2.0)+0.5 );
93 printf(
"AL_Decomp_3d_: pow3 = %d\n",pow3);
105 if( myrank == 0 ) printf(
"AL_Decompose3d: nproc is not a power of two\n");
112 powz = rint( log((
double) nz)/log(2.0) );
113 powz = floor( log((
double) nz)/log(2.0) +0.5);
121 maxxy = nx > ny ? nx : ny;
122 minxy = nx < ny ? nx : ny;
124 for( ipz=0; ipz<=pow3; ipz++){
127 printf(
"AL_Decomp_3d_: In Loop ipz = %d\n",ipz);
137 nproc2 = pow(2,(pow3-ipz));
151 maxp2 = nprocx > nprocy ? nprocx : nprocy;
152 minp2 = nprocx < nprocy ? nprocx : nprocy;
155 if( nprocz >= maxp2)
break;
158 if( nz < maxxy && nz > minxy ) {
159 if( nprocz < maxp2 && nprocx > minp2)
break;
163 if( nprocz <= minp2 ){
177 printf(
"AL_decompose3d_: %d %d %d\n", nprocx, nprocy, nprocz);
198 int np1, np2, nproc1, nproc2, nproc1_old, nproc2_old;
199 int np1_old, np2_old, n1, n2;
205 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
226 pow2 = floor( log((
double) nproc)/log(2.0)+0.5 );
229 printf(
"AL_Decomp2d_ [0]: %d %d\n",pow2, nproc);
241 if( myrank == 0 ) printf(
"AL_Decompose2d: nproc is not a power of two\n");
258 if( myrank == 0 ) printf(
"AL_Decompose2d: nx is not a power of two: %d\n",nx);
276 if( myrank == 0 ) printf(
"AL_Decompose2d: ny is not a power of two: %d\n",ny);
284 for( ip=0; ip<=pow2; ip++){
292 nproc2 = pow(2,(pow2-ip));
302 printf(
"AL_decomp2d_ np1, np2: %d %d | %d %d\n",n1,n2,nproc1,nproc2);
312 if( np1 < np2 )
break;
329 printf(
"AL_Decomp2d_: %d %d | %d %d\n",nprocx, nprocy, gdims[0], gdims[1]);
int AL_Auto_Decomp_(int nproc, int npdim, int *ldims, int *gdims)
int AL_Decomp_2d_(int nproc, int npdim, int *ldims, int *gdims)
int AL_Decomp_3d_(int nproc, int npdim, int *ldims, int *gdims)
Internal include file for the ArrayLib.