Skip to content

Commit

Permalink
IOSS: Get group writing working for parallel composed output
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Dec 4, 2024
1 parent 24a3cda commit 0af4a3a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ namespace Ioex {
m_exodusFilePtr = exoid;
success = true;
}
// QA and Info records are written at "root" level by first "group/database"
properties.add(Ioss::Property("OMIT_QA_RECORDS", "YES"));
properties.add(Ioss::Property("OMIT_INFO_RECORDS", "YES"));
return success;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,17 +408,15 @@ namespace Ioex {

void ParallelDatabaseIO::release_memory_nl()
{
free_file_pointer();
nodeMap.release_memory();
edgeMap.release_memory();
faceMap.release_memory();
elemMap.release_memory();
BaseDatabaseIO::release_memory_nl();

Ioss::Utils::clear(nodeOwningProcessor);
Ioss::Utils::clear(nodeGlobalImplicitMap);
Ioss::Utils::clear(elemGlobalImplicitMap);
nodeGlobalImplicitMapDefined = false;
elemGlobalImplicitMapDefined = false;
nodesetOwnedNodes.clear();
metaDataWritten = false;
try {
decomp.reset();
}
Expand Down
37 changes: 26 additions & 11 deletions packages/seacas/libraries/ioss/src/main/io_shell.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include "Ioss_DBUsage.h"
#include "Ioss_DataSize.h"
#include "Ioss_DatabaseIO.h"
#include "Ioss_DynamicTopology.h"
#include "Ioss_DynamicTopologyBroker.h"
#include "Ioss_DynamicTopologyFileControl.h"
#include "Ioss_DynamicTopologyObserver.h"
#include "Ioss_FileInfo.h"
#include "Ioss_GetLongOpt.h"
#include "Ioss_IOFactory.h"
Expand Down Expand Up @@ -100,6 +104,14 @@ namespace {
return success;
}

class Observer : public Ioss::DynamicTopologyObserver
{
public:
Observer() : Ioss::DynamicTopologyObserver(nullptr) {}
Ioss::FileControlOption get_control_option() const { return Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; }
bool needs_new_output_file() const {return false;}
};

#ifdef SEACAS_HAVE_MPI
void mpi_finalize()
{
Expand Down Expand Up @@ -410,6 +422,10 @@ namespace {
else {
cs_names = dbi->internal_change_set_describe();
}
auto observer = std::make_shared<Observer>();
output_region.register_mesh_modification_observer(observer);

int steps = 0;
for (const auto &cs_name : cs_names) {
success = region.load_internal_change_set_mesh(cs_name);
if (!success) {
Expand All @@ -418,17 +434,16 @@ namespace {
}
return success;
}
output_region.reset_region();
output_region.get_database()->release_memory();
success = dbo->create_internal_change_set(cs_name);
if (!success) {
if (rank == 0) {
fmt::print(stderr, "ERROR: Unable to create change set {} in output file.\n",
cs_name);
}
return success;
}
fmt::print(stderr, "Copying change set {}\n", cs_name);
if (steps > 0) {
observer->set_topology_modification(Ioss::TOPOLOGY_UNKNOWN);
output_region.start_new_output_database_entry(steps);
output_region.reset_region();
output_region.get_database()->release_memory();
}
steps++;
if (rank == 0) {
fmt::print(stderr, "Copying change set {}\n", cs_name);
}
if (!first) {
options.ignore_qa_info = true;
}
Expand Down

0 comments on commit 0af4a3a

Please sign in to comment.