From 86d0d9f47259dcf5340c5b63083e4f7f98442584 Mon Sep 17 00:00:00 2001 From: Iulian Grindeanu Date: Mon, 28 Oct 2024 00:20:05 -0500 Subject: [PATCH] add rest of collective calls add the strided versions, and float and integer put_all calls also, add all get_all calls, for doble, float, int, strided too --- Source/IO/NCInterface.H | 57 ++++++++++++++++++++- Source/IO/NCInterface.cpp | 105 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 1 deletion(-) diff --git a/Source/IO/NCInterface.H b/Source/IO/NCInterface.H index 4f56032..c8131ea 100644 --- a/Source/IO/NCInterface.H +++ b/Source/IO/NCInterface.H @@ -88,12 +88,22 @@ struct NCVar const std::vector&, const std::vector&, const std::vector&) const; + //! Write out a slice of data with with strides , collective + void + put_all(const double*, + const std::vector&, + const std::vector&, + const std::vector&) const; //! Write out a slice of data void put(const float*, const std::vector&, const std::vector&) const; - + //! Write out a slice of data, collective + void + put_all(const float*, + const std::vector&, + const std::vector&) const; //! Write out a slice of data with with strides (see hyperslab definition in //! NetCDF) void @@ -101,13 +111,28 @@ struct NCVar const std::vector&, const std::vector&, const std::vector&) const; + //! Write out a slice of data with with strides, collective + void + put_all(const float*, + const std::vector&, + const std::vector&, + const std::vector&) const; + void put(const int*, const std::vector&, const std::vector&) const; + void put_all(const int*, const std::vector&, const std::vector&) const; + void put(const int*, const std::vector&, const std::vector&, const std::vector&) const; + void + put_all(const int*, + const std::vector&, + const std::vector&, + const std::vector&) const; + void put(const char**, const std::vector&, const std::vector&) const; void @@ -126,6 +151,10 @@ struct NCVar void get(double*, const std::vector&, const std::vector&) const; + //! Read a chunk of data from the file, collective + void + get_all(double*, const std::vector&, const std::vector&) const; + //! Read a chunk of data with strides void get(double*, @@ -133,9 +162,18 @@ struct NCVar const std::vector&, const std::vector&) const; + //! Read a chunk of data with strides, collective + void + get_all(double*, + const std::vector&, + const std::vector&, + const std::vector&) const; + //! Read a chunk of data from the file void get(float*, const std::vector&, const std::vector&) const; + // collective + void get_all(float*, const std::vector&, const std::vector&) const; //! Read a chunk of data with strides void @@ -144,13 +182,30 @@ struct NCVar const std::vector&, const std::vector&) const; + //! Read a chunk of data with strides, collective + void + get_all(float*, + const std::vector&, + const std::vector&, + const std::vector&) const; + void get(int*, const std::vector&, const std::vector&) const; + void + get_all(int*, const std::vector&, const std::vector&) const; + void get(int*, const std::vector&, const std::vector&, const std::vector&) const; + // collective + void + get_all(int*, + const std::vector&, + const std::vector&, + const std::vector&) const; + //! Read a chunk of data from the file void diff --git a/Source/IO/NCInterface.cpp b/Source/IO/NCInterface.cpp index 5ec8d8a..be8d8f5 100644 --- a/Source/IO/NCInterface.cpp +++ b/Source/IO/NCInterface.cpp @@ -108,6 +108,16 @@ void NCVar::put( ncid, varid, start.data(), count.data(), stride.data(), dptr)); } +void NCVar::put_all( + const double* dptr, + const std::vector& start, + const std::vector& count, + const std::vector& stride) const +{ + check_ncmpi_error(ncmpi_put_vars_double_all( + ncid, varid, start.data(), count.data(), stride.data(), dptr)); +} + void NCVar::put( const float* dptr, const std::vector& start, @@ -117,6 +127,15 @@ void NCVar::put( ncmpi_put_vara_float(ncid, varid, start.data(), count.data(), dptr)); } +void NCVar::put_all( + const float* dptr, + const std::vector& start, + const std::vector& count) const +{ + check_ncmpi_error( + ncmpi_put_vara_float_all(ncid, varid, start.data(), count.data(), dptr)); +} + void NCVar::put( const float* dptr, const std::vector& start, @@ -127,6 +146,16 @@ void NCVar::put( ncid, varid, start.data(), count.data(), stride.data(), dptr)); } +void NCVar::put_all( + const float* dptr, + const std::vector& start, + const std::vector& count, + const std::vector& stride) const +{ + check_ncmpi_error(ncmpi_put_vars_float_all( + ncid, varid, start.data(), count.data(), stride.data(), dptr)); +} + void NCVar::put( const int* dptr, const std::vector& start, @@ -136,6 +165,15 @@ void NCVar::put( ncmpi_put_vara_int(ncid, varid, start.data(), count.data(), dptr)); } +void NCVar::put_all( + const int* dptr, + const std::vector& start, + const std::vector& count) const +{ + check_ncmpi_error( + ncmpi_put_vara_int_all(ncid, varid, start.data(), count.data(), dptr)); +} + void NCVar::put( const int* dptr, const std::vector& start, @@ -146,6 +184,16 @@ void NCVar::put( ncid, varid, start.data(), count.data(), stride.data(), dptr)); } +void NCVar::put_all( + const int* dptr, + const std::vector& start, + const std::vector& count, + const std::vector& stride) const +{ + check_ncmpi_error(ncmpi_put_vars_int_all( + ncid, varid, start.data(), count.data(), stride.data(), dptr)); +} + void NCVar::put( const char** dptr, const std::vector& start, @@ -189,6 +237,15 @@ void NCVar::get( ncmpi_get_vara_double(ncid, varid, start.data(), count.data(), dptr)); } +void NCVar::get_all( + double* dptr, + const std::vector& start, + const std::vector& count) const +{ + check_ncmpi_error( + ncmpi_get_vara_double_all(ncid, varid, start.data(), count.data(), dptr)); +} + void NCVar::get( double* dptr, const std::vector& start, @@ -199,6 +256,16 @@ void NCVar::get( ncid, varid, start.data(), count.data(), stride.data(), dptr)); } +void NCVar::get_all( + double* dptr, + const std::vector& start, + const std::vector& count, + const std::vector& stride) const +{ + check_ncmpi_error(ncmpi_get_vars_double_all( + ncid, varid, start.data(), count.data(), stride.data(), dptr)); +} + void NCVar::get( float* dptr, const std::vector& start, @@ -208,6 +275,15 @@ void NCVar::get( ncmpi_get_vara_float(ncid, varid, start.data(), count.data(), dptr)); } +void NCVar::get_all( + float* dptr, + const std::vector& start, + const std::vector& count) const +{ + check_ncmpi_error( + ncmpi_get_vara_float_all(ncid, varid, start.data(), count.data(), dptr)); +} + void NCVar::get( float* dptr, const std::vector& start, @@ -218,6 +294,16 @@ void NCVar::get( ncid, varid, start.data(), count.data(), stride.data(), dptr)); } +void NCVar::get_all( + float* dptr, + const std::vector& start, + const std::vector& count, + const std::vector& stride) const +{ + check_ncmpi_error(ncmpi_get_vars_float_all( + ncid, varid, start.data(), count.data(), stride.data(), dptr)); +} + void NCVar::get( int* dptr, const std::vector& start, @@ -227,6 +313,15 @@ void NCVar::get( ncmpi_get_vara_int(ncid, varid, start.data(), count.data(), dptr)); } +void NCVar::get_all( + int* dptr, + const std::vector& start, + const std::vector& count) const +{ + check_ncmpi_error( + ncmpi_get_vara_int(ncid, varid, start.data(), count.data(), dptr)); +} + void NCVar::get( int* dptr, const std::vector& start, @@ -237,6 +332,16 @@ void NCVar::get( ncid, varid, start.data(), count.data(), stride.data(), dptr)); } +void NCVar::get_all( + int* dptr, + const std::vector& start, + const std::vector& count, + const std::vector& stride) const +{ + check_ncmpi_error(ncmpi_get_vars_int_all( + ncid, varid, start.data(), count.data(), stride.data(), dptr)); +} + void NCVar::get( char* dptr, const std::vector& start,