Skip to content

Commit

Permalink
IOSS: Catalyst API 2 (#463)
Browse files Browse the repository at this point in the history
* IOSS: Catalyst API 2

Added support to database for using my_processor and
processor_count IOSS properties when operating in
serial parallel mode and reading Conduit files.

* IOSS: Catalyst API 2

Changed Conduit serial parallel test to use
files from the one MPI rank can.ex2 test.

---------

Co-authored-by: Greg Sjaardema <[email protected]>
  • Loading branch information
tjotaha and gsjaardema authored Jun 20, 2024
1 parent 18cd027 commit 8bcfc2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <cstdlib>
#include <fmt/ostream.h>
#include <map>
#include <cstdlib>

#include <catalyst.hpp>
#include <catalyst/Iocatalyst_DatabaseIO.h>
Expand Down Expand Up @@ -1249,13 +1248,20 @@ namespace Iocatalyst {
if (pm.exists(detail::CATREADTIMESTEP)) {
timestep = pm.get(detail::CATREADTIMESTEP).get_int();
}
else if(const char* ts = std::getenv(detail::CATREADTIMESTEP.c_str())) {
else if (const char *ts = std::getenv(detail::CATREADTIMESTEP.c_str())) {
timestep = std::stoi(std::string(ts));
}

int proc_count = util().parallel_size();
int my_proc = util().parallel_rank();
if (properties.exists("processor_count") && properties.exists("my_processor")) {
proc_count = properties.get("processor_count").get_int();
my_proc = properties.get("my_processor").get_int();
}

std::ostringstream path;
path << get_catalyst_dump_dir() << detail::EXECUTE_INVC << timestep
<< detail::PARAMS_CONDUIT_BIN << util().parallel_size() << detail::DOT
<< util().parallel_rank();
<< detail::PARAMS_CONDUIT_BIN << proc_count << detail::DOT << my_proc;
auto &root = this->Impl->root();
auto &dbase = this->Impl->databaseNode();
conduit_node_load(conduit_cpp::c_node(&root), path.str().c_str(), "conduit_bin");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,14 @@ TEST_F(Iocatalyst_DatabaseIOTest, SetReaderTimeStepWithIOSSEnvVar)
auto maxt = reg.get_max_time();
EXPECT_EQ(maxt.first, 1);
EXPECT_DOUBLE_EQ(maxt.second, 0.0024000538978725672);
}

TEST_F(Iocatalyst_DatabaseIOTest, SetRankNumRanksSerialParallel)
{
Ioss::PropertyManager iossProp;
iossProp.add(Ioss::Property("my_processor", 0));
iossProp.add(Ioss::Property("processor_count", 1));

auto db = getCatalystDatabaseFromConduitFiles("Iocatalyst_can_ex2_MPI_1", iossProp);
ASSERT_TRUE(db != nullptr);
}

0 comments on commit 8bcfc2b

Please sign in to comment.