-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement config manager and built-in channel controllers (#174)
* ConfigManager: initial implementation * Reorganize built-in controllers * Add test for spot controller * Add Spot v1 controller * Rename ConfigManager.hpp -> ConfigManager.h * Add missing include
- Loading branch information
Showing
30 changed files
with
1,447 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) 2019, Lawrence Livermore National Security, LLC. | ||
// See top-level LICENSE file for details. | ||
|
||
/// \file ConfigManager.hpp | ||
/// \brief %Caliper ConfigManager class definition | ||
|
||
#pragma once | ||
|
||
#include <map> | ||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace cali | ||
{ | ||
|
||
class ChannelController; | ||
|
||
class ConfigManager | ||
{ | ||
struct ConfigManagerImpl; | ||
std::shared_ptr<ConfigManagerImpl> mP; | ||
|
||
public: | ||
|
||
typedef std::map<std::string, std::string> argmap_t; | ||
|
||
typedef cali::ChannelController* (*CreateConfigFn)(const argmap_t&, bool); | ||
|
||
struct ConfigInfo { | ||
const char* name; | ||
const char** args; | ||
CreateConfigFn create; | ||
}; | ||
|
||
static void | ||
add_controllers(const ConfigInfo*); | ||
|
||
ConfigManager(); | ||
|
||
explicit ConfigManager(const char* config_string); | ||
|
||
~ConfigManager(); | ||
|
||
bool add(const char* config_string); | ||
|
||
void use_mpi(bool); | ||
void set_default_parameter(const char* key, const char* value); | ||
|
||
bool error() const; | ||
std::string error_msg() const; | ||
|
||
typedef std::shared_ptr<cali::ChannelController> ChannelPtr; | ||
typedef std::vector<ChannelPtr> ChannelList; | ||
|
||
ChannelList | ||
get_all_channels(); | ||
|
||
ChannelPtr | ||
get_channel(const char* name); | ||
}; | ||
|
||
} // namespace cali |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) 2019, Lawrence Livermore National Security, LLC. | ||
// See top-level LICENSE file for details. | ||
|
||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
#include "caliper/ConfigManager.h" | ||
#include "caliper/ChannelController.h" | ||
|
||
extern "C" { | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) 2019, Lawrence Livermore National Security, LLC. | ||
// See top-level LICENSE file for details. | ||
|
||
/// \file ConfigManager.hpp | ||
/// \brief %Caliper ConfigManager class definition | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace cali | ||
{ | ||
|
||
class ChannelController; | ||
|
||
class ConfigManager | ||
{ | ||
struct ConfigManagerImpl; | ||
std::shared_ptr<ConfigManagerImpl> mP; | ||
|
||
public: | ||
|
||
ConfigManager(); | ||
|
||
explicit ConfigManager(const char* config_string); | ||
|
||
~ConfigManager(); | ||
|
||
bool add(const char* config_string); | ||
|
||
void use_mpi(bool); | ||
void set_default_parameter(const char* key, const char* value); | ||
|
||
bool error() const; | ||
std::string error_msg() const; | ||
|
||
typedef std::shared_ptr<cali::ChannelController> ChannelPtr; | ||
typedef std::vector<ChannelPtr> ChannelList; | ||
|
||
ChannelList | ||
get_all_channels(); | ||
|
||
ChannelPtr | ||
get_channel(const char* name); | ||
}; | ||
|
||
} // namespace cali |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) 2019, Lawrence Livermore National Security, LLC. | ||
// See top-level LICENSE file for details. | ||
|
||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
#include "caliper/ConfigManager.hpp" | ||
#include "caliper/ChannelController.h" | ||
|
||
extern "C" { | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
include_directories("../include") | ||
include_directories("../../mpi/include") | ||
include_directories(${MPI_CXX_INCLUDE_PATH}) | ||
|
||
if (${CMAKE_CXX_COMPILER_ID} MATCHES Intel) | ||
# CMake does not have proper compiler feature support for Intel compilers :-/ | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") | ||
else() | ||
set(CMAKE_C_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_C_STANDARD 99) | ||
endif() | ||
|
||
set(CONFIG_MANAGER_SOURCES | ||
ConfigManager.cpp | ||
RuntimeProfileController.cpp | ||
SpotController.cpp) | ||
|
||
add_library(caliper-config-manager | ||
${CONFIG_MANAGER_SOURCES}) | ||
|
||
target_link_libraries(caliper-config-manager PUBLIC caliper) | ||
|
||
if (CALIPER_HAVE_MPI) | ||
target_link_libraries(caliper-config-manager PUBLIC caliper-mpi) | ||
endif() | ||
|
||
if (BUILD_TESTING) | ||
add_subdirectory(test) | ||
endif() |
Oops, something went wrong.