Skip to content

Commit

Permalink
Merge branch 'master' into releases/v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
daboehme committed Jun 26, 2019
2 parents 1585441 + b8c4e35 commit 62ad19b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
4 changes: 1 addition & 3 deletions include/caliper/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ConfigManager

typedef std::map<std::string, std::string> argmap_t;

typedef cali::ChannelController* (*CreateConfigFn)(const argmap_t&, bool);
typedef cali::ChannelController* (*CreateConfigFn)(const argmap_t&);

struct ConfigInfo {
const char* name;
Expand Down Expand Up @@ -97,8 +97,6 @@ class ConfigManager
/// add() can be invoked multiple times.
bool add(const char* config_string);

void use_mpi(bool);

/// \brief Pre-set parameter \a key to \a value for all configurations
void set_default_parameter(const char* key, const char* value);

Expand Down
21 changes: 2 additions & 19 deletions src/caliper/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ struct ConfigManager::ConfigManagerImpl
{
ChannelList m_channels;

bool m_use_mpi;

bool m_error = false;
std::string m_error_msg = "";

Expand Down Expand Up @@ -132,7 +130,7 @@ struct ConfigManager::ConfigManagerImpl
if (m_error)
return false;

m_channels.emplace_back( (*cfg_p->create)(args, m_use_mpi) );
m_channels.emplace_back( (*cfg_p->create)(args) );

c = util::read_char(is);
} while (!m_error && is.good() && c == ',');
Expand All @@ -141,12 +139,7 @@ struct ConfigManager::ConfigManagerImpl
}

ConfigManagerImpl()
: m_use_mpi(false)
{
#ifdef CALIPER_HAVE_MPI
m_use_mpi = true;
#endif
}
{ }
};


Expand Down Expand Up @@ -183,16 +176,6 @@ ConfigManager::error_msg() const
return mP->m_error_msg;
}

void
ConfigManager::use_mpi(bool enable)
{
#ifndef CALIPER_HAVE_MPI
if (enable)
Log(0).stream() << "ConfigManager: Cannot enable MPI support in non-MPI Caliper build!" << std::endl;
#endif
mP->m_use_mpi = enable;
}

void
ConfigManager::set_default_parameter(const char* key, const char* value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/caliper/controllers/EventTraceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EventTraceController : public cali::ChannelController
const char* event_trace_args[] = { "output", nullptr };

static cali::ChannelController*
make_event_trace_controller(const cali::ConfigManager::argmap_t& args, bool /*use_mpi*/ )
make_event_trace_controller(const cali::ConfigManager::argmap_t& args)
{
std::string output;
auto it = args.find("output");
Expand Down
13 changes: 12 additions & 1 deletion src/caliper/controllers/RuntimeReportController.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "caliper/ChannelController.h"
#include "caliper/ConfigManager.h"

#include "caliper/common/StringConverter.h"

using namespace cali;

namespace
Expand Down Expand Up @@ -29,11 +31,20 @@ class RuntimeReportController : public cali::ChannelController
const char* runtime_report_args[] = { "output", nullptr };

static cali::ChannelController*
make_runtime_report_controller(const cali::ConfigManager::argmap_t& args, bool use_mpi)
make_runtime_report_controller(const cali::ConfigManager::argmap_t& args)
{
auto it = args.find("output");
std::string output = (it == args.end() ? "" : "stderr");

bool use_mpi = false;
#ifdef CALIPER_HAVE_MPI
use_mpi = true;
#endif

it = args.find("mpi");
if (it != args.end())
use_mpi = StringConverter(it->second).to_bool();

return new RuntimeReportController(use_mpi, output.c_str());
}

Expand Down
12 changes: 11 additions & 1 deletion src/mpi-rt/controllers/SpotController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <caliper/common/Log.h>
#include <caliper/common/OutputStream.h>
#include <caliper/common/StringConverter.h>

#include <unistd.h>

Expand Down Expand Up @@ -145,10 +146,19 @@ class SpotController : public cali::ChannelController
const char* spot_args[] = { "output", nullptr };

cali::ChannelController*
make_spot_controller(const cali::ConfigManager::argmap_t& args, bool use_mpi) {
make_spot_controller(const cali::ConfigManager::argmap_t& args) {
auto it = args.find("output");
std::string output = (it == args.end() ? "" : it->second);

bool use_mpi = false;
#ifdef CALIPER_HAVE_MPI
use_mpi = true;
#endif

it = args.find("mpi");
if (it != args.end())
use_mpi = StringConverter(it->second).to_bool();

return new SpotController(use_mpi, output.c_str());
}

Expand Down
2 changes: 1 addition & 1 deletion src/mpi-rt/controllers/SpotV1Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SpotV1Controller : public cali::ChannelController
const char* spot_v1_args[] = { "config", "code_version", "title", nullptr };

cali::ChannelController*
make_spot_v1_controller(const cali::ConfigManager::argmap_t& args, bool /*use_mpi*/)
make_spot_v1_controller(const cali::ConfigManager::argmap_t& args)
{
return new SpotV1Controller(args);
}
Expand Down
2 changes: 0 additions & 2 deletions test/ci_app_tests/ci_test_mpi_before_cali.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ int main(int argc, char* argv[])
MPI_Init(&argc, &argv);

cali::ConfigManager mgr;

mgr.use_mpi(true);

if (argc > 1)
mgr.add(argv[1]);
Expand Down

0 comments on commit 62ad19b

Please sign in to comment.