Skip to content

Commit

Permalink
Merge pull request #618 from E3SM-Project/jayeshkrishna/add_adiosc_io…
Browse files Browse the repository at this point in the history
…type

Adding a new I/O type, PIO_IOTYPE_ADIOSC, that can be used to
write (and read) data in ADIOS BP file format with data compression

Also modifying the testing framework to test the new I/O type.
  • Loading branch information
jayeshkrishna authored Nov 8, 2024
2 parents 9d8c58a + 1dab253 commit 79a593f
Show file tree
Hide file tree
Showing 13 changed files with 190 additions and 112 deletions.
5 changes: 4 additions & 1 deletion src/clib/pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,11 @@ enum PIO_IOTYPE
/** ADIOS parallel */
PIO_IOTYPE_ADIOS = 5,

/** ADIOS parallel with compression */
PIO_IOTYPE_ADIOSC = 6,

/** HDF5 parallel */
PIO_IOTYPE_HDF5 = 6
PIO_IOTYPE_HDF5 = 7
};

/**
Expand Down
25 changes: 13 additions & 12 deletions src/clib/pio_darray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ int PIOc_write_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen, c
spio_ltimer_start(ios->io_fstats->wr_timer_name);
spio_ltimer_start(ios->io_fstats->tot_timer_name);

if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstart("PIO:PIOc_write_darray_adios");
GPTLstart("PIO:write_total_adios");
Expand All @@ -2043,7 +2043,7 @@ int PIOc_write_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen, c
spio_ltimer_stop(ios->io_fstats->tot_timer_name);
spio_ltimer_stop(file->io_fstats->wr_timer_name);
spio_ltimer_stop(file->io_fstats->tot_timer_name);
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_write_darray_adios");
GPTLstop("PIO:write_total_adios");
Expand All @@ -2061,7 +2061,7 @@ int PIOc_write_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen, c
spio_ltimer_stop(ios->io_fstats->tot_timer_name);
spio_ltimer_stop(file->io_fstats->wr_timer_name);
spio_ltimer_stop(file->io_fstats->tot_timer_name);
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_write_darray_adios");
GPTLstop("PIO:write_total_adios");
Expand All @@ -2082,7 +2082,7 @@ int PIOc_write_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen, c
spio_ltimer_stop(ios->io_fstats->tot_timer_name);
spio_ltimer_stop(file->io_fstats->wr_timer_name);
spio_ltimer_stop(file->io_fstats->tot_timer_name);
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_write_darray_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -2114,7 +2114,7 @@ int PIOc_write_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen, c
spio_ltimer_stop(ios->io_fstats->tot_timer_name);
spio_ltimer_stop(file->io_fstats->wr_timer_name);
spio_ltimer_stop(file->io_fstats->tot_timer_name);
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_write_darray_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -2191,7 +2191,7 @@ if (file->iotype != PIO_IOTYPE_HDF5)
{
GPTLstop("PIO:PIOc_write_darray");
GPTLstop("PIO:write_total");
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_write_darray_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -2219,7 +2219,7 @@ if (file->iotype != PIO_IOTYPE_HDF5)
LOG((3, "wmb->ioid = %d wmb->recordvar = %d", wmb->ioid, wmb->recordvar));

#ifdef _ADIOS2
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
ierr = PIO_NOERR;
ierr = PIOc_write_darray_adios(file, varid, ioid, iodesc, arraylen, array, fillvalue);
Expand Down Expand Up @@ -3578,7 +3578,7 @@ int PIOc_read_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen,
"unknown rearranger", __FILE__, __LINE__);

/* Get var description. */
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
#ifdef _ADIOS2
vdesc_adios2 = &(file->adios_vars[varid]);
Expand All @@ -3597,7 +3597,7 @@ int PIOc_read_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen,
spio_ltimer_stop(file->io_fstats->tot_timer_name);

/* Find out PIO data type of var. */
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
#ifdef _ADIOS2
assert(vdesc_adios2->nc_type != PIO_NAT);
Expand All @@ -3620,7 +3620,7 @@ int PIOc_read_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen,
}

/* Find out length of type. */
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
#ifdef _ADIOS2
if (vdesc_adios2->adios_type_size == 0)
Expand Down Expand Up @@ -3649,7 +3649,7 @@ int PIOc_read_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen,
spio_ltimer_start(file->io_fstats->tot_timer_name);
}

if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
#ifdef _ADIOS2
ios->io_fstats->rb += vdesc_adios2->adios_type_size * iodesc->llen;
Expand Down Expand Up @@ -3698,7 +3698,7 @@ int PIOc_read_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen,
else
rlen = iodesc->llen;

if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
rlen = 0;

if(!ios->async || !ios->ioproc)
Expand Down Expand Up @@ -3822,6 +3822,7 @@ int PIOc_read_darray_impl(int ncid, int varid, int ioid, PIO_Offset arraylen,
break;
#ifdef _ADIOS2
case PIO_IOTYPE_ADIOS:
case PIO_IOTYPE_ADIOSC:
GPTLstart("PIO:PIOc_read_darray_adios");
if ((ierr = PIOc_read_darray_adios(file, fndims, iodesc, varid, array)))
{
Expand Down
38 changes: 19 additions & 19 deletions src/clib/pio_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int PIOc_createfile_impl(int iosysid, int *ncidp, const int *iotype, const char

GPTLstart("PIO:PIOc_createfile");
GPTLstart("PIO:write_total");
if (*iotype == PIO_IOTYPE_ADIOS)
if ((*iotype == PIO_IOTYPE_ADIOS) || (*iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstart("PIO:PIOc_createfile_adios");
GPTLstart("PIO:write_total_adios");
Expand All @@ -146,7 +146,7 @@ int PIOc_createfile_impl(int iosysid, int *ncidp, const int *iotype, const char
{
GPTLstop("PIO:PIOc_createfile");
GPTLstop("PIO:write_total");
if (*iotype == PIO_IOTYPE_ADIOS)
if ((*iotype == PIO_IOTYPE_ADIOS) || (*iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_createfile_adios");
GPTLstop("PIO:write_total_adios");
Expand All @@ -165,7 +165,7 @@ int PIOc_createfile_impl(int iosysid, int *ncidp, const int *iotype, const char
GPTLstop("PIO:write_total");
spio_ltimer_stop(ios->io_fstats->wr_timer_name);
spio_ltimer_stop(ios->io_fstats->tot_timer_name);
if (*iotype == PIO_IOTYPE_ADIOS)
if ((*iotype == PIO_IOTYPE_ADIOS) || (*iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_createfile_adios");
GPTLstop("PIO:write_total_adios");
Expand All @@ -188,7 +188,7 @@ int PIOc_createfile_impl(int iosysid, int *ncidp, const int *iotype, const char
{
GPTLstop("PIO:PIOc_createfile");
GPTLstop("PIO:write_total");
if (*iotype == PIO_IOTYPE_ADIOS)
if ((*iotype == PIO_IOTYPE_ADIOS) || (*iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_createfile_adios");
GPTLstop("PIO:write_total_adios");
Expand All @@ -204,7 +204,7 @@ int PIOc_createfile_impl(int iosysid, int *ncidp, const int *iotype, const char
GPTLstop("PIO:write_total");
spio_ltimer_stop(ios->io_fstats->wr_timer_name);
spio_ltimer_stop(ios->io_fstats->tot_timer_name);
if (*iotype == PIO_IOTYPE_ADIOS)
if ((*iotype == PIO_IOTYPE_ADIOS) || (*iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_createfile_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -290,7 +290,7 @@ static int sync_file(int ncid)
spio_ltimer_start(file->io_fstats->tot_timer_name);

#ifdef _ADIOS2
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
if (file->mode & PIO_WRITE)
{
Expand Down Expand Up @@ -468,7 +468,7 @@ int PIOc_closefile_impl(int ncid)
ios = file->iosystem;
assert(ios);

if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstart("PIO:PIOc_closefile_adios");

Expand Down Expand Up @@ -499,7 +499,7 @@ int PIOc_closefile_impl(int ncid)
sync_file(ncid);
}

if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
#ifndef _ADIOS_BP2NC_TEST
if (file->mode & PIO_WRITE)
Expand Down Expand Up @@ -533,7 +533,7 @@ int PIOc_closefile_impl(int ncid)
PIO_SEND_ASYNC_MSG(ios, msg, &ierr, ncid);
if(ierr != PIO_NOERR)
{
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_closefile_adios");

Expand Down Expand Up @@ -572,7 +572,7 @@ int PIOc_closefile_impl(int ncid)

/* ADIOS: assume all procs are also IO tasks */
#ifdef _ADIOS2
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
adios2_error adiosErr = adios2_error_none;

Expand All @@ -585,7 +585,7 @@ int PIOc_closefile_impl(int ncid)
ierr = begin_adios2_step(file, NULL);
if (ierr != PIO_NOERR)
{
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_closefile_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -619,7 +619,7 @@ int PIOc_closefile_impl(int ncid)
attributeH = adios2_define_attribute(file->ioH, "/__pio__/fillmode", adios2_type_int32_t, &file->fillmode);
if (attributeH == NULL)
{
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_closefile_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -680,7 +680,7 @@ int PIOc_closefile_impl(int ncid)
GPTLstop("end_adios2_step_PIOc_closefile");
if (ierr != PIO_NOERR)
{
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_closefile_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -709,7 +709,7 @@ int PIOc_closefile_impl(int ncid)
adiosErr = adios2_close(file->engineH);
if (adiosErr != adios2_error_none)
{
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_closefile_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -911,7 +911,7 @@ int PIOc_closefile_impl(int ncid)
LOG((1, "DONE CONVERTING: %s", file->filename));
if (ierr != PIO_NOERR)
{
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_closefile_adios");
GPTLstop("PIO:write_total_adios");
Expand Down Expand Up @@ -941,7 +941,7 @@ int PIOc_closefile_impl(int ncid)
file->filename = NULL;
}

if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
{
GPTLstop("PIO:PIOc_closefile_adios");

Expand Down Expand Up @@ -983,7 +983,7 @@ int PIOc_closefile_impl(int ncid)
}
#endif

assert(file->iotype != PIO_IOTYPE_ADIOS);
assert((file->iotype != PIO_IOTYPE_ADIOS) && (file->iotype != PIO_IOTYPE_ADIOSC));

/* If this is an IO task, then call the netCDF function. */
if (ios->ioproc)
Expand Down Expand Up @@ -1243,7 +1243,7 @@ int PIOc_sync_impl(int ncid)
if (file->mode & PIO_WRITE)
{
GPTLstart("PIO:write_total");
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
GPTLstart("PIO:write_total_adios");
}

Expand All @@ -1252,7 +1252,7 @@ int PIOc_sync_impl(int ncid)
if (file->mode & PIO_WRITE)
{
GPTLstop("PIO:write_total");
if (file->iotype == PIO_IOTYPE_ADIOS)
if ((file->iotype == PIO_IOTYPE_ADIOS) || (file->iotype == PIO_IOTYPE_ADIOSC))
GPTLstop("PIO:write_total_adios");
}

Expand Down
Loading

0 comments on commit 79a593f

Please sign in to comment.