Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom MPI communicator setup #270

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/linalg/BasisReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ BasisReader::BasisReader(
d_database = new CSVDatabase();
}

std::cout << "Opening file: " << full_file_name << std::endl;
d_database->open(full_file_name, "r");

int num_time_intervals;
Expand Down
36 changes: 15 additions & 21 deletions lib/linalg/BasisWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,19 @@ BasisWriter::BasisWriter(
char tmp2[100];
sprintf(tmp2, "_snapshot.%06d", rank);
snap_file_name = base_file_name + tmp2;

// create and open snapshot/basis database
// TODO(kevin): can it be CSV at all? we might want to remove if statement here.
if (db_format_ == Database::HDF5) {
d_snap_database = new HDFDatabase();
d_database = new HDFDatabase();
}
}

BasisWriter::~BasisWriter()
{
if (d_database) {
d_database->putInteger("num_time_intervals", d_num_intervals_written);
d_database->close();
delete d_database;
}
if (d_snap_database) {
d_snap_database->putInteger("num_time_intervals", d_num_intervals_written);
d_snap_database->close();
delete d_snap_database;
}
if (d_database) delete d_database;
if (d_snap_database) delete d_snap_database;
}

void
Expand All @@ -81,12 +80,7 @@ BasisWriter::writeBasis(const std::string& kind)
sprintf(tmp, "time_%06d", d_num_intervals_written);

if (kind == "basis") {

// create and open basis database
if (db_format_ == Database::HDF5) {
d_database = new HDFDatabase();
}
std::cout << "Creating file: " << full_file_name << std::endl;
bool file_exists = fileExists(full_file_name);
d_database->create(full_file_name);

d_database->putDouble(tmp, time_interval_start_time);
Expand Down Expand Up @@ -122,14 +116,11 @@ BasisWriter::writeBasis(const std::string& kind)

++d_num_intervals_written;

d_database->putInteger("num_time_intervals", d_num_intervals_written);
d_database->close();
}

if (kind == "snapshot") {
// create and open snapshot database
if (db_format_ == Database::HDF5) {
d_snap_database = new HDFDatabase();
}
std::cout << "Creating file: " << snap_file_name << std::endl;
d_snap_database->create(snap_file_name);

d_snap_database->putDouble(tmp, time_interval_start_time);
Expand All @@ -143,6 +134,9 @@ BasisWriter::writeBasis(const std::string& kind)
d_snap_database->putInteger(tmp, num_cols);
sprintf(tmp, "snapshot_matrix_%06d", d_num_intervals_written);
d_snap_database->putDoubleArray(tmp, &snapshots->item(0,0), num_rows*num_cols);

d_snap_database->putInteger("num_time_intervals", d_num_intervals_written);
d_snap_database->close();
}

}
Expand Down
Loading