Skip to content

Commit 140c951

Browse files
committed
v19: add save of argv for invocation line print
1 parent e89ff7d commit 140c951

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

src/Omega_h_library.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ void Library::initialize(char const* head_desc, int* argc, char*** argv
6767
std::string msg_str = msg.str();
6868
Omega_h::fail("%s\n", msg_str.c_str());
6969
}
70+
OMEGA_H_CHECK(argc != nullptr);
71+
OMEGA_H_CHECK(argv != nullptr);
72+
for (int ic = 0; ic < *argc; ic++) {
73+
argv_.push_back((*argv)[ic]);
74+
}
7075
#ifdef OMEGA_H_USE_MPI
7176
int mpi_is_init;
7277
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
155160
int local_mpi_rank = rank % mpi_ranks_per_node;
156161
cudaSetDevice(local_mpi_rank);
157162
cudaGetDevice(&my_device);
163+
PCOUT("ndevices_per_node= " << ndevices_per_node << " mpi_ranks_per_node= " << mpi_ranks_per_node << " local_mpi_rank= " << local_mpi_rank << std::endl);
158164
OMEGA_H_CHECK_OP(mpi_ranks_per_node, ==, ndevices_per_node);
159165
OMEGA_H_CHECK_OP(my_device, ==, local_mpi_rank);
160166
}

src/Omega_h_library.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Library {
3737
LO self_send_threshold() const;
3838
LO self_send_threshold_;
3939
bool silent_;
40+
std::vector<std::string> argv_;
4041

4142
private:
4243
void initialize(char const* head_desc, int* argc, char*** argv

src/Omega_h_mesh.cpp

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "Omega_h_quality.hpp"
1818
#include "Omega_h_shape.hpp"
1919
#include "Omega_h_timer.hpp"
20+
#include "Omega_h_print.hpp"
2021
#include "Omega_h_dbg.hpp"
2122

2223
namespace Omega_h {
@@ -762,34 +763,39 @@ Real Mesh::imbalance(Int ent_dim) const {
762763
}
763764

764765
std::string Mesh::string(int verbose) {
765-
(void)verbose;
766766
std::ostringstream oss;
767767
oss << "Mesh:"
768-
<< "\n comm()->size = " << comm()->size()
769-
<< "\n parting = " << parting()
770-
<< "\n dim = " << dim()
771-
<< "\n family = " << family()
772-
<< "\n nents = " << nents(dim())
773-
<< "\n nents(0) = " << nents(0)
774-
<< "\n nelems = " << nelems();
768+
<< "\n comm()->size = " << comm()->size()
769+
<< "\n parting = " << parting()
770+
<< "\n dim = " << dim()
771+
<< "\n family = " << family()
772+
<< "\n nents(dim) = " << nents(dim())
773+
<< "\n nents(0) = " << nents(0)
774+
<< "\n nelems = " << nelems();
775775
if (dim() > 2) {
776-
oss << "\n nregions = " << nregions();
777-
}
778-
oss << "\n nfaces = " << nfaces()
779-
<< "\n nedges = " << nedges()
780-
<< "\n nverts = " << nverts()
781-
<< "\n nglobal_ents = " << nglobal_ents(dim())
782-
<< "\n nglobal_ents(0) = " << nglobal_ents(0)
783-
<< "\n ntags = " << ntags(dim())
784-
<< "\n ntags(0) = " << ntags(0)
785-
//<< "\n min_quality = " << min_quality()
786-
//<< "\n max_length = " << max_length()
787-
<< "\n could_be_shared = " << could_be_shared(dim())
788-
<< "\n could_be_shared(0) = " << could_be_shared(0)
789-
<< "\n owners_have_all_upward = " << owners_have_all_upward(dim())
790-
<< "\n owners_have_all_upward(0) = " << owners_have_all_upward(0)
791-
<< "\n have_all_upward = " << have_all_upward()
792-
<< "\n imbalance = " << imbalance();
776+
oss
777+
<< "\n nregions = " << nregions();
778+
}
779+
oss << "\n nfaces = " << nfaces()
780+
<< "\n nedges = " << nedges()
781+
<< "\n nverts = " << nverts()
782+
<< "\n nglobal_ents(dim) = " << nglobal_ents(dim())
783+
<< "\n nglobal_ents(0) = " << nglobal_ents(0)
784+
<< "\n ntags = " << ntags(dim())
785+
<< "\n ntags(0) = " << ntags(0)
786+
//<< "\n min_quality = " << min_quality()
787+
//<< "\n max_length = " << max_length()
788+
<< "\n could_be_shared(dim) = " << could_be_shared(dim())
789+
<< "\n could_be_shared(0) = " << could_be_shared(0)
790+
<< "\n owners_have_all_upward(dim) = " << owners_have_all_upward(dim())
791+
<< "\n owners_have_all_upward(0) = " << owners_have_all_upward(0)
792+
<< "\n have_all_upward = " << have_all_upward()
793+
<< "\n imbalance = " << imbalance();
794+
if (verbose) {
795+
oss
796+
<< "\n globals(dim) =\n" << globals(dim())
797+
<< "\n globals(0) =\n" << globals(0);
798+
}
793799
return oss.str();
794800
}
795801

0 commit comments

Comments
 (0)