Skip to content

Commit 0b734d6

Browse files
authored
Merge pull request #1504 from LLNL/bugfix/kweiss/optional-hdf5
Fixes build and tests when not using `hdf5`
2 parents 44562f9 + 3c5014b commit 0b734d6

15 files changed

+197
-32
lines changed

.mailmap

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Cyrus D. Harrison <[email protected]> Cyrus Harrison <[email protected]>
2424
Cyrus D. Harrison <[email protected]> Cyrus Harrison <[email protected]>
2525
Cyrus D. Harrison <[email protected]> Cyrus <[email protected]>
2626
Daniel Taller <[email protected]> Danny Taller <[email protected]>
27+
Eric B. Chin <[email protected]> E. B. Chin <[email protected]>
2728
Esteban Pauli <[email protected]> Esteban Pauli <[email protected]>
2829
Evan Taylor Desantola <[email protected]> Evan Taylor DeSantola <[email protected]>
2930
format-robot <[email protected]> format-robot <[email protected]>
@@ -67,6 +68,8 @@ Robert Carson <[email protected]> Robert <[email protected]>
6768
Robert Carson <[email protected]> rcarson3 <[email protected]>
6869
Robert Cohn <[email protected]> rscohn2 <[email protected]>
6970
Samuel P. Mish <[email protected]> samuelpmishLLNL <[email protected]>
71+
Sterbentz <[email protected]> Sterbentz <[email protected]>
72+
7073

7174
Axom Shared User <[email protected]> Asctoolkit Shared User <[email protected]>
7275
Axom Shared User <[email protected]> Asctoolkit Shared User <[email protected]>

src/axom/primal/tests/primal_surface_intersect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void checkIntersections(const primal::Ray<CoordType, 3>& ray,
9090
<< "\n\t" << ray << "\n\t" << patch;
9191

9292
sstr << "\ns (" << u.size() << "): ";
93-
for(auto i = 0u; i < u.size(); ++i)
93+
for(auto i = 0; i < u.size(); ++i)
9494
{
9595
sstr << std::setprecision(16) << "(" << u[i] << "," << v[i] << "),";
9696
}

src/axom/quest/detail/PointInCellMeshWrapper_mfem.hpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,13 @@ class PointInCellMeshWrapper<quest_point_in_cell_mfem_tag>
408408
}
409409

410410
// Output some information
411-
SLIC_DEBUG("Mesh nodes fec -- "
412-
<< nodalFEColl->Name() << " with ordering "
413-
<< nodalFESpace->GetOrdering()
414-
<< "\n\t -- Positive nodes are fec -- "
415-
<< positiveNodes->FESpace()->FEColl()->Name()
416-
<< " with ordering " << positiveNodes->FESpace()->GetOrdering());
411+
SLIC_DEBUG_ROOT("Mesh nodes fec -- "
412+
<< nodalFEColl->Name() << " with ordering "
413+
<< nodalFESpace->GetOrdering()
414+
<< "\n\t -- Positive nodes are fec -- "
415+
<< positiveNodes->FESpace()->FEColl()->Name()
416+
<< " with ordering "
417+
<< positiveNodes->FESpace()->GetOrdering());
417418

418419
/// For each element, compute bounding box, and overall mesh bbox
419420
mfem::Array<int> dofIndices;

src/axom/quest/examples/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ if (CONDUIT_FOUND AND RAJA_FOUND AND UMPIRE_FOUND)
9797
FOLDER axom/quest/examples
9898
)
9999

100-
# Add unit tests
101-
if(AXOM_ENABLE_TESTS AND AXOM_DATA_DIR)
100+
# Add unit tests; the (current) input meshes are in the hdf5 format
101+
if(AXOM_ENABLE_TESTS AND AXOM_DATA_DIR AND HDF5_FOUND)
102102

103-
# Run the candidates example with the different spatial indices
104-
# and raja policies
103+
# Run the candidates example with the different spatial indices and raja policies
105104

106105
# Use same file for input and query
107106
set(input_file "${AXOM_DATA_DIR}/quest/ucart10.cycle_000000.root")
@@ -423,7 +422,8 @@ if(CONDUIT_FOUND)
423422
)
424423

425424
# These examples currently segfault on windows without MPI when loading the test data into conduit
426-
if(AXOM_ENABLE_TESTS AND AXOM_DATA_DIR AND NOT WIN32)
425+
# Also, the input files are hdf5
426+
if(AXOM_ENABLE_TESTS AND AXOM_DATA_DIR AND NOT WIN32 AND HDF5_FOUND)
427427
if (ENABLE_MPI)
428428
set(_nranks 3)
429429
endif()

src/axom/sidre/core/MFEMSidreDataCollection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ void MFEMSidreDataCollection::Save(const std::string& filename,
12201220
// Root file support only available in hdf5.
12211221
else
12221222
{
1223-
writer.write(blueprint_indicies_grp, 1, file_path + ".root", protocol);
1223+
blueprint_indicies_grp->save(file_path + ".root", protocol);
12241224
}
12251225
}
12261226
}

src/axom/sidre/core/MFEMSidreDataCollection.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,12 @@ class MFEMSidreDataCollection : public mfem::DataCollection
472472
*/
473473
virtual void Load(int cycle_ = 0)
474474
{
475+
#ifndef AXOM_USE_HDF5
476+
SLIC_ERROR(
477+
"MFEMSidreDataCollection::Load(<cycle>) is only implemented for the "
478+
"'sidre_hdf5' protocol");
479+
#endif
480+
475481
SetCycle(cycle_);
476482
Load(get_file_path(name), "sidre_hdf5");
477483
}

src/axom/sidre/examples/spio/CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ foreach(src ${spio_example_sources})
3030
)
3131
endforeach()
3232

33-
if(SCR_FOUND AND AXOM_ENABLE_TESTS)
34-
# Note: This example is a combination of a test and an example due
35-
# inability to run two SCR executables at the same time
33+
if(SCR_FOUND AND AXOM_ENABLE_TESTS AND HDF5_FOUND)
34+
# Note: This example is a combination of a test and an example
35+
# since we're unable to run two SCR executables at the same time
36+
#
37+
# The test was written against the sidre_hdf5 protocol, so disable it
38+
# in configurations that do not include hdf5
39+
3640
axom_add_executable(
3741
NAME spio_IO_SCR_Checkpoint_ex
3842
SOURCES IO_SCR_Checkpoint.cpp

src/axom/sidre/spio/IOManager.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,13 @@ void IOManager::write(sidre::Group* datagroup,
177177

178178
std::string test_file_base(broadcastString(file_base, m_mpi_comm, m_my_rank));
179179

180-
SLIC_WARNING_IF(test_file_base != file_base,
181-
"IOManager::write() file_base argument is not identical "
182-
<< "on all ranks. This may cause the output files to be "
183-
<< "incompatible with a call to IOManager::read().");
180+
SLIC_WARNING_IF(
181+
test_file_base != file_base,
182+
"IOManager::write() file_base argument is not identical "
183+
<< "on all ranks. This may cause the output files to be "
184+
<< "incompatible with a call to IOManager::read()."
185+
<< axom::fmt::format("\n\tfile_base: '{}'", file_base)
186+
<< axom::fmt::format("\n\ttest_file_base: '{}'", test_file_base));
184187

185188
std::string output_base =
186189
createRootFile(file_base, num_files, protocol, tree_pattern);

src/axom/sidre/tests/sidre_external.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
//
44
// SPDX-License-Identifier: (BSD-3-Clause)
55

6-
#include "gtest/gtest.h"
7-
8-
#include <vector>
9-
106
#include "axom/config.hpp"
117
#include "axom/core/Types.hpp"
128
#include "axom/sidre.hpp"
139

10+
#include "gtest/gtest.h"
11+
12+
#include <vector>
13+
1414
using axom::sidre::DataStore;
1515
using axom::sidre::DOUBLE_ID;
1616
using axom::sidre::Group;
@@ -292,6 +292,12 @@ TEST(sidre_external, verify_external_layout)
292292
//------------------------------------------------------------------------------
293293
TEST(sidre_external, save_load_external_view)
294294
{
295+
#ifndef AXOM_USE_HDF5
296+
SUCCEED() << "sidre::Group::loadExternalData() is only implemented "
297+
"for the 'sidre_hdf5' protocol";
298+
return;
299+
#endif
300+
295301
DataStore* ds = new DataStore();
296302
Group* root = ds->getRoot();
297303

src/axom/sidre/tests/sidre_group.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
// SPDX-License-Identifier: (BSD-3-Clause)
55

6-
#include "axom/config.hpp" // for AXOM_USE_HDF5
6+
#include "axom/config.hpp"
77
#include "axom/core.hpp"
88
#include "axom/sidre.hpp"
99

src/axom/sidre/tests/sidre_mfem_datacollection.cpp

+113
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ TEST(sidre_datacollection, dc_reload_gf)
184184
sdc_writer.SetCycle(0);
185185
sdc_writer.Save();
186186

187+
#ifndef AXOM_USE_HDF5
188+
SUCCEED()
189+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
190+
"for the 'sidre_hdf5' protocol";
191+
return;
192+
#endif
193+
187194
// No mesh is used here
188195
MFEMSidreDataCollection sdc_reader(testName());
189196

@@ -236,6 +243,13 @@ TEST(sidre_datacollection, dc_reload_gf_vdim)
236243
sdc_writer.SetCycle(0);
237244
sdc_writer.Save();
238245

246+
#ifndef AXOM_USE_HDF5
247+
SUCCEED()
248+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
249+
"for the 'sidre_hdf5' protocol";
250+
return;
251+
#endif
252+
239253
// No mesh is used here
240254
MFEMSidreDataCollection sdc_reader(testName());
241255

@@ -256,8 +270,16 @@ TEST(sidre_datacollection, dc_reload_gf_vdim)
256270
EXPECT_TRUE(sdc_reader.verifyMeshBlueprint());
257271
}
258272

273+
// Note: This test use Group::loadExternalData(), which is only valid (implemented)
274+
// for sidre_hdf5 protocol. Let's skip the test in configs w/o hdf5
259275
TEST(sidre_datacollection, dc_reload_externaldata)
260276
{
277+
#ifndef AXOM_USE_HDF5
278+
SUCCEED() << "sidre::Group::loadExternalData() is only implemented "
279+
"for the 'sidre_hdf5' protocol";
280+
return;
281+
#endif
282+
261283
const std::string view_name = "external_data";
262284

263285
// Create DC
@@ -336,6 +358,13 @@ TEST(sidre_datacollection, dc_reload_mesh)
336358
sdc_writer.SetCycle(0);
337359
sdc_writer.Save();
338360

361+
#ifndef AXOM_USE_HDF5
362+
SUCCEED()
363+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
364+
"for the 'sidre_hdf5' protocol";
365+
return;
366+
#endif
367+
339368
// No mesh is used here to construct as it will be read in
340369
MFEMSidreDataCollection sdc_reader(testName());
341370
#if defined(AXOM_USE_MPI) && defined(MFEM_USE_MPI)
@@ -400,6 +429,13 @@ TEST(sidre_datacollection, dc_reload_qf)
400429
sdc_writer.SetTime(8.0);
401430
sdc_writer.Save();
402431

432+
#ifndef AXOM_USE_HDF5
433+
SUCCEED()
434+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
435+
"for the 'sidre_hdf5' protocol";
436+
return;
437+
#endif
438+
403439
MFEMSidreDataCollection sdc_reader(testName());
404440
#if defined(AXOM_USE_MPI) && defined(MFEM_USE_MPI)
405441
sdc_reader.SetComm(MPI_COMM_WORLD);
@@ -893,6 +929,13 @@ TEST(sidre_datacollection, dc_par_reload_gf)
893929
sdc_writer.SetCycle(0);
894930
sdc_writer.Save();
895931

932+
#ifndef AXOM_USE_HDF5
933+
SUCCEED()
934+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
935+
"for the 'sidre_hdf5' protocol";
936+
return;
937+
#endif
938+
896939
MFEMSidreDataCollection sdc_reader(testName());
897940

898941
// Needs to be set "manually" in order for everything to be loaded in properly
@@ -964,6 +1007,13 @@ TEST(sidre_datacollection, dc_par_reload_gf_ordering)
9641007
sdc_writer.SetCycle(0);
9651008
sdc_writer.Save();
9661009

1010+
#ifndef AXOM_USE_HDF5
1011+
SUCCEED()
1012+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1013+
"for the 'sidre_hdf5' protocol";
1014+
return;
1015+
#endif
1016+
9671017
MFEMSidreDataCollection sdc_reader(testName());
9681018

9691019
// Needs to be set "manually" in order for everything to be loaded in properly
@@ -1063,6 +1113,13 @@ TEST(sidre_datacollection, dc_par_reload_multi_datastore)
10631113
second_sdc_writer.SetCycle(0);
10641114
second_sdc_writer.Save();
10651115

1116+
#ifndef AXOM_USE_HDF5
1117+
SUCCEED()
1118+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1119+
"for the 'sidre_hdf5' protocol";
1120+
return;
1121+
#endif
1122+
10661123
axom::sidre::DataStore ds_read;
10671124

10681125
first_global_grp = ds_read.getRoot()->createGroup(first_coll_name + "_global");
@@ -1127,20 +1184,41 @@ TEST(sidre_datacollection, dc_par_reload_multi_datastore)
11271184

11281185
TEST(sidre_datacollection, dc_par_reload_mesh_1D_small)
11291186
{
1187+
#ifndef AXOM_USE_HDF5
1188+
SUCCEED()
1189+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1190+
"for the 'sidre_hdf5' protocol";
1191+
return;
1192+
#endif
1193+
11301194
// 1D mesh divided into segments
11311195
auto mesh = mfem::Mesh::MakeCartesian1D(10);
11321196
testParallelMeshReloadAllPartitionings(mesh);
11331197
}
11341198

11351199
TEST(sidre_datacollection, dc_par_reload_mesh_2D_small)
11361200
{
1201+
#ifndef AXOM_USE_HDF5
1202+
SUCCEED()
1203+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1204+
"for the 'sidre_hdf5' protocol";
1205+
return;
1206+
#endif
1207+
11371208
// 2D mesh divided into triangles
11381209
auto mesh = mfem::Mesh::MakeCartesian2D(10, 10, mfem::Element::TRIANGLE);
11391210
testParallelMeshReloadAllPartitionings(mesh);
11401211
}
11411212

11421213
TEST(sidre_datacollection, dc_par_reload_mesh_2D_large)
11431214
{
1215+
#ifndef AXOM_USE_HDF5
1216+
SUCCEED()
1217+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1218+
"for the 'sidre_hdf5' protocol";
1219+
return;
1220+
#endif
1221+
11441222
// 2D mesh divided into triangles
11451223
auto mesh = mfem::Mesh::MakeCartesian2D(100, 100, mfem::Element::TRIANGLE);
11461224
testParallelMeshReloadAllPartitionings(mesh);
@@ -1150,6 +1228,13 @@ TEST(sidre_datacollection, dc_par_reload_mesh_2D_large)
11501228
#if(MFEM_VERSION >= 40300)
11511229
TEST(sidre_datacollection, dc_par_reload_mesh_2D_periodic)
11521230
{
1231+
#ifndef AXOM_USE_HDF5
1232+
SUCCEED()
1233+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1234+
"for the 'sidre_hdf5' protocol";
1235+
return;
1236+
#endif
1237+
11531238
// periodic 2D mesh divided into triangles
11541239
auto base_mesh = mfem::Mesh::MakeCartesian2D(10,
11551240
10,
@@ -1167,27 +1252,55 @@ TEST(sidre_datacollection, dc_par_reload_mesh_2D_periodic)
11671252

11681253
TEST(sidre_datacollection, dc_par_reload_mesh_3D_small_tet)
11691254
{
1255+
#ifndef AXOM_USE_HDF5
1256+
SUCCEED()
1257+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1258+
"for the 'sidre_hdf5' protocol";
1259+
return;
1260+
#endif
1261+
11701262
// 3D mesh divided into tetrahedra
11711263
auto mesh = mfem::Mesh::MakeCartesian3D(2, 2, 2, mfem::Element::TETRAHEDRON);
11721264
testParallelMeshReloadAllPartitionings(mesh);
11731265
}
11741266

11751267
TEST(sidre_datacollection, dc_par_reload_mesh_3D_medium_tet)
11761268
{
1269+
#ifndef AXOM_USE_HDF5
1270+
SUCCEED()
1271+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1272+
"for the 'sidre_hdf5' protocol";
1273+
return;
1274+
#endif
1275+
11771276
// 3D mesh divided into tetrahedra
11781277
auto mesh = mfem::Mesh::MakeCartesian3D(10, 10, 10, mfem::Element::TETRAHEDRON);
11791278
testParallelMeshReloadAllPartitionings(mesh);
11801279
}
11811280

11821281
TEST(sidre_datacollection, dc_par_reload_mesh_3D_small_hex)
11831282
{
1283+
#ifndef AXOM_USE_HDF5
1284+
SUCCEED()
1285+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1286+
"for the 'sidre_hdf5' protocol";
1287+
return;
1288+
#endif
1289+
11841290
// 3D mesh divided into hexahedra
11851291
auto mesh = mfem::Mesh::MakeCartesian3D(3, 3, 3, mfem::Element::HEXAHEDRON);
11861292
testParallelMeshReloadAllPartitionings(mesh);
11871293
}
11881294

11891295
TEST(sidre_datacollection, dc_par_reload_mesh_3D_medium_hex)
11901296
{
1297+
#ifndef AXOM_USE_HDF5
1298+
SUCCEED()
1299+
<< "sidre::MFEMSidreDataCollection::load(<cycle>) is only implemented "
1300+
"for the 'sidre_hdf5' protocol";
1301+
return;
1302+
#endif
1303+
11911304
// 3D mesh divided into hexahedra
11921305
auto mesh = mfem::Mesh::MakeCartesian3D(10, 10, 10, mfem::Element::HEXAHEDRON);
11931306
testParallelMeshReloadAllPartitionings(mesh);

0 commit comments

Comments
 (0)