From 17a8cf16a2ae9f494bfd1d92f2c74ceb340430ca Mon Sep 17 00:00:00 2001 From: "Gunther H. Weber" Date: Tue, 21 Sep 2021 20:26:20 -0700 Subject: [PATCH] Added verification code to test results of contour tree app. --- examples/contour_tree_distributed/CMakeLists.txt | 2 ++ .../contour_tree_distributed/split_data_3d.py | 2 +- vtkm/filter/ContourTreeUniformDistributed.hxx | 15 ++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/examples/contour_tree_distributed/CMakeLists.txt b/examples/contour_tree_distributed/CMakeLists.txt index 9ac0b5377..75f3012a4 100644 --- a/examples/contour_tree_distributed/CMakeLists.txt +++ b/examples/contour_tree_distributed/CMakeLists.txt @@ -84,5 +84,7 @@ if (VTKm_ENABLE_MPI) configure_file(split_data_2d.py split_data_2d.py COPYONLY) configure_file(split_data_3d.py split_data_3d.py COPYONLY) configure_file(hact_test.sh hact_test.sh COPYONLY) + configure_file(hact_test_volume.sh hact_test_volume.sh COPYONLY) configure_file(testrun.sh testrun.sh COPYONLY) + configure_file(testrun_volume.sh testrun_volume.sh COPYONLY) endif() diff --git a/examples/contour_tree_distributed/split_data_3d.py b/examples/contour_tree_distributed/split_data_3d.py index cb796e92c..fa8942b04 100755 --- a/examples/contour_tree_distributed/split_data_3d.py +++ b/examples/contour_tree_distributed/split_data_3d.py @@ -10,7 +10,7 @@ import operator # Read a 3D text file from disk into a NumPy array # ... Plain text def read_file(fn): - data = np.fromfile(fn, dtype=np.float, sep=" ") + data = np.fromfile(fn, dtype=float, sep=" ") data = data[3:].reshape((int(data[2]),int(data[0]),int(data[1]))) return data diff --git a/vtkm/filter/ContourTreeUniformDistributed.hxx b/vtkm/filter/ContourTreeUniformDistributed.hxx index d0e8598ee..f4a8643a4 100644 --- a/vtkm/filter/ContourTreeUniformDistributed.hxx +++ b/vtkm/filter/ContourTreeUniformDistributed.hxx @@ -1194,8 +1194,8 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute( vtkm::Id totalVolume = spatialDecomp.GlobalSize[0] * spatialDecomp.GlobalSize[1] * spatialDecomp.GlobalSize[2]; hierarchical_hyper_sweep_master.foreach ( - [&totalVolume](vtkm::worklet::contourtree_distributed::HyperSweepBlock* b, - const vtkmdiy::Master::ProxyWithLink&) { + [&totalVolume, &rank](vtkm::worklet::contourtree_distributed::HyperSweepBlock* b, + const vtkmdiy::Master::ProxyWithLink&) { std::cout << "Block " << b->BlockNo << std::endl; std::cout << "=========" << std::endl; vtkm::worklet::contourtree_augmented::PrintHeader(b->IntrinsicVolume.GetNumberOfValues(), @@ -1211,9 +1211,14 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute( vtkm::cont::LogLevel::Info, b->HierarchicalContourTree.DebugPrint("Called from DumpVolumes", __FILE__, __LINE__)); #endif - VTKM_LOG_S(vtkm::cont::LogLevel::Info, - b->HierarchicalContourTree.DumpVolumes( - totalVolume, b->IntrinsicVolume, b->DependentVolume)); + std::string dumpVolumesString = b->HierarchicalContourTree.DumpVolumes( + totalVolume, b->IntrinsicVolume, b->DependentVolume); + VTKM_LOG_S(vtkm::cont::LogLevel::Info, dumpVolumesString); + std::string volumesFileName = std::string("TreeWithVolumes_Rank_") + + std::to_string(static_cast(rank)) + std::string("_Block_") + + std::to_string(static_cast(b->BlockNo)) + std::string(".txt"); + std::ofstream treeStream(volumesFileName.c_str()); + treeStream << dumpVolumesString; }); // Clean-up