diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4c3649e50..331ca33fa 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -37,3 +37,7 @@ jobs: working-directory: ${{runner.workspace}}/build shell: bash run: ctest + + - name: Print + if: always() + run: cat ${{runner.workspace}}/build/Testing/Temporary/LastTest.log diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b78ef76f0..06dd75828 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -272,6 +272,7 @@ macro(osh_add_util EXE_NAME) bob_export_target(${EXE_NAME}) endmacro(osh_add_util) +osh_add_util(describe) osh_add_util(msh2osh) osh_add_util(osh2vtk) osh_add_util(oshdiff) @@ -321,7 +322,7 @@ if(BUILD_TESTING) endif() endif() - function(test_func_impl TEST_NAME NUM_PROCS) +function(test_func_impl TEST_NAME NUM_PROCS) if (ENABLE_CTEST_MEMPOOL) set(CTEST_MEMPOOL_ARG "--osh-pool") @@ -571,6 +572,12 @@ if(BUILD_TESTING) endif() osh_add_exe(shape_test) test_basefunc(run_shape_test 1 ./shape_test) + + if(Omega_h_USE_MPI) + test_func(describe_partitioned 2 ./describe ${CMAKE_SOURCE_DIR}/meshes/box_3d_2p.osh) + else() + test_func(describe_serial 1 ./describe ${CMAKE_SOURCE_DIR}/meshes/box_3d.osh) + endif() endif() bob_config_header("${CMAKE_CURRENT_BINARY_DIR}/Omega_h_config.h") diff --git a/src/describe.cpp b/src/describe.cpp new file mode 100644 index 000000000..242ce06e4 --- /dev/null +++ b/src/describe.cpp @@ -0,0 +1,47 @@ +#include +#include + + +int main(int argc, char** argv) +{ + auto lib = Omega_h::Library(&argc, &argv); + Omega_h::Mesh mesh = Omega_h::read_mesh_file(argv[1], lib.world()); + std::ostringstream oss; + + #ifdef OMEGA_H_USE_MPI + int comm_rank; + MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank); + oss << "\nComm Rank: " << comm_rank << "\n"; + #endif + + oss << "\nMesh Entity Count by Dimension: (Dim, Entities Count)\n"; + for(int dim=0; dim < mesh.dim(); dim++) + oss << "(" << dim << ", " << mesh.nents(dim) << ")\n"; + + oss << "\nImbalance by Dimension: (Dim, Imbalance)\n"; + for(int dim=0; dim < mesh.dim(); dim++) + oss << "(" << dim << ", " << mesh.imbalance(dim) << ")\n"; + + oss << "\nMesh Family: " << Omega_h::topological_singular_name(mesh.family(), mesh.dim()-1) << "\n"; + + oss << "\nTags by Dimension: (Dim, Tag, Size per Entity)\n"; + for (int dim=0; dim < mesh.dim(); dim++) + for (int tag=0; tag < mesh.ntags(dim); tag++) { + auto tagbase = mesh.get_tag(dim, tag); + int size; + if (tagbase->type() == OMEGA_H_I8) + size = mesh.get_tag(dim, tagbase->name())->array().size(); + if (tagbase->type() == OMEGA_H_I32) + size = mesh.get_tag(dim, tagbase->name())->array().size(); + if (tagbase->type() == OMEGA_H_I64) + size = mesh.get_tag(dim, tagbase->name())->array().size(); + if (tagbase->type() == OMEGA_H_F64) + size = mesh.get_tag(dim, tagbase->name())->array().size(); + + size /= mesh.nents(dim); + oss << "(" << dim << ", " << tagbase->name().c_str() << ", " << size << ")\n"; + } + + oss << "\n--------------------------------------------------------\n"; + std::cout << oss.str(); +} \ No newline at end of file