Skip to content

Commit

Permalink
reflecting comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Mar 18, 2024
1 parent 0d883f1 commit 09b8271
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 290 deletions.
10 changes: 2 additions & 8 deletions lib/linalg/BasisWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ BasisWriter::BasisWriter(
rank = 0;
}

// char tmp[100];
// sprintf(tmp, ".%06d", rank);
// full_file_name = base_file_name + tmp;
full_file_name = base_file_name;

// char tmp2[100];
// sprintf(tmp2, "_snapshot.%06d", rank);
snap_file_name = base_file_name + "_snapshot";

// create and open snapshot/basis database
Expand Down Expand Up @@ -87,7 +81,7 @@ BasisWriter::writeBasis(const std::string& kind)
d_database->create(full_file_name, MPI_COMM_WORLD);

const Matrix* basis = d_basis_generator->getSpatialBasis();
/* singular is always distributed */
/* spatial basis is always distributed */
CAROM_VERIFY(basis->distributed());
int num_rows = basis->numRows();
int nrows_infile = num_rows;
Expand Down Expand Up @@ -116,7 +110,7 @@ BasisWriter::writeBasis(const std::string& kind)
}

const Vector* sv = d_basis_generator->getSingularValues();
/* singular is always not distributed */
/* singular values are always not distributed */
CAROM_VERIFY(!sv->distributed());
int sv_dim = sv->dim();
sprintf(tmp, "singular_value_size");
Expand Down
124 changes: 0 additions & 124 deletions lib/utils/Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,130 +315,6 @@ class Database
HDF5_MPIO
};

// /**
// * @brief Creates a new database file with the supplied name, with parallel I/O support.
// * Supported only for HDF5 format.
// * For HDFDatabase, the function is equivalent to create,
// * only extending the file name with 6 digits indicating processor rank.
// * For HDFDatabaseMPIO, the file is created with MPI I/O file access property.
// *
// * @param[in] file_name Base Name of CSV database file to create.
// * @param[in] comm MPI communicator to get the rank.
// *
// * @return True if file create was successful.
// */
// virtual
// bool
// create_parallel(
// const std::string& file_name,
// const MPI_Comm comm)
// {
// CAROM_ERROR("Abstract method Database::create_parallel!\n");
// return false;
// }

// /**
// * @brief Opens an existing database file with the supplied name, with parallel I/O support.
// * Supported only for HDF5 format.
// * For HDFDatabase, the function is equivalent to open,
// * only extending the file name with 6 digits indicating processor rank.
// * For HDFDatabaseMPIO, the file is opened with MPI I/O file access property.
// *
// * @param[in] file_name Name of existing CSV database file to open.
// * @param[in] type Read/write type ("r"/"wr")
// * @param[in] comm MPI communicator to get the rank.
// *
// * @return True if file open was successful.
// */
// virtual
// bool
// open_parallel(
// const std::string& file_name,
// const std::string& type,
// const MPI_Comm comm)
// {
// CAROM_ERROR("Abstract method Database::open_parallel!\n");
// return false;
// }

// /**
// * @brief Writes a distributed array of doubles associated with the supplied key to
// * the currently open database file.
// * Supported only for HDF5 format.
// * For HDFDatabase, the function is equivalent to putDoubleArray,
// * writing the local array per each process.
// * For HDFDatabaseMPIO, the global array is written into a single file via MPI I/O.
// *
// * @param[in] key The key associated with the array of values to be
// * written.
// * @param[in] data The array of double values to be written.
// * @param[in] nelements The number of doubles in the array.
// */
// virtual
// void
// putDoubleArray_parallel(
// const std::string& key,
// const double* const data,
// int nelements)
// {
// CAROM_ERROR("Abstract method Database::putDoubleArray_parallel!\n");
// }

// /**
// * @brief Reads a distributed array of doubles associated with the supplied key
// * from the currently open database file.
// * Supported only for HDF5 format.
// * For HDFDatabase, the function is equivalent to getDoubleArray,
// * reading the local array from a local file per each process.
// * For HDFDatabaseMPIO, the local array is read from a single file via MPI I/O.
// *
// * @param[in] key The key associated with the array of values to be
// * read.
// * @param[out] data The allocated array of double values to be read.
// * @param[in] nelements The number of doubles in the array.
// */
// virtual
// void
// getDoubleArray_parallel(
// const std::string& key,
// double* data,
// int nelements)
// {
// CAROM_ERROR("Abstract method Database::getDoubleArray_parallel!\n");
// }

// /**
// * @brief Reads a distributed array of doubles associated with the supplied key
// * from the currently open database file.
// * Supported only for HDF5 format.
// * For HDFDatabase, the function is equivalent to getDoubleArray,
// * reading the local array from a local file per each process.
// * For HDFDatabaseMPIO, the local array is read from a single file via MPI I/O.
// *
// * @param[in] key The key associated with the array of values to be
// * read.
// * @param[out] data The allocated array of double values to be read.
// * @param[in] nelements The number of doubles in the array.
// * @param[in] offset The initial offset in the array.
// * Typically, this is a column index of the matrix data.
// * @param[in] block_size The block size to read from the HDF5 dataset.
// * Typically, this is a number of columns of the matrix data.
// * @param[in] stride The stride to read from the HDF5 dataset.
// * Typically, this is the total number of columns of the matrix data.
// */
// virtual
// void
// getDoubleArray_parallel(
// const std::string& key,
// double* data,
// int nelements,
// int offset,
// int block_size,
// int stride)
// {
// CAROM_ERROR("Abstract method Database::getDoubleArray_parallel!\n");
// }

private:
/**
* @brief Unimplemented copy constructor.
Expand Down
122 changes: 0 additions & 122 deletions lib/utils/HDFDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,128 +266,6 @@ class HDFDatabase : public Database
int stride,
const bool distributed=false);

// /**
// * @brief Creates a new HDF5 database file with the supplied name,
// * extending it with 6 digits indicating the process rank.
// *
// * @param[in] file_name Name of HDF5 database file to create.
// * @param[in] comm MPI communicator to obtain the process rank.
// *
// * @return True if file create was successful.
// */
// virtual bool
// create_parallel(
// const std::string& file_name,
// const MPI_Comm comm) override
// {
// CAROM_VERIFY(!file_name.empty());
// MPI_Comm_rank(comm, &d_rank);

// std::string ext_filename(file_name);
// char tmp[10];
// sprintf(tmp, ".%06d", d_rank);
// ext_filename += tmp;

// return create(ext_filename);
// }

// /**
// * @brief Opens an existing HDF5 database file with the supplied name,
// * extending it with 6 digits indicating the process rank.
// *
// * @param[in] file_name Name of existing HDF5 database file to open.
// * @param[in] type Read/write type ("r"/"wr")
// * @param[in] comm MPI communicator to obtain the process rank.
// *
// * @return True if file open was successful.
// */
// virtual
// bool
// open_parallel(
// const std::string& file_name,
// const std::string& type,
// const MPI_Comm comm) override
// {
// CAROM_VERIFY(!file_name.empty());
// MPI_Comm_rank(comm, &d_rank);

// std::string ext_filename(file_name);
// char tmp[10];
// sprintf(tmp, ".%06d", d_rank);
// ext_filename += tmp;

// return open(ext_filename, type);
// }

// /**
// * @brief Writes a distributed array of doubles associated with the supplied key to
// * the currently open database file.
// * For HDFDatabase, the function is equivalent to putDoubleArray,
// * writing the local array per each process.
// *
// * @param[in] key The key associated with the array of values to be
// * written.
// * @param[in] data The array of double values to be written.
// * @param[in] nelements The number of doubles in the array.
// */
// virtual
// void
// putDoubleArray_parallel(
// const std::string& key,
// const double* const data,
// int nelements)
// {
// putDoubleArray(key, data, nelements);
// }

// /**
// * @brief Reads a distributed array of doubles associated with the supplied key
// * from the currently open database file.
// * For HDFDatabase, the function is equivalent to getDoubleArray,
// * reading the local array from a local file per each process.
// *
// * @param[in] key The key associated with the array of values to be
// * read.
// * @param[out] data The allocated array of double values to be read.
// * @param[in] nelements The number of doubles in the array.
// */
// virtual
// void
// getDoubleArray_parallel(
// const std::string& key,
// double* data,
// int nelements)
// {
// getDoubleArray(key, data, nelements);
// }

// /**
// * @brief Reads a distributed array of doubles associated with the supplied key
// * from the currently open database file.
// * For HDFDatabase, the function is equivalent to getDoubleArray,
// * reading the local array from a local file per each process.
// *
// * @param[in] key The key associated with the array of values to be
// * read.
// * @param[out] data The allocated array of double values to be read.
// * @param[in] nelements The number of doubles in the array.
// * @param[in] offset The initial offset in the array.
// * @param[in] block_size The block size to read from the HDF5 dataset.
// * @param[in] stride The stride to read from the HDF5 dataset.
// */
// virtual
// void
// getDoubleArray_parallel(
// const std::string& key,
// double* data,
// int nelements,
// int offset,
// int block_size,
// int stride)
// {
// getDoubleArray(key, data, nelements, offset, block_size, stride);
// }

protected:

/**
Expand Down
40 changes: 4 additions & 36 deletions lib/utils/HDFDatabaseMPIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class HDFDatabaseMPIO : public HDFDatabase
*
* @param[in] file_name Name of HDF5 database file to create.
* @param[in] comm MPI communicator for distributed data I/O.
* HDFDatabaseMPIO does not allow MPI_COMM_NULL.
* By default, HDFDatabaseMPIO uses MPI_COMM_WORLD
* and does not allow MPI_COMM_NULL.
*
* @return True if file create was successful.
*/
Expand All @@ -49,30 +50,15 @@ class HDFDatabaseMPIO : public HDFDatabase
const std::string& file_name,
const MPI_Comm comm=MPI_COMM_WORLD) override;

// /**
// * @brief Creates a new HDF5 database file for non-distributed data
// * with the supplied name.
// * For HDFDatabaseMPIO, the behavior is equilvalent to create_parallel.
// *
// * @param[in] file_name Name of HDF5 database file to create.
// *
// * @return True if file create was successful.
// */
// bool
// create(
// const std::string& file_name) override
// {
// return create_parallel(file_name, MPI_COMM_WORLD);
// }

/**
* @brief Opens an existing HDF5 database file for distributed data
* with the supplied name.
*
* @param[in] file_name Name of existing HDF5 database file to open.
* @param[in] type Read/write type ("r"/"wr")
* @param[in] comm MPI communicator for distributed data I/O.
* HDFDatabaseMPIO does not allow MPI_COMM_NULL.
* By default, HDFDatabaseMPIO uses MPI_COMM_WORLD
* and does not allow MPI_COMM_NULL.
*
* @return True if file open was successful.
*/
Expand All @@ -82,24 +68,6 @@ class HDFDatabaseMPIO : public HDFDatabase
const std::string& type,
const MPI_Comm comm=MPI_COMM_WORLD) override;

// /**
// * @brief Opens an existing HDF5 database file for non-distributed data
// * with the supplied name.
// * For HDFDatabaseMPIO, the behavior is equilvalent to open_parallel.
// *
// * @param[in] file_name Name of existing HDF5 database file to open.
// * @param[in] type Read/write type ("r"/"wr")
// *
// * @return True if file open was successful.
// */
// bool
// open(
// const std::string& file_name,
// const std::string& type) override
// {
// return open_parallel(file_name, type, MPI_COMM_WORLD);
// }

/**
* @brief Writes a local array of integers only for root rank,
* with associated supplied key to
Expand Down

0 comments on commit 09b8271

Please sign in to comment.