4444#if !defined INCLUDED_VT_LB_UNIT_TEST_HELPERS_H
4545#define INCLUDED_VT_LB_UNIT_TEST_HELPERS_H
4646
47- #include " vt/context/context.h"
4847#include < mpi.h>
4948#include < gtest/gtest.h>
5049#include < sstream>
@@ -58,23 +57,23 @@ extern char** test_argv;
5857 * Maximum number of ranks/nodes detected by CMake on this machine.
5958 * Defaults to number of processors detected on the host system.
6059 */
61- constexpr vt::NodeType CMAKE_DETECTED_MAX_NUM_NODES = vt_detected_max_num_nodes;
60+ // constexpr vt::NodeType CMAKE_DETECTED_MAX_NUM_NODES = vt_detected_max_num_nodes;
6261
6362/* *
6463 * Check whether we're oversubscribing on the current execution.
6564 * This is using MPI because it can be used before vt initializes.
6665 */
67- inline bool isOversubscribed () {
68- // be sure to only call this from parallel tests
69- int init = 0 ;
70- MPI_Initialized (&init);
71- if (!init) {
72- MPI_Init (&test_argc, &test_argv);
73- }
74- int num_ranks = 0 ;
75- MPI_Comm_size (MPI_COMM_WORLD, &num_ranks);
76- return num_ranks > CMAKE_DETECTED_MAX_NUM_NODES;
77- }
66+ // inline bool isOversubscribed() {
67+ // // be sure to only call this from parallel tests
68+ // int init = 0;
69+ // MPI_Initialized(&init);
70+ // if (!init) {
71+ // MPI_Init(&test_argc, &test_argv);
72+ // }
73+ // int num_ranks = 0;
74+ // MPI_Comm_size(MPI_COMM_WORLD, &num_ranks);
75+ // return num_ranks > CMAKE_DETECTED_MAX_NUM_NODES;
76+ // }
7877
7978/* *
8079 * Get a unique filename based on the unit test name.
@@ -94,12 +93,12 @@ inline std::string getUniqueFilename(const std::string& ext = "") {
9493 * concurrently-running tests will not cause file system race conditions.
9594 * Do not call this from .nompi.cc tests or from addAdditionalArgs().
9695 */
97- inline std::string getUniqueFilenameWithRanks (const std::string& ext = " " ) {
98- auto ranks = vt::theContext ()->getNumNodes ();
99- std::stringstream ss;
100- ss << getUniqueFilename () << " _" << ranks << ext;
101- return ss.str ();
102- }
96+ // inline std::string getUniqueFilenameWithRanks(const std::string& ext = "") {
97+ // auto ranks = vt::theContext()->getNumNodes();
98+ // std::stringstream ss;
99+ // ss << getUniqueFilename() << "_" << ranks << ext;
100+ // return ss.str();
101+ // }
103102
104103/* *
105104 * The following helper macros (these have to be macros, because GTEST_SKIP
@@ -116,7 +115,7 @@ inline std::string getUniqueFilenameWithRanks(const std::string& ext = "") {
116115 */
117116#define SET_MAX_NUM_NODES_CONSTRAINT (max_req_num_nodes ) \
118117{ \
119- auto const num_nodes = vt::theContext ()-> getNumNodes (); \
118+ auto const num_nodes = comm. numRanks (); \
120119 if (num_nodes > max_req_num_nodes) { \
121120 GTEST_SKIP () << fmt::format ( \
122121 " Skipping the run on {} nodes. This test should run on at most {} " \
@@ -132,7 +131,7 @@ inline std::string getUniqueFilenameWithRanks(const std::string& ext = "") {
132131 */
133132#define SET_MIN_NUM_NODES_CONSTRAINT (min_req_num_nodes ) \
134133{ \
135- auto const num_nodes = vt::theContext ()-> getNumNodes (); \
134+ auto const num_nodes = comm. numRanks (); \
136135 if (num_nodes < min_req_num_nodes) { \
137136 GTEST_SKIP () << fmt::format ( \
138137 " Skipping the run on {} nodes. This test should run on at least {} " \
@@ -148,7 +147,7 @@ inline std::string getUniqueFilenameWithRanks(const std::string& ext = "") {
148147 */
149148#define SET_NUM_NODES_CONSTRAINT (req_num_nodes ) \
150149{ \
151- auto const num_nodes = vt::theContext ()-> getNumNodes (); \
150+ auto const num_nodes = comm. numRanks (); \
152151 if (num_nodes != req_num_nodes) { \
153152 GTEST_SKIP () << fmt::format ( \
154153 " Skipping the run on {} nodes. This test should run only on {} " \
0 commit comments