The rules for caliper: - If CALI_CONFIG is set and nonempty, initialize caliper but ignore "--caliper_config". - if "--caliper", setup with "--caliper_config". - Otherwise, do nothing.
| 220 | // - if "--caliper", setup with "--caliper_config". |
| 221 | // - Otherwise, do nothing. |
| 222 | void lbann::initialize_caliper() |
| 223 | { |
| 224 | auto const& arg_parser = global_argument_parser(); |
| 225 | bool const cali_config_from_env = check_env_set_and_nonempty("CALI_CONFIG"); |
| 226 | bool const use_caliper = |
| 227 | cali_config_from_env || arg_parser.get<bool>(LBANN_OPTION_USE_CALIPER); |
| 228 | |
| 229 | if (!use_caliper) |
| 230 | return; |
| 231 | |
| 232 | if (caliper_initialized) { |
| 233 | LBANN_ERROR("Cannot reinitialize Caliper"); |
| 234 | } |
| 235 | do_adiak_init(); |
| 236 | |
| 237 | if (!cali_config_from_env) { |
| 238 | auto const config = |
| 239 | arg_parser.get<std::string>(LBANN_OPTION_CALIPER_CONFIG).c_str(); |
| 240 | cali_mgr.add(config); |
| 241 | if (cali_mgr.error()) { |
| 242 | LBANN_ERROR("Caliper config parse error: ", cali_mgr.error_msg()); |
| 243 | } |
| 244 | } |
| 245 | cali_mgr.start(); |
| 246 | caliper_initialized = true; |
| 247 | } |
| 248 | |
| 249 | void lbann::finalize_caliper() |
| 250 | { |
nothing calls this directly
no test coverage detected