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

Update Partition filter & docs #1412

Merged
merged 18 commits into from
Feb 5, 2025
Merged
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
5 changes: 5 additions & 0 deletions scripts/uberenv_configs/packages/conduit/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class Conduit(CMakePackage):
# is to bridge any spack dependencies that are still using the name master
version("master", branch="develop", submodules=True)
# note: 2021-05-05 latest tagged release is now preferred instead of develop
version("0.9.3", sha256="45d5a4eccd0fc978d153d29c440c53c483b8f29dfcf78ddcc9aa15c59b257177")
version("0.9.2", sha256="45d5a4eccd0fc978d153d29c440c53c483b8f29dfcf78ddcc9aa15c59b257177")
version("0.9.1", sha256="a3f1168738dcf72f8ebf83299850301aaf56e803f40618fc1230a755d0d05363")
version("0.9.0", sha256="844e012400ab820967eef6cec15e1aa9a68cb05119d0c1f292d3c01630111a58")
version("0.8.8", sha256="99811e9c464b6f841f52fcd47e982ae47cbb01cba334cff43eabe13eea58c0df")
version("0.8.7", sha256="f3bf44d860783f4e0d61517c5e280c88144af37414569f4cf86e2d29b3ba5293")
version("0.8.6", sha256="8ca5d37033143ed7181c7286dd25a3f6126ba0358889066f13a2b32f68fc647e")
Expand Down Expand Up @@ -128,6 +132,7 @@ class Conduit(CMakePackage):
extends("python", when="+python")
depends_on("py-numpy", when="+python", type=("build", "run"))
depends_on("py-mpi4py", when="+python+mpi", type=("build", "run"))
depends_on("py-pip", when="+python", type="build")

#######################
# I/O Packages
Expand Down
288 changes: 165 additions & 123 deletions src/docs/sphinx/Actions/Pipelines.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/libs/ascent/runtimes/ascent_data_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ std::shared_ptr<conduit::Node> DataObject::as_node()
{
conduit::Node *out_data = new conduit::Node();
bool zero_copy = true;
VTKHDataAdapter::VTKHCollectionToBlueprintDataSet(m_vtkh.get(), *out_data, true);
VTKHDataAdapter::VTKHCollectionToBlueprintDataSet(m_vtkh.get(), *out_data, zero_copy);

detail::add_metadata(*out_data);
std::shared_ptr<conduit::Node> bp(out_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <mpi.h>
#include <conduit_blueprint_mpi_mesh.hpp>
#include <conduit_blueprint_mpi.hpp>
#include <conduit_relay_mpi_io_blueprint.hpp>
#endif

#if defined(ASCENT_VTKM_ENABLED)
Expand Down Expand Up @@ -319,22 +320,53 @@ BlueprintPartition::verify_params(const conduit::Node &params,
info.reset();
bool res = true;

if(! params.has_child("target") ||
! params["target"].dtype().is_int() )
res &= check_numeric("target",params, info, false, false);

if(params.has_child("selections"))
{
res &= check_string("selections/type",params, info, true);
//domain_id can be int or "any"
res &= (check_string("selections/domain_id",params, info, false) || check_numeric("selections/domain_id", params, info, false, false));
res &= check_string("selections/topology",params, info, false);
}

if(params.has_child("fields"))
{
info["errors"].append() = "Missing required int parameter 'target'";
if(!params["fields"].dtype().is_list())
{
res = false;
info["errors"].append() = "fields is not a list";
}
}

res &= check_numeric("mapping",params, info, false, false);
res &= check_numeric("merge_tolerance",params, info, false, false);
res &= check_numeric("build_adjsets",params, info, false, false);
res &= check_string("original_element_ids",params, info, false);
res &= check_string("original_vertex_ids",params, info, false);

std::vector<std::string> valid_paths;
valid_paths.push_back("target");
valid_paths.push_back("selections");
valid_paths.push_back("fields");
valid_paths.push_back("selections/type");
valid_paths.push_back("selections/domain_id");
valid_paths.push_back("selections/field");
valid_paths.push_back("selections/topology");
valid_paths.push_back("selections/start");
valid_paths.push_back("selections/end");
valid_paths.push_back("selections/elements");
valid_paths.push_back("selections/ranges");
valid_paths.push_back("selections/field");
valid_paths.push_back("mapping");
valid_paths.push_back("merge_tolerance");
valid_paths.push_back("build_adjsets");
valid_paths.push_back("original_element_ids");
valid_paths.push_back("original_vertex_ids");
valid_paths.push_back("distributed");

std::string surprises = surprise_check(valid_paths, params);


std::vector<std::string> ingore_paths = {"fields"};

std::string surprises = surprise_check(valid_paths,ingore_paths, params);

if(surprises != "")
{
res = false;
Expand All @@ -359,29 +391,54 @@ BlueprintPartition::execute()

conduit::Node *n_output = new conduit::Node();

conduit::Node n_options = params();
conduit::Node n_options;

int target = 1;
if(params().has_child("target"))
{
target = params()["target"].to_int32();
}

n_options.set_external(params());
if(n_options.has_child("distributed"))
{
n_options.remove_child("distributed");
}

conduit::Node tmp;
#ifdef ASCENT_MPI_ENABLED
MPI_Comm mpi_comm = MPI_Comm_f2c(flow::Workspace::default_mpi_comm());
if(params().has_child("distributed") &&
params()["distributed"].as_string() == "false" )
{
conduit::blueprint::mesh::partition(*n_input,
n_options,
*n_output);
tmp);
}
else
{
conduit::blueprint::mpi::mesh::partition(*n_input,
n_options,
*n_output,
tmp,
mpi_comm);
}
#else
conduit::blueprint::mesh::partition(*n_input,
n_options,
*n_output);
tmp);
#endif

if(tmp.number_of_children() > 0)
{
if(target == 1)
{
n_output->append().move(tmp);
}
else
{
n_output->move(tmp);
}
}
DataObject *d_output = new DataObject(n_output);
set_output<DataObject>(d_output);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ VTKHAddRanks::execute()
this->name(),
collection,
throw_error);
std::cerr << "topo_name: " << topo_name << std::endl;

if(topo_name == "")
{
// this creates a data object with an invalid source
Expand Down Expand Up @@ -1517,7 +1517,7 @@ VTKHAddDomains::execute()
this->name(),
collection,
throw_error);
std::cerr << "topo_name: " << topo_name << std::endl;

if(topo_name == "")
{
// this creates a data object with an invalid source
Expand All @@ -1530,8 +1530,8 @@ VTKHAddDomains::execute()

vtkh::DataSet &data = collection->dataset_by_topology(topo_name);
data.AddDomainIdField(output_field);

new_coll->add(data, topo_name);

// re wrap in data object
DataObject *res = new DataObject(new_coll);
set_output<DataObject>(res);
Expand Down
42 changes: 13 additions & 29 deletions src/tests/ascent/t_ascent_mpi_add_domain_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include "t_utils.hpp"




using namespace std;
using namespace conduit;
using namespace ascent;
Expand Down Expand Up @@ -81,48 +79,34 @@ TEST(ascent_mpi_add_domain_ids, test_mpi_add_domain_ids)
// Create the actions.
//

conduit::Node pipelines;
// pipeline 1
pipelines["pl1/f1/type"] = "add_domain_ids";
conduit::Node &params = pipelines["pl1/f1/params"];
params["topology"] = "topo";
params["output"] = "domain_ids";

conduit::Node scenes;
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/field"] = "domain_ids";
scenes["s1/plots/p1/pipeline"] = "pl1";
scenes["s1/plots/p1/color_table/discrete"] = "true";

scenes["s1/image_prefix"] = image_file;

conduit::Node actions;
// add the pipeline
conduit::Node &add_pipelines = actions.append();
add_pipelines["action"] = "add_pipelines";
add_pipelines["pipelines"] = pipelines;
conduit::Node &pipelines = add_pipelines["pipelines"];
// add the scenes
conduit::Node &add_scenes= actions.append();
add_scenes["action"] = "add_scenes";
add_scenes["scenes"] = scenes;
conduit::Node &scenes=add_scenes["scenes"];

// pipeline 1
pipelines["pl1/f1/type"] = "add_domain_ids";
conduit::Node &params = pipelines["pl1/f1/params"];
params["topology"] = "topo";
params["output"] = "domain_id";

// conduit::Node extracts;
//
// extracts["e1/type"] = "relay";
// extracts["e1/params/path"] = output_file;
// extracts["e1/params/protocol"] = "blueprint/mesh/hdf5";
// conduit::Node &add_ext= actions.append();
// add_ext["action"] = "add_extracts";
// add_ext["extracts"] = extracts;
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/field"] = "domain_id";
scenes["s1/plots/p1/pipeline"] = "pl1";
scenes["s1/plots/p1/color_table/discrete"] = "true";
scenes["s1/image_prefix"] = image_file;

//
// Run Ascent
//

Ascent ascent;

Node ascent_opts;
ascent_opts["runtime/type"] = "ascent";
ascent_opts["mpi_comm"] = MPI_Comm_c2f(comm);
ascent_opts["exceptions"] = "forward";
ascent.open(ascent_opts);
Expand Down
39 changes: 12 additions & 27 deletions src/tests/ascent/t_ascent_mpi_add_ranks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,49 +80,34 @@ TEST(ascent_mpi_add_mpi_ranks, test_mpi_add_mpi_ranks)
//
// Create the actions.
//
conduit::Node actions;
// add the pipeline
conduit::Node &add_pipelines = actions.append();
add_pipelines["action"] = "add_pipelines";
conduit::Node &pipelines = add_pipelines["pipelines"];
// add the scenes
conduit::Node &add_scenes= actions.append();
add_scenes["action"] = "add_scenes";
conduit::Node &scenes = add_scenes["scenes"];

conduit::Node pipelines;
// pipeline 1
pipelines["pl1/f1/type"] = "add_mpi_ranks";
conduit::Node &params = pipelines["pl1/f1/params"];
params["topology"] = "topo";
params["output"] = "ranks";
params["topology"] = "topo";
params["output"] = "rank";

conduit::Node scenes;
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/field"] = "ranks";
scenes["s1/plots/p1/field"] = "rank";
scenes["s1/plots/p1/pipeline"] = "pl1";
scenes["s1/plots/p1/color_table/discrete"] = "true";

scenes["s1/image_prefix"] = image_file;

conduit::Node actions;
// add the pipeline
conduit::Node &add_pipelines = actions.append();
add_pipelines["action"] = "add_pipelines";
add_pipelines["pipelines"] = pipelines;
// add the scenes
conduit::Node &add_scenes= actions.append();
add_scenes["action"] = "add_scenes";
add_scenes["scenes"] = scenes;

// conduit::Node extracts;
//
// extracts["e1/type"] = "relay";
// extracts["e1/params/path"] = output_file;
// extracts["e1/params/protocol"] = "blueprint/mesh/hdf5";
// conduit::Node &add_ext= actions.append();
// add_ext["action"] = "add_extracts";
// add_ext["extracts"] = extracts;

//
// Run Ascent
//

Ascent ascent;

Node ascent_opts;
ascent_opts["runtime/type"] = "ascent";
ascent_opts["mpi_comm"] = MPI_Comm_c2f(comm);
ascent_opts["exceptions"] = "forward";
ascent.open(ascent_opts);
Expand Down
Loading