Commit 4c876e8b authored by Deike Kleberg's avatar Deike Kleberg
Browse files

define var decomposition

parent 4c6da89c
......@@ -20,6 +20,7 @@
#include "namespace.h"
#include "resource_handle.h"
#include "stream_int.h"
#include "vlist.h"
#endif
/*****************************************************************************/
......@@ -280,10 +281,48 @@ void varMapGen ( int * vSizes, int * sSizes, int * varMapping,
}
#endif
/************************************************************************/
#ifdef USE_MPI
void defVarDeco ( int vlistID, int varID )
{
int varSize, cRank, lChunk, rem, lOffset;
deco_t deco[nProcsCalc];
varSize = vlistInqVarSize ( vlistID, varID );
xdebug ("+++++++++vlistID=%d, varID=%d, varSize=%d", vlistID, varID, varSize );
for ( cRank = 0; cRank < nProcsCalc; cRank++ )
{
lChunk = varSize / nProcsCalc;
lOffset = cRank * lChunk;
rem = varSize % nProcsCalc;
if ( cRank < rem )
{
lChunk++;
lOffset += cRank;
}
else
lOffset += rem;
deco[cRank].rank = cRank;
deco[cRank].offset = lOffset;
deco[cRank].chunk = lChunk;
xdebug("deco %d: %d, %d, %d",
cRank, deco[cRank].rank, deco[cRank].offset,
deco[cRank].chunk );
}
xdebug ("+++++++++vlistID=%d, varID=%d, varSize=%d", vlistID, varID, varSize );
vlistDefVarDeco ( vlistID, varID, nProcsCalc, &deco[0] );
}
#endif
/************************************************************************/
static
void mapVars ( int nNodes, int * nodeSizes )
void varsMapNDeco ( int nNodes, int * nodeSizes )
{
int nStreams, nVars, * resHs, * streamSizes, * varSizes, * varMapping;
int i, j, k = 0;
......@@ -313,6 +352,8 @@ void mapVars ( int nNodes, int * nodeSizes )
for ( i = 0; i < nStreams; i++ )
for ( j = 0; j < * ( streamSizes + i ); j++ )
{
defVarDeco ( streamInqVlist ( * resHs + i ), j );
defVarDeco ( streamInqVlistIDorig ( * resHs + i ), j );
vlistDefVarIOrank ( streamInqVlist ( * resHs + i ), j,
* ( varMapping + k ));
vlistDefVarIOrank ( streamInqVlistIDorig ( * resHs + i ), j,
......@@ -346,7 +387,8 @@ void pioMetadata ( int nNodes, int * nodeSizes )
char * buffer;
int bufferSize;
mapVars ( nNodes, nodeSizes );
//mapVars ( nNodes, nodeSizes );
varsMapNDeco ( nNodes, nodeSizes );
if ( rankGlob < nProcsIO )
{
......
......@@ -51,6 +51,15 @@ typedef struct
levinfo_t;
typedef struct
{
int rank;
int offset;
int chunk;
}
deco_t;
typedef struct
{
int flag;
......@@ -82,6 +91,9 @@ typedef struct
int complevel; // compression level
cdi_atts_t atts;
int iorank;
int decoSize;
deco_t *deco;
}
var_t;
......@@ -123,7 +135,9 @@ int vlistDelAtts(int vlistID, int varID);
int vlistCopyVarAtts(int vlistID1, int varID_1, int vlistID2, int varID_2);
#ifdef USE_MPI
void vlistUnpack(char * buffer, int bufferSize, int * pos, int, MPI_Comm comm);
void vlistUnpack(char * buffer, int bufferSize, int * pos, int, MPI_Comm comm);
void vlistDefVarDeco ( int vlistID, int varID, int decoSize,
deco_t * deco );
#endif
#endif /* _VLIST_H */
......
......@@ -1679,6 +1679,36 @@ int vlistInqVarCompLevel(int vlistID, int varID)
return (vlistptr->vars[varID].complevel);
}
void vlistDefVarDeco ( int vlistID, int varID, int decoSize, deco_t * deco )
{
vlist_t * vlistptr;
int i;
xdebug ("vlistID=%d, varID=%d, decoSize=%d", vlistID, varID, decoSize );
vlistptr = vlist_to_pointer(vlistID );
vlistCheckVarID ( __func__, vlistID, varID );
if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
{
xwarning ( "Operation not executed." );
return;
}
assert ( decoSize && deco );
vlistptr->vars[varID].deco = xmalloc ( decoSize * sizeof ( deco_t ));
for ( i = 0; i < decoSize; i++ )
{
vlistptr->vars[varID].deco[i].rank = deco[i].rank;
vlistptr->vars[varID].deco[i].offset = deco[i].offset;
vlistptr->vars[varID].deco[i].chunk = deco[i].chunk;
}
vlistptr->vars[varID].decoSize = decoSize;
}
void vlistDefVarIOrank ( int vlistID, int varID, int iorank )
{
......
Supports Markdown
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