Commit ca7f6b61 authored by Deike Kleberg's avatar Deike Kleberg
Browse files

write iorank also in copied vlist.

parent c0179ef9
......@@ -71,8 +71,6 @@ void modelRun ()
double levs[nlev] = {101300, 92500, 85000, 50000, 20000};
double var[nlon*nlat*nlev];
xdebug ();
namespaceInit ( 1, hasLocalFile );
gridID = gridCreate(GRID_LONLAT, nlon*nlat);
......@@ -94,8 +92,6 @@ void modelRun ()
}
taxisID = taxisCreate(TAXIS_ABSOLUTE);
vlistDefTaxis(vlistID, taxisID);
xdebug ();
streamID = streamOpenWrite("example.grb", FILETYPE_GRB);
if ( streamID < 0 )
......@@ -103,22 +99,14 @@ void modelRun ()
fprintf(stderr, "%s\n", cdiStringError(streamID));
return;
}
xdebug ();
streamDefVlist(streamID, vlistID);
#ifdef USE_MPI
xdebug ();
pioMetadata2 ( nNodes, nodeSizes );
#endif
xdebug ();
for ( tsID = 0; tsID < ntsteps; tsID++ )
{
taxisDefVdate(taxisID, 19850101+tsID);
......@@ -131,21 +119,15 @@ void modelRun ()
#ifdef USE_MPI
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
if ( rank == 0 )
if ( rank == 0 ) reshArrayPrint ( "reshArrayModel" );
#endif
reshArrayPrint ( "reshArrayModel" );
xdebug ();
streamClose(streamID);
vlistDestroy(vlistID);
taxisDestroy(taxisID);
zaxisDestroy(zaxisID);
gridDestroy(gridID);
xdebug ( "out" );
gridDestroy(gridID);
}
......@@ -167,11 +149,7 @@ int main (int argc, char *argv[])
if ( nProcsIO <=0 || nProcsIO > ( float ) sizeGlob / 2.0 )
pcdiAbort ( "bad distribution of tasks on PEs", __FILE__, __func__,
__LINE__ );
#endif
xdebug ();
#ifdef USE_MPI
commModel = pioInit_c ( commGlob, nProcsIO, 0 );
#endif
......
......@@ -218,6 +218,7 @@ void gridGetIndexArray ( int, int * );
void streamGetIndexArray ( int, int * );
void zaxisGetIndexAtrray ( int, int * );
void vlistDefVarIOrank ( int, int, int );
int vlistInqVarIOrank ( int, int );
/* CDI control routines */
......@@ -272,6 +273,7 @@ void streamDefVlist(int streamID, int vlistID);
/* streamInqVlist: Get the Vlist of a stream */
int streamInqVlist(int streamID);
int streamInqVlistIDorig(int streamID);
/* streamInqFiletype: Get the filetype */
int streamInqFiletype(int streamID);
......
......@@ -197,7 +197,7 @@ void mapProblems ( int problemSizes[], int * problemMapping, int nProblems,
problemMapping[ dummy[i] ] = writerIdx;
buckets[writerIdx] += *ip[i];
}
/*
if ( ddebug > 2 )
{
xprintArray ( "problemSizes = ", problemSizes, nProblems, DATATYPE_INT );
......@@ -207,8 +207,7 @@ void mapProblems ( int problemSizes[], int * problemMapping, int nProblems,
xprintArray ( "meanBucket", meanBucket, nWriter, DATATYPE_FLT );
xprintArray ( "actual buckets", buckets, nWriter, DATATYPE_INT );
}
return;
*/
}
/****************************************************/
......@@ -315,7 +314,7 @@ void varMapGen ( int * vSizes, int * sSizes, int * varMapping,
free ( varMappingNode );
free ( weightsVarsNode );
}
/*
if ( ddebug > 1 )
{
xprintArray ( "varMapping", varMapping, nVars, DATATYPE_INT );
......@@ -326,6 +325,7 @@ void varMapGen ( int * vSizes, int * sSizes, int * varMapping,
buckets[*(varMapping + i ) - nProcsCalc] += * ( vSizes + i );
xprintArray ( "buckets", buckets, nProcsIO, DATATYPE_INT );
}
*/
}
#endif
......@@ -338,26 +338,35 @@ void mapVars ( int nNodes, int * nodeSizes )
int i, j, k = 0;
#ifdef USE_MPI
nStreams = streamSize ();
xdebug ( "nStreams=%d", nStreams );
resHs = xmalloc ( nStreams * sizeof ( int ));
streamSizes = xmalloc ( nStreams * sizeof ( int ));
streamGetIndexArray ( nStreams, resHs );
for ( i = 0; i < nStreams; i++ )
{
streamSizes[i] = streamInqNvars ( * ( resHs + i ));
xdebug ( "streamSizes[%d]=%d", i, * ( streamSizes + i ));
}
streamSizes[i] = streamInqNvars ( * ( resHs + i ));
nVars = xsum ( nStreams, streamSizes );
xdebug ( "nVars=%d", nVars );
varSizes = xmalloc ( nVars * sizeof ( int ));
varMapping = xmalloc ( nVars * sizeof ( int ));
for ( i = 0; i < nStreams; i++ )
for ( j = 0; j < * ( streamSizes + i ); j++ )
varSizes[k] += vlistInqVarSize ( streamInqVlist ( * resHs + i ), j );
varSizes[k++] += vlistInqVarSize ( streamInqVlist ( * resHs + i ), j );
varMapGen ( varSizes, streamSizes, varMapping,
nStreams, nodeSizes, nNodes );
//reshSetVarMapping ( varMapping );
k = 0;
for ( i = 0; i < nStreams; i++ )
for ( j = 0; j < * ( streamSizes + i ); j++ )
{
vlistDefVarIOrank ( streamInqVlist ( * resHs + i ), j,
* ( varMapping + k ));
vlistDefVarIOrank ( streamInqVlistIDorig ( * resHs + i ), j,
* ( varMapping + k++ ));
}
if ( varMapping ) free ( varMapping );
if ( varSizes ) free ( varSizes );
......
......@@ -423,6 +423,7 @@ void reshPackBufferCreate ( char ** packBuffer, int * packBufferSize, MPI_Comm c
if ( ! type )
continue;
xmpi ( MPI_Pack ( &type, 1, MPI_INT, * packBuffer,
* packBufferSize, &packBufferPos, comm ));
......
......@@ -2082,6 +2082,18 @@ int streamInqVlist(int streamID)
}
int streamInqVlistIDorig(int streamID)
{
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (streamptr->vlistIDorig);
}
void streamDefCompType(int streamID, int comptype)
{
stream_t *streamptr;
......
......@@ -980,7 +980,7 @@ int vlistNtsteps(int vlistID)
static void
vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
{
int nvars, flag, index;
int nvars, flag, index, iorank;
int varID, fvarID, mvarID, flevID, mlevID, levID;
int param, gridID, zaxisID, timeID, nlevs;
int dtype;
......@@ -1004,7 +1004,8 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
if ( nvars > 0 )
{
fprintf ( fp, " varID param gridID zaxisID timeID nlevel flag name longname\n");
fprintf ( fp, " varID param gridID zaxisID timeID nlevel flag "
" name longname iorank\n");
for ( varID = 0; varID < nvars; varID++ )
{
param = vlistptr->vars[varID].param;
......@@ -1016,11 +1017,13 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
longname = vlistptr->vars[varID].longname;
units = vlistptr->vars[varID].units;
flag = vlistptr->vars[varID].flag;
iorank = vlistptr->vars[varID].iorank;
cdiParamToString(param, paramstr, sizeof(paramstr));
fprintf ( fp, "%6d %-8s %6d %6d %6d %6d %5d %-8s %s",
fprintf ( fp, "%6d %s %6d %6d %6d %6d %6d %s "
" %s %d",
varID, paramstr, gridID, zaxisID, timeID, nlevs, flag,
name ? name : "", longname ? longname : "");
name ? name : "", longname ? longname : "", iorank );
if ( units ) fprintf ( fp, " [%s]", units);
fprintf ( fp, "\n");
}
......
......@@ -1627,12 +1627,6 @@ void vlistDefVarCompType(int vlistID, int varID, int comptype)
{
vlist_t *vlistptr;
if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
{
xwarning ( "Operation not executed." );
return;
}
vlistptr = vlist_to_pointer(vlistID);
vlistCheckVarID(__func__, vlistID, varID);
......@@ -1693,12 +1687,6 @@ void vlistDefVarIOrank ( int vlistID, int varID, int iorank )
{
vlist_t * vlistptr;
if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
{
xwarning ( "Operation not executed." );
return;
}
vlistptr = vlist_to_pointer(vlistID );
vlistCheckVarID ( __func__, vlistID, varID );
......@@ -1712,10 +1700,23 @@ void vlistDefVarIOrank ( int vlistID, int varID, int iorank )
vlistptr->vars[varID].iorank = iorank;
}
int vlistInqVarIOrank(int vlistID, int varID)
{
vlist_t *vlistptr;
vlistptr = vlist_to_pointer(vlistID);
vlistCheckVarID(__func__, vlistID, varID);
return vlistptr->vars[varID].iorank;
}
#ifdef USE_MPI
enum {
vlistvar_nints = 20,
vlistvar_nints = 21,
vlistvar_ndbls = 3,
};
......@@ -1760,6 +1761,8 @@ void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
var_t *var = p->vars + varID;
int tempbuf[vlistvar_nints], namesz, longnamesz, stdnamesz, unitssz, i;
xdebug ( "var->iorank=%d", var->iorank );
tempbuf[0] = var->flag;
tempbuf[1] = var->gridID;
tempbuf[2] = var->zaxisID;
......@@ -1780,6 +1783,7 @@ void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
tempbuf[17] = var->comptype;
tempbuf[18] = var->complevel;
tempbuf[19] = var->nlevs;
tempbuf[20] = var->iorank;
dtempbuf[0] = var->missval;
dtempbuf[1] = var->scalefactor;
dtempbuf[2] = var->addoffset;
......@@ -1905,11 +1909,13 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
vlistDefFlag(vlistID, newvar, flagSetLev, levbuf[flagSetLev][0]);
}
vlistDefVarIOrank(vlistID, newvar, tempbuf[20]);
vlistAttsUnpack(vlistID, newvar, buf, size, position, comm);
}
#endif
/*
* Local Variables:
* c-file-style: "Java"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment