From 140c95189b89ef33d03dcd07a8da2de2336acd29 Mon Sep 17 00:00:00 2001 From: skennon10 Date: Thu, 29 Apr 2021 12:24:27 -0600 Subject: [PATCH] v19: add save of argv for invocation line print --- src/Omega_h_library.cpp | 6 +++++ src/Omega_h_library.hpp | 1 + src/Omega_h_mesh.cpp | 56 +++++++++++++++++++++++------------------ 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/Omega_h_library.cpp b/src/Omega_h_library.cpp index f9093baf4..93b7d076a 100644 --- a/src/Omega_h_library.cpp +++ b/src/Omega_h_library.cpp @@ -67,6 +67,11 @@ void Library::initialize(char const* head_desc, int* argc, char*** argv std::string msg_str = msg.str(); Omega_h::fail("%s\n", msg_str.c_str()); } + OMEGA_H_CHECK(argc != nullptr); + OMEGA_H_CHECK(argv != nullptr); + for (int ic = 0; ic < *argc; ic++) { + argv_.push_back((*argv)[ic]); + } #ifdef OMEGA_H_USE_MPI int mpi_is_init; OMEGA_H_CHECK(MPI_SUCCESS == MPI_Initialized(&mpi_is_init)); @@ -155,6 +160,7 @@ void Library::initialize(char const* head_desc, int* argc, char*** argv int local_mpi_rank = rank % mpi_ranks_per_node; cudaSetDevice(local_mpi_rank); cudaGetDevice(&my_device); + PCOUT("ndevices_per_node= " << ndevices_per_node << " mpi_ranks_per_node= " << mpi_ranks_per_node << " local_mpi_rank= " << local_mpi_rank << std::endl); OMEGA_H_CHECK_OP(mpi_ranks_per_node, ==, ndevices_per_node); OMEGA_H_CHECK_OP(my_device, ==, local_mpi_rank); } diff --git a/src/Omega_h_library.hpp b/src/Omega_h_library.hpp index 68486207c..e01f63fd7 100644 --- a/src/Omega_h_library.hpp +++ b/src/Omega_h_library.hpp @@ -37,6 +37,7 @@ class Library { LO self_send_threshold() const; LO self_send_threshold_; bool silent_; + std::vector argv_; private: void initialize(char const* head_desc, int* argc, char*** argv diff --git a/src/Omega_h_mesh.cpp b/src/Omega_h_mesh.cpp index 2a5401793..c2386f23a 100644 --- a/src/Omega_h_mesh.cpp +++ b/src/Omega_h_mesh.cpp @@ -17,6 +17,7 @@ #include "Omega_h_quality.hpp" #include "Omega_h_shape.hpp" #include "Omega_h_timer.hpp" +#include "Omega_h_print.hpp" #include "Omega_h_dbg.hpp" namespace Omega_h { @@ -762,34 +763,39 @@ Real Mesh::imbalance(Int ent_dim) const { } std::string Mesh::string(int verbose) { - (void)verbose; std::ostringstream oss; oss << "Mesh:" - << "\n comm()->size = " << comm()->size() - << "\n parting = " << parting() - << "\n dim = " << dim() - << "\n family = " << family() - << "\n nents = " << nents(dim()) - << "\n nents(0) = " << nents(0) - << "\n nelems = " << nelems(); + << "\n comm()->size = " << comm()->size() + << "\n parting = " << parting() + << "\n dim = " << dim() + << "\n family = " << family() + << "\n nents(dim) = " << nents(dim()) + << "\n nents(0) = " << nents(0) + << "\n nelems = " << nelems(); if (dim() > 2) { - oss << "\n nregions = " << nregions(); - } - oss << "\n nfaces = " << nfaces() - << "\n nedges = " << nedges() - << "\n nverts = " << nverts() - << "\n nglobal_ents = " << nglobal_ents(dim()) - << "\n nglobal_ents(0) = " << nglobal_ents(0) - << "\n ntags = " << ntags(dim()) - << "\n ntags(0) = " << ntags(0) - //<< "\n min_quality = " << min_quality() - //<< "\n max_length = " << max_length() - << "\n could_be_shared = " << could_be_shared(dim()) - << "\n could_be_shared(0) = " << could_be_shared(0) - << "\n owners_have_all_upward = " << owners_have_all_upward(dim()) - << "\n owners_have_all_upward(0) = " << owners_have_all_upward(0) - << "\n have_all_upward = " << have_all_upward() - << "\n imbalance = " << imbalance(); + oss + << "\n nregions = " << nregions(); + } + oss << "\n nfaces = " << nfaces() + << "\n nedges = " << nedges() + << "\n nverts = " << nverts() + << "\n nglobal_ents(dim) = " << nglobal_ents(dim()) + << "\n nglobal_ents(0) = " << nglobal_ents(0) + << "\n ntags = " << ntags(dim()) + << "\n ntags(0) = " << ntags(0) + //<< "\n min_quality = " << min_quality() + //<< "\n max_length = " << max_length() + << "\n could_be_shared(dim) = " << could_be_shared(dim()) + << "\n could_be_shared(0) = " << could_be_shared(0) + << "\n owners_have_all_upward(dim) = " << owners_have_all_upward(dim()) + << "\n owners_have_all_upward(0) = " << owners_have_all_upward(0) + << "\n have_all_upward = " << have_all_upward() + << "\n imbalance = " << imbalance(); + if (verbose) { + oss + << "\n globals(dim) =\n" << globals(dim()) + << "\n globals(0) =\n" << globals(0); + } return oss.str(); }