27 #ifndef LBANN_PROTO_PROTO_COMMON_HPP_INCLUDED 28 #define LBANN_PROTO_PROTO_COMMON_HPP_INCLUDED 32 #define LBANN_ASSERT_MSG_HAS_FIELD(MSG, FIELD) \ 34 if (!MSG.has_##FIELD()) { \ 35 LBANN_ERROR("No field \"" #FIELD "\" in the given message:\n{\n", \ 62 ::lbann_data::LbannPB& p);
69 const ::lbann_data::LbannPB& p,
70 std::map<execution_mode, generic_data_reader*>& data_readers);
80 ::lbann_data::LbannPB& p,
81 std::vector<int>& root_random_seeds,
82 std::vector<int>& random_seeds,
83 std::vector<int>& data_seq_random_seeds);
89 ::lbann_data::LbannPB& p);
93 ::lbann_data::LbannPB& pb,
98 lbann_data::LbannPB& pb,
105 std::string
trim(std::string
const& str);
110 template <
typename T>
113 #ifdef LBANN_HAS_GPU_FP16 115 typename std::conditional<std::is_same<T, fp16>::value, float, T>::type;
121 std::istringstream iss(str);
124 list.emplace_back(std::move(entry));
129 template <
typename T>
132 #ifdef LBANN_HAS_GPU_FP16 134 typename std::conditional<std::is_same<T, fp16>::value, float, T>::type;
140 std::istringstream iss(str);
143 set.emplace(std::move(entry));
158 template <
typename T = std::
string>
161 auto trim_str =
trim(str);
163 return details::parse_list_impl<T>(trim_str);
168 template <
typename T = std::
string>
171 auto trim_str =
trim(str);
173 return details::parse_set_impl<T>(trim_str);
179 #endif // LBANN_PROTO_PROTO_COMMON_HPP_INCLUDED std::set< T > parse_set(std::string const &str)
Parse a space-separated set.
std::set< T > parse_set_impl(std::string const &str)
std::vector< T > parse_list_impl(std::string const &str)
void save_session(const lbann_comm &comm, const int argc, char *const *argv, ::lbann_data::LbannPB &p)
prints prototext file, cmd line, etc to file
void get_cmdline_overrides(const lbann_comm &comm, ::lbann_data::LbannPB &p)
adjusts the values in p by querying the options db
void customize_data_readers_sample_list(const lbann_comm &comm, ::lbann_data::LbannPB &p)
Customize the name of the sample list.
void read_prototext_string(const std::string &contents, lbann_data::LbannPB &pb, const bool master)
Read prototext from a string into a protobuf message.
std::string trim(std::string const &str)
Trim leading and trailing whitespace from a string.
void print_parameters(const lbann_comm &comm, ::lbann_data::LbannPB &p, std::vector< int > &root_random_seeds, std::vector< int > &random_seeds, std::vector< int > &data_seq_random_seeds)
print various params (learn_rate, etc) to cout
bool write_prototext_file(const std::string &fn, ::lbann_data::LbannPB &pb)
Write a protobuf message into a prototext file.
void read_prototext_file(const std::string &fn, ::lbann_data::LbannPB &pb, const bool master)
Read prototext from a file into a protobuf message.
void init_data_readers(lbann_comm *comm, const ::lbann_data::LbannPB &p, std::map< execution_mode, generic_data_reader *> &data_readers)
instantiates one or more generic_data_readers and inserts them in &data_readers
void set_num_parallel_readers(const lbann_comm &comm, ::lbann_data::LbannPB &p)
adjusts the number of parallel data readers
std::vector< T > parse_list(std::string const &str)
Parse a space-separated list.