Skip to content

Commit

Permalink
v19: add save of argv for invocation line print
Browse files Browse the repository at this point in the history
  • Loading branch information
skennon10 committed Apr 29, 2021
1 parent e89ff7d commit 140c951
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 25 deletions.
6 changes: 6 additions & 0 deletions src/Omega_h_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/Omega_h_library.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Library {
LO self_send_threshold() const;
LO self_send_threshold_;
bool silent_;
std::vector<std::string> argv_;

private:
void initialize(char const* head_desc, int* argc, char*** argv
Expand Down
56 changes: 31 additions & 25 deletions src/Omega_h_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 140c951

Please sign in to comment.