9#ifdef ADC_BOOST_JSON_PUBLIC
10#include "boost/json/src.hpp"
25 {{
"DIRECTORY",
"./test.outputs"},
26 {
"FILE",
"out.file.log" },
34 {
"STREAM",
"adc_publish_api" }
38int start_publisher(std::shared_ptr<adc::publisher_api> pi, std::map<std::string, std::string>& pconfig ) {
40 int err = pi->config(pconfig);
42 std::cout <<
"config failed " <<
43 std::strerror(err) << std::endl;
47 err = pi->initialize();
49 std::cout <<
"initialize failed " <<
50 std::strerror(err) << std::endl;
60 b->add_header_section(
"cxx_demo_1");
66 b->add_memory_usage_section();
70 std::shared_ptr< adc::builder_api > app_data = f.
get_builder();
73 app_data->add(
"foo",
"bar");
74 b->add_app_data_section(app_data);
78 std::shared_ptr< adc::builder_api > version = f.
get_builder();
79 version->add(
"version",
"1.1.3");
80 const char* tags[] = {
"boca_raton",
"saronida_2"};
81 version->add_array(
"tags", tags, 2);
82 version->add(
"mesh_version",
"5.0.0");
84 std::vector<std::string> children = {
"uuid1",
"uuid2",
"uuid3"};
85 b->add_workflow_section();
86 b->add_workflow_children(children);
90 MPI_Comm comm = MPI_COMM_WORLD;
99 std::shared_ptr< adc::builder_api > model_data = f.
get_builder();
100 model_data->add(
"nx", 3);
101 model_data->add(
"ny", 10);
102 model_data->add(
"step", 0);
103 b->add_model_data_section(model_data);
109 b->add_header_section(
"cxx_demo_1");
114 std::shared_ptr< adc::builder_api > app_data = f.
get_builder();
116 void *commptr = NULL;
118 MPI_Comm comm = MPI_COMM_WORLD;
123 float x[3] = { 3,2,1 };
124 app_data->add_array(
"direction", x, 3);
125 app_data->add(
"foo", 12);
126 app_data->add(
"bar", 2.5);
127 app_data->add_array(
"direction_set", x, 3,
"set");
128 b->add_app_data_section(app_data);
131 std::shared_ptr< adc::builder_api > progress_details = f.
get_builder();
132 progress_details->add(
"step", 100);
133 b->add_model_data_section(progress_details);
139 b->add_header_section(
"cxx_demo_1");
142 b->add_memory_usage_section();
145 std::shared_ptr< adc::builder_api > app_data = f.
get_builder();
146 void *commptr = NULL;
148 MPI_Comm comm = MPI_COMM_WORLD;
152 app_data->add_gitlab_ci_section();
153 b->add_app_data_section(app_data);
156 std::shared_ptr< adc::builder_api > exit_details = f.
get_builder();
157 exit_details->add(
"tmax", 15000.25);
158 exit_details->add(
"tmax_loc", 10325);
159 exit_details->add(
"step", 234);
160 b->add_exit_data_section(1,
"we didn't succeed due to high temperatures", exit_details);
165int main(
int argc,
char **argv)
167 MPI_Init(&argc, &argv);
177 std::shared_ptr< adc::publisher_api > p = f.
get_publisher(
"stdout");
180 std::shared_ptr< adc::publisher_api > p = f.
get_publisher(
"ldmsd_stream_publish");
184 std::cout <<
"DUMP initial config of model, hardware, etc" << std::endl;
186 std::shared_ptr< adc::builder_api > b_init = f.
get_builder();
188 int msg_err = p->publish(b_init);
190 std::cout <<
"publish initial model info failed " <<
191 std::strerror(msg_err) << std::endl;
198 std::cout <<
"DUMP some progress" << std::endl;
202 std::shared_ptr< adc::builder_api > b_progress = f.
get_builder();
204 int msg_err = p->publish(b_progress);
206 std::cout <<
"publish progress info failed " <<
207 std::strerror(msg_err) << std::endl;
212 std::cout <<
"DUMP result" << std::endl;
215 std::shared_ptr< adc::builder_api > b_final = f.
get_builder();
217 int msg_err = p->publish(b_final);
219 std::cout <<
"publish final status info failed " <<
220 std::strerror(msg_err) << std::endl;
provides publishers and builders of application metadata.
std::shared_ptr< publisher_api > get_publisher(const std::string &name)
std::shared_ptr< builder_api > get_builder()
#define ADC_HS_BASE
ADC_HS_BASE collects just the hostname via gethostname()
#define ADC_HS_ALL
all ADC_HS_* optional data included
#define ADC_MPI_RANK
include "mpi_rank" field from mpi_comm_rank
#define ADC_MPI_ALL
include all mpi options. If this value is used, then the call to add_mpi must be collective.
#define ADC_MPI_SIZE
include "mpi_size" field from mpi_comm_size
void populate_start(std::shared_ptr< adc::builder_api > b, adc::factory &f)
int start_publisher(std::shared_ptr< adc::publisher_api > pi, std::map< std::string, std::string > &pconfig)
void populate_progress(std::shared_ptr< adc::builder_api > b, adc::factory &f)
void populate_end(std::shared_ptr< adc::builder_api > b, adc::factory &f)
std::map< std::string, std::string > ldmsd_stream_publish_config
std::map< std::string, std::string > file_config
std::map< std::string, std::string > null_config