Skip to content

Commit

Permalink
Merge branch 'jayeshkrishna/mpas-framework/add_adios' (PR #5490)
Browse files Browse the repository at this point in the history
Adding support for ADIOS in MPAS

Adding support for the ADIOS I/O format

[BFB]
  • Loading branch information
jonbob committed Mar 16, 2023
2 parents 412dad6 + fd4f120 commit 8018a7a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
6 changes: 5 additions & 1 deletion components/mpas-framework/src/framework/mpas_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ type (MPAS_IO_Handle_type) function MPAS_io_open(filename, mode, ioformat, ioCon
if (ioformat /= MPAS_IO_NETCDF .and. &
ioformat /= MPAS_IO_NETCDF4 .and. &
ioformat /= MPAS_IO_PNETCDF .and. &
ioformat /= MPAS_IO_PNETCDF5) then
ioformat /= MPAS_IO_PNETCDF5 .and. &
ioformat /= MPAS_IO_ADIOS) then
if (present(ierr)) ierr = MPAS_IO_ERR_INVALID_FORMAT
return
end if
Expand All @@ -275,6 +276,9 @@ type (MPAS_IO_Handle_type) function MPAS_io_open(filename, mode, ioformat, ioCon
else if (ioformat == MPAS_IO_PNETCDF5) then
pio_iotype = PIO_iotype_pnetcdf
pio_mode = PIO_64BIT_DATA
else if (ioformat == MPAS_IO_ADIOS) then
pio_iotype = PIO_iotype_adios
pio_mode = 0
else if (ioformat == MPAS_IO_NETCDF) then
pio_iotype = PIO_iotype_netcdf
pio_mode = PIO_64BIT_OFFSET
Expand Down
17 changes: 9 additions & 8 deletions components/mpas-framework/src/framework/mpas_io_types.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
integer, parameter :: MPAS_IO_NETCDF = 3, &
MPAS_IO_PNETCDF = 4, &
MPAS_IO_NETCDF4 = 5, &
MPAS_IO_PNETCDF5 = 6
MPAS_IO_PNETCDF5 = 6, &
MPAS_IO_ADIOS = 7

! Field and attribute types
integer, parameter :: MPAS_IO_REAL = 7, &
MPAS_IO_DOUBLE = 8, &
MPAS_IO_INT = 9, &
MPAS_IO_LOGICAL = 10, &
MPAS_IO_CHAR = 11
integer, parameter :: MPAS_IO_REAL = 8, &
MPAS_IO_DOUBLE = 9, &
MPAS_IO_INT = 10, &
MPAS_IO_LOGICAL = 11, &
MPAS_IO_CHAR = 12

! Field precision
integer, parameter :: MPAS_IO_SINGLE_PRECISION = 12, &
MPAS_IO_DOUBLE_PRECISION = 13, &
integer, parameter :: MPAS_IO_SINGLE_PRECISION = 13, &
MPAS_IO_DOUBLE_PRECISION = 14, &
#ifdef SINGLE_PRECISION
MPAS_IO_NATIVE_PRECISION = MPAS_IO_SINGLE_PRECISION
#else
Expand Down
6 changes: 4 additions & 2 deletions components/mpas-framework/src/framework/mpas_stream_manager.F
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ end subroutine MPAS_stream_mgr_finalize!}}}
!> existing files (MPAS_STREAM_CLOBBER_NEVER).
!> The optional argument ioType specifies the I/O type to use for the
!> stream; possible values are defined by constants in the mpas_io module and
!> include: MPAS_IO_NETCDF, MPAS_IO_NETCDF4, MPAS_IO_PNETCDF, and
!> include: MPAS_IO_NETCDF, MPAS_IO_NETCDF4, MPAS_IO_PNETCDF, MPAS_IO_ADIOS and
!> MPAS_IO_PNETCDF5. If not specified, the io_type will default to
!> MPAS_IO_PNETCDF.
!> NOTE: This routine does not support regular expressions for StreamID
Expand Down Expand Up @@ -5893,7 +5893,7 @@ subroutine stream_mgr_create_stream_c(manager_c, streamID_c, direction_c, filena
use mpas_derived_types, only : MPAS_LOG_ERR
use mpas_log
use mpas_io, only : MPAS_IO_SINGLE_PRECISION, MPAS_IO_DOUBLE_PRECISION, MPAS_IO_NATIVE_PRECISION, &
MPAS_IO_NETCDF, MPAS_IO_PNETCDF, MPAS_IO_NETCDF4, MPAS_IO_PNETCDF5
MPAS_IO_NETCDF, MPAS_IO_PNETCDF, MPAS_IO_NETCDF4, MPAS_IO_PNETCDF5, MPAS_IO_ADIOS
implicit none
Expand Down Expand Up @@ -5960,6 +5960,8 @@ subroutine stream_mgr_create_stream_c(manager_c, streamID_c, direction_c, filena
iotype = MPAS_IO_NETCDF
else if (iotype_c == 3) then
iotype = MPAS_IO_NETCDF4
else if (iotype_c == 4) then
iotype = MPAS_IO_ADIOS
else
iotype = MPAS_IO_PNETCDF
end if
Expand Down
15 changes: 15 additions & 0 deletions components/mpas-framework/src/framework/xml_stream_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,11 @@ void xml_stream_parser(char *fname, void *manager, int *mpi_comm, int *status)
snprintf(msgbuf, MSGSIZE, " %-20s%s", "I/O type:", "Serial NetCDF");
mpas_log_write_c(msgbuf, "MPAS_LOG_OUT");
}
else if (strstr(iotype, "adios") != NULL) {
i_iotype = 4;
snprintf(msgbuf, MSGSIZE, " %-20s%s", "I/O type:", "ADIOS");
mpas_log_write_c(msgbuf, "MPAS_LOG_OUT");
}
else {
i_iotype = 0;
snprintf(msgbuf, MSGSIZE, " *** unrecognized io_type specification; defaulting to Parallel-NetCDF");
Expand Down Expand Up @@ -1611,6 +1616,11 @@ void xml_stream_parser(char *fname, void *manager, int *mpi_comm, int *status)
snprintf(msgbuf, MSGSIZE, " %-20s%s", "I/O type:", "Serial NetCDF");
mpas_log_write_c(msgbuf, "MPAS_LOG_OUT");
}
else if (strstr(iotype, "adios") != NULL) {
i_iotype = 4;
snprintf(msgbuf, MSGSIZE, " %-20s%s", "I/O type:", "ADIOS");
mpas_log_write_c(msgbuf, "MPAS_LOG_OUT");
}
else {
i_iotype = 0;
snprintf(msgbuf, MSGSIZE, " *** unrecognized io_type specification; defaulting to Parallel-NetCDF");
Expand Down Expand Up @@ -2007,6 +2017,11 @@ void xml_stream_get_attributes(char *fname, char *streamname, int *mpi_comm, cha
snprintf(msgbuf, MSGSIZE, "Using io_type Serial NetCDF for mesh stream");
mpas_log_write_c(msgbuf, "MPAS_LOG_OUT");
}
else if (strstr(xml_iotype, "adios") != NULL) {
sprintf(io_type, "%s", xml_iotype);
snprintf(msgbuf, MSGSIZE, "Using io_type ADIOS for mesh stream");
mpas_log_write_c(msgbuf, "MPAS_LOG_OUT");
}
else {
sprintf(io_type, "pnetcdf");
snprintf(msgbuf, MSGSIZE, "*** unrecognized io_type specification for mesh stream; defaulting to Parallel-NetCDF");
Expand Down

0 comments on commit 8018a7a

Please sign in to comment.