Conversation
Fails on two processors because options are not marked used.
Checks for options that are unused on all MPI ranks. Not very efficient but this function isn't called often.
| /// Keys are serialised as a newline-separated string. Newlines are safe as a | ||
| /// separator because option keys use ':' as their only structural character. | ||
| std::set<std::string> getGlobalUnusedSet(std::vector<std::string> local_unused_keys) { | ||
| MPI_Comm comm = BoutComm::get(); |
There was a problem hiding this comment.
warning: no header providing "MPI_Comm" is directly included [misc-include-cleaner]
src/sys/options.cxx:27:
- #include <set>
+ #include <mpi.h>
+ #include <set>There was a problem hiding this comment.
This is supposed to be ignored, but it turns out we've got duplicate misc-include-cleaner.IgnoreHeaders keys in .clang-tidy :(
dschwoerer
left a comment
There was a problem hiding this comment.
Thanks @bendudson, that looks good!
It might be sufficient to use Gatherv rather then Allgatherv - but that is just a nitpick.
It would be sufficient to only check on node0, as that is the only one that writes it out anyway.
ZedThree
left a comment
There was a problem hiding this comment.
LGTM. There's a couple of bits that could use existing functions, but very minor
| std::vector<int> displs(nprocs, 0); | ||
| for (int i = 1; i < nprocs; ++i) { | ||
| displs[i] = displs[i - 1] + all_lens[i - 1]; | ||
| } |
There was a problem hiding this comment.
I think this is std::partial_sum?
There was a problem hiding this comment.
It's close but displs should start with a zero. It might be exclusive_scan in C++17 https://en.cppreference.com/cpp/algorithm/exclusive_scan
Co-authored-by: Peter Hill <peter.hill@york.ac.uk>
Only throw exception on unused option if it's not used on any MPI rank.
Fixes issue #3366