Skip to content

Commit

Permalink
add rest of collective calls
Browse files Browse the repository at this point in the history
add the strided versions, and float and integer put_all calls
also, add all get_all calls, for doble, float, int, strided too
  • Loading branch information
iulian787 committed Oct 28, 2024
1 parent 77b331e commit 86d0d9f
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 1 deletion.
57 changes: 56 additions & 1 deletion Source/IO/NCInterface.H
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,51 @@ struct NCVar
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;
//! Write out a slice of data with with strides , collective
void
put_all(const double*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;
//! Write out a slice of data
void
put(const float*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;

//! Write out a slice of data, collective
void
put_all(const float*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;
//! Write out a slice of data with with strides (see hyperslab definition in
//! NetCDF)
void
put(const float*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;
//! Write out a slice of data with with strides, collective
void
put_all(const float*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;


void put(const int*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;
void put_all(const int*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;

void
put(const int*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;
void
put_all(const int*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;


void put(const char**, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;
void
Expand All @@ -126,16 +151,29 @@ struct NCVar
void
get(double*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;

//! Read a chunk of data from the file, collective
void
get_all(double*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;

//! Read a chunk of data with strides
void
get(double*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;

//! Read a chunk of data with strides, collective
void
get_all(double*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;

//! Read a chunk of data from the file
void
get(float*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;
// collective
void get_all(float*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;

//! Read a chunk of data with strides
void
Expand All @@ -144,13 +182,30 @@ struct NCVar
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;

//! Read a chunk of data with strides, collective
void
get_all(float*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;

void
get(int*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;
void
get_all(int*, const std::vector<MPI_Offset>&, const std::vector<MPI_Offset>&) const;

void
get(int*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;
// collective
void
get_all(int*,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&,
const std::vector<MPI_Offset>&) const;


//! Read a chunk of data from the file
void
Expand Down
105 changes: 105 additions & 0 deletions Source/IO/NCInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& count,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& count,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& count,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand Down Expand Up @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& count,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& count,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& count) const
{
check_ncmpi_error(
ncmpi_get_vara_int(ncid, varid, start.data(), count.data(), dptr));
}

void NCVar::get(
int* dptr,
const std::vector<MPI_Offset>& start,
Expand All @@ -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<MPI_Offset>& start,
const std::vector<MPI_Offset>& count,
const std::vector<MPI_Offset>& 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<MPI_Offset>& start,
Expand Down

0 comments on commit 86d0d9f

Please sign in to comment.