Skip to content
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
4 changes: 2 additions & 2 deletions scripts/build_conduit/build_conduit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ mpicxx_exe="${mpicxx_exe:=mpic++}"
# print all build_ZZZ and enable_ZZZ options
################
echo "*** cmake_compiler_settings: ${cmake_compiler_settings}"
echo "*** build_conduit `enable` settings:"
echo "*** build_conduit enable settings:"
set | grep enable_
echo "*** build_conduit `build` settings:"
echo "*** build_conduit build settings:"
set | grep build_

################
Expand Down
30 changes: 29 additions & 1 deletion src/cmake/thirdparty/SetupPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,35 @@ if(PYTHONINTERP_FOUND)
endif()
endif()
endif()

# fallback: some python distributions (e.g. conda) may report a static
# archive (libpythonX.Y.a) via sysconfig, but only ship shared libs.
if(NOT EXISTS ${PYTHON_LIBRARY})
if(PYTHON_CONFIG_LDLIBRARY MATCHES "\\.a$")
string(REGEX REPLACE "\\.a$" ".so" _PYTHON_CONFIG_LDLIBRARY_SO "${PYTHON_CONFIG_LDLIBRARY}")
foreach(_py_lib_search_dir ${PYTHON_CONFIG_LIBDIR} ${PYTHON_CONFIG_LIBPL})
if(IS_DIRECTORY ${_py_lib_search_dir})
set(_PYTHON_LIBRARY_TEST "${_py_lib_search_dir}/${_PYTHON_CONFIG_LDLIBRARY_SO}")
message(STATUS "Checking for python library at: ${_PYTHON_LIBRARY_TEST}")
if(EXISTS ${_PYTHON_LIBRARY_TEST})
set(PYTHON_LIBRARY ${_PYTHON_LIBRARY_TEST})
break()
endif()

file(GLOB _PYTHON_SO_CANDIDATES "${_py_lib_search_dir}/libpython${PYTHON_CONFIG_VERSION}.so*")
list(LENGTH _PYTHON_SO_CANDIDATES _PYTHON_SO_CANDIDATES_LEN)
if(_PYTHON_SO_CANDIDATES_LEN GREATER 0)
list(GET _PYTHON_SO_CANDIDATES 0 _PYTHON_SO_CANDIDATE)
message(STATUS "Checking for python library at: ${_PYTHON_SO_CANDIDATE}")
if(EXISTS ${_PYTHON_SO_CANDIDATE})
set(PYTHON_LIBRARY ${_PYTHON_SO_CANDIDATE})
break()
endif()
endif()
endif()
endforeach()
endif()
endif()
else() # windows
get_filename_component(PYTHON_ROOT_DIR ${PYTHON_EXECUTABLE} DIRECTORY)
# Note: this assumes that two versions of python are not installed in the same dest dir
Expand Down Expand Up @@ -455,4 +484,3 @@ FUNCTION(PYTHON_ADD_HYBRID_MODULE)
ENDFUNCTION(PYTHON_ADD_HYBRID_MODULE)



13 changes: 11 additions & 2 deletions src/libs/relay/conduit_relay_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,17 @@ load(const std::string &path,
file_path,
sub_base);

hnd.open(file_path);
hnd.read(sub_base,node);
// Explicitly open as sidre_hdf5; relying on auto-detect can select the
// wrong handle for .root/.hdf5 files and break reads.
hnd.open(file_path, "sidre_hdf5", options);
if(sub_base.empty())
{
hnd.read(node);
}
else
{
hnd.read(sub_base,node);
}
hnd.close();
#else
CONDUIT_ERROR("conduit_relay lacks Sidre HDF5 support: " <<
Expand Down
60 changes: 57 additions & 3 deletions src/libs/relay/conduit_relay_io_blueprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2433,9 +2433,63 @@ void read_mesh(const std::string &root_file_path,
hnd.open(root_file_path, "sidre_hdf5", open_opts);
for(int i = domain_start ; i < domain_end; i++)
{
oss.str("");
oss << i << "/" << mesh_name;
hnd.read(oss.str(),mesh);
std::string mesh_path = conduit_fmt::format("domain_{:06d}",i);
Node &mesh_out = mesh[mesh_path];

// Read components of the mesh according to the mesh index.
// For Sidre roots, the per-domain tree id is the prefix and the
// blueprint index paths are relative to that tree.
NodeConstIterator outer_itr = mesh_index.children();
while(outer_itr.has_next())
{
const Node &outer = outer_itr.next();
std::string outer_name = outer_itr.name();

// special logic for state, since it may not include paths
if(outer_name == "state" )
{
if(outer.has_child("path"))
{
const std::string fetch_path =
utils::join_path(conduit_fmt::format("{}",i),
outer["path"].as_string());
if(hnd.has_path(fetch_path))
{
hnd.read(fetch_path, mesh_out[outer_name]);
}
}
else
{
if(outer.has_child("cycle"))
{
mesh_out[outer_name]["cycle"] = outer["cycle"];
}

if(outer.has_child("time"))
{
mesh_out[outer_name]["time"] = outer["time"];
}
}
}

NodeConstIterator itr = outer.children();
while(itr.has_next())
{
const Node &entry = itr.next();
if(entry.has_child("path"))
{
const std::string entry_name = itr.name();
const std::string entry_path = entry["path"].as_string();
const std::string fetch_path =
utils::join_path(conduit_fmt::format("{}",i),
entry_path);
Comment on lines +2484 to +2485
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here about using conduit_fmt to make a string out of an integer being overkill

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure it matters much for these cases - but lore states that fmt is faster than std::to_string()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust lore

if(hnd.has_path(fetch_path))
{
hnd.read(fetch_path, mesh_out[outer_name][entry_name]);
}
}
}
}
}
}
else
Expand Down