Commit ea694a5e authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Add forwarding of grid UUIDs to PIO servers.

* Also compare uuid in grid comparison.
parent cbf3dd65
......@@ -2380,6 +2380,9 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
else if ( g2->mask_gme )
return differ;
if (memcmp(g1->uuid, g2->uuid, CDI_UUID_SIZE))
return differ;
return equal;
}
......@@ -3871,7 +3874,8 @@ enum { gridNint = 27,
gridHasXBoundsFlag = 1 << 5,
gridHasYBoundsFlag = 1 << 6,
gridHasReferenceFlag = 1 << 7,
gridHasRowLonFlag = 1 << 8
gridHasRowLonFlag = 1 << 8,
gridHasUUIDFlag = 1 << 9,
};
......@@ -3885,8 +3889,8 @@ static int gridGetComponentFlags(const grid_t * gridP)
| (gridHasXBoundsFlag & (int)((unsigned)(gridP->xbounds == NULL) - 1U))
| (gridHasYBoundsFlag & (int)((unsigned)(gridP->ybounds == NULL) - 1U))
| (gridHasReferenceFlag & (int)((unsigned)(gridP->reference == NULL) - 1U))
| (gridHasRowLonFlag & (int)((unsigned)(gridP->rowlon == NULL) - 1U));
| (gridHasRowLonFlag & (int)((unsigned)(gridP->rowlon == NULL) - 1U))
| (gridHasUUIDFlag & (int)((unsigned)cdiUUIDIsNull(gridP->uuid) - 1U));
return flags;
}
......@@ -3992,6 +3996,9 @@ gridGetPackSize(void * voidP, void *context)
+ serializeGetSize(1, DATATYPE_UINT32, context);
}
if (!cdiUUIDIsNull(gridP->uuid))
packBuffSize += serializeGetSize(CDI_UUID_SIZE, DATATYPE_UCHAR, context);
return packBuffSize;
}
......@@ -4209,6 +4216,11 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
&d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_UCHAR, gridP->size, gridP->mask_gme) == d);
}
if (memberMask & gridHasUUIDFlag)
{
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->uuid, CDI_UUID_SIZE, DATATYPE_UCHAR, context);
}
}
......@@ -4219,6 +4231,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
grid_t * gridP = ( grid_t * ) voidP;
int size;
uint32_t d;
int memberMask;
char charBuffer[gridNstrings * CDI_MAX_NAME];
{
......@@ -4250,7 +4263,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
intBuffer[23] = gridP->ysize;
intBuffer[24] = gridP->locked;
intBuffer[25] = gridP->lcomplex;
intBuffer[26] = gridGetComponentFlags(gridP);
intBuffer[26] = memberMask = gridGetComponentFlags(gridP);
serializePack(intBuffer, gridNint, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context);
......@@ -4259,7 +4272,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if (gridP->rowlon)
if (memberMask & gridHasRowLonFlag)
{
xassert((size = gridP->nrowlon));
serializePack(gridP->rowlon, size, DATATYPE_INT,
......@@ -4304,7 +4317,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if (gridP->xvals)
if (memberMask & gridHasXValsFlag)
{
if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
size = gridP->size;
......@@ -4319,7 +4332,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if (gridP->yvals)
if (memberMask & gridHasYValsFlag)
{
if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
size = gridP->size;
......@@ -4333,7 +4346,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if (gridP->area)
if (memberMask & gridHasAreaFlag)
{
xassert(gridP->size);
......@@ -4344,7 +4357,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if (gridP->xbounds)
if (memberMask & gridHasXBoundsFlag)
{
xassert ( gridP->nvertex );
if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
......@@ -4360,7 +4373,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if (gridP->ybounds)
if (memberMask & gridHasYBoundsFlag)
{
xassert(gridP->nvertex);
if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
......@@ -4389,7 +4402,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context);
if ( gridP->reference )
if (memberMask & gridHasReferenceFlag)
{
size = (int)strlen(gridP->reference) + 1;
serializePack(&size, 1, DATATYPE_INT,
......@@ -4401,7 +4414,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if ( gridP->mask )
if (memberMask & gridHasMaskFlag)
{
xassert((size = gridP->size));
serializePack(gridP->mask, size, DATATYPE_UCHAR,
......@@ -4411,7 +4424,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
if (gridP->mask_gme)
if (memberMask & gridHasGMEMaskFlag)
{
xassert((size = gridP->size));
......@@ -4421,6 +4434,10 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context);
}
if (memberMask & gridHasUUIDFlag)
serializePack(gridP->uuid, CDI_UUID_SIZE, DATATYPE_UCHAR,
packBuffer, packBufferSize, packBufferPos, context);
}
/*
......
......@@ -28,20 +28,24 @@ pio_write_deco2d_SOURCES = pio_write.c pio_write.h deco2d_model.c \
simple_model_helper.h simple_model_helper.c \
create_uuid.h create_uuid.c
test_resource_copy_SOURCES = test_resource_copy.c \
$(top_srcdir)/src/resource_unpack.c
test_resource_copy_mpi_SOURCES = test_resource_copy.c
#
$(top_srcdir)/src/resource_unpack.c \
create_uuid.h create_uuid.c
test_resource_copy_LDADD = $(UUID_C_LIB) $(LDADD)
test_resource_copy_mpi_SOURCES = test_resource_copy.c \
create_uuid.h create_uuid.c
AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS)
if USE_MPI
pio_write_LDADD = ../src/libcdipio.la $(UUID_C_LIB)
pio_write_deco2d_LDADD = ../src/libcdipio.la $(UUID_C_LIB)
TESTS += test_resource_copy_mpi_run
check_PROGRAMS += test_resource_copy_mpi
test_resource_copy_mpi_LDADD = ../src/libcdipio.la
test_resource_copy_mpi_LDADD = ../src/libcdipio.la $(UUID_C_LIB)
test_resource_copy_mpi_CFLAGS = $(AM_CFLAGS) $(CFLAGS) -DMPI_MARSHALLING
else
pio_write_LDADD = $(LDADD) $(UUID_C_LIB)
pio_write_deco2d_LDADD = $(LDADD) $(UUID_C_LIB)
test_resource_copy_mpi_LDADD = $(LDADD) $(UUID_C_LIB)
endif
LDADD = ../src/libcdi.la -lm
......
......@@ -174,15 +174,18 @@ test_grib_OBJECTS = $(am_test_grib_OBJECTS)
test_grib_LDADD = $(LDADD)
test_grib_DEPENDENCIES = ../src/libcdi.la
am_test_resource_copy_OBJECTS = test_resource_copy.$(OBJEXT) \
resource_unpack.$(OBJEXT)
resource_unpack.$(OBJEXT) create_uuid.$(OBJEXT)
test_resource_copy_OBJECTS = $(am_test_resource_copy_OBJECTS)
test_resource_copy_LDADD = $(LDADD)
test_resource_copy_DEPENDENCIES = ../src/libcdi.la
test_resource_copy_DEPENDENCIES = $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_1)
am_test_resource_copy_mpi_OBJECTS = \
test_resource_copy_mpi-test_resource_copy.$(OBJEXT)
test_resource_copy_mpi-test_resource_copy.$(OBJEXT) \
test_resource_copy_mpi-create_uuid.$(OBJEXT)
test_resource_copy_mpi_OBJECTS = $(am_test_resource_copy_mpi_OBJECTS)
@USE_MPI_FALSE@test_resource_copy_mpi_DEPENDENCIES = \
@USE_MPI_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
@USE_MPI_TRUE@test_resource_copy_mpi_DEPENDENCIES = \
@USE_MPI_TRUE@ ../src/libcdipio.la
@USE_MPI_TRUE@ ../src/libcdipio.la $(am__DEPENDENCIES_2)
test_resource_copy_mpi_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(test_resource_copy_mpi_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
......@@ -485,16 +488,20 @@ pio_write_deco2d_SOURCES = pio_write.c pio_write.h deco2d_model.c \
create_uuid.h create_uuid.c
test_resource_copy_SOURCES = test_resource_copy.c \
$(top_srcdir)/src/resource_unpack.c
$(top_srcdir)/src/resource_unpack.c \
create_uuid.h create_uuid.c
test_resource_copy_LDADD = $(UUID_C_LIB) $(LDADD)
test_resource_copy_mpi_SOURCES = test_resource_copy.c \
create_uuid.h create_uuid.c
test_resource_copy_mpi_SOURCES = test_resource_copy.c
#
AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS)
@USE_MPI_FALSE@pio_write_LDADD = $(LDADD) $(UUID_C_LIB)
@USE_MPI_TRUE@pio_write_LDADD = ../src/libcdipio.la $(UUID_C_LIB)
@USE_MPI_FALSE@pio_write_deco2d_LDADD = $(LDADD) $(UUID_C_LIB)
@USE_MPI_TRUE@pio_write_deco2d_LDADD = ../src/libcdipio.la $(UUID_C_LIB)
@USE_MPI_TRUE@test_resource_copy_mpi_LDADD = ../src/libcdipio.la
@USE_MPI_FALSE@test_resource_copy_mpi_LDADD = $(LDADD) $(UUID_C_LIB)
@USE_MPI_TRUE@test_resource_copy_mpi_LDADD = ../src/libcdipio.la $(UUID_C_LIB)
@USE_MPI_TRUE@test_resource_copy_mpi_CFLAGS = $(AM_CFLAGS) $(CFLAGS) -DMPI_MARSHALLING
LDADD = ../src/libcdi.la -lm
AM_CPPFLAGS = -I$(top_srcdir)/src
......@@ -638,6 +645,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cksum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy_mpi-create_uuid.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy_mpi-test_resource_copy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/var_cksum.Po@am__quote@
......@@ -690,6 +698,20 @@ test_resource_copy_mpi-test_resource_copy.obj: test_resource_copy.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -c -o test_resource_copy_mpi-test_resource_copy.obj `if test -f 'test_resource_copy.c'; then $(CYGPATH_W) 'test_resource_copy.c'; else $(CYGPATH_W) '$(srcdir)/test_resource_copy.c'; fi`
test_resource_copy_mpi-create_uuid.o: create_uuid.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -MT test_resource_copy_mpi-create_uuid.o -MD -MP -MF $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo -c -o test_resource_copy_mpi-create_uuid.o `test -f 'create_uuid.c' || echo '$(srcdir)/'`create_uuid.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo $(DEPDIR)/test_resource_copy_mpi-create_uuid.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='create_uuid.c' object='test_resource_copy_mpi-create_uuid.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -c -o test_resource_copy_mpi-create_uuid.o `test -f 'create_uuid.c' || echo '$(srcdir)/'`create_uuid.c
test_resource_copy_mpi-create_uuid.obj: create_uuid.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -MT test_resource_copy_mpi-create_uuid.obj -MD -MP -MF $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo -c -o test_resource_copy_mpi-create_uuid.obj `if test -f 'create_uuid.c'; then $(CYGPATH_W) 'create_uuid.c'; else $(CYGPATH_W) '$(srcdir)/create_uuid.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_resource_copy_mpi-create_uuid.Tpo $(DEPDIR)/test_resource_copy_mpi-create_uuid.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='create_uuid.c' object='test_resource_copy_mpi-create_uuid.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_resource_copy_mpi_CFLAGS) $(CFLAGS) -c -o test_resource_copy_mpi-create_uuid.obj `if test -f 'create_uuid.c'; then $(CYGPATH_W) 'create_uuid.c'; else $(CYGPATH_W) '$(srcdir)/create_uuid.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
......
......@@ -6,6 +6,7 @@
#include <string.h>
#include "cdi.h"
#include "create_uuid.h"
#include "dmemory.h"
#include "error.h"
#include "resource_handle.h"
......@@ -86,6 +87,11 @@ int defineGrid ()
mask_vec[i] = i;
gridDefRowlon ( gridID, nlon*nlat, mp );
gridDefComplexPacking ( gridID, 1 );
{
unsigned char uuid[CDI_UUID_SIZE];
create_uuid(uuid);
gridDefUUID(gridID, uuid);
}
return gridID;
}
......
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