4 #ifndef DP3_BASE_IDG_CONFIGURATION_H_
5 #define DP3_BASE_IDG_CONFIGURATION_H_
9 #include <boost/algorithm/string.hpp>
10 #include <boost/program_options.hpp>
16 static void Read(idg::api::Type& proxyType,
int& bufferSize,
17 idg::api::options_type& options) {
18 namespace po = boost::program_options;
19 po::options_description desc(
"Options");
20 desc.add_options()(
"proxy",
"idg proxy")(
21 "max_nr_w_layers", po::value<int>(),
"")(
"buffersize", po::value<int>(),
25 std::ifstream ifs(
"idg.conf");
30 po::store(po::parse_config_file(ifs, desc), vm);
31 }
catch (po::error&) {
34 if (vm.count(
"proxy")) {
35 std::string proxy(vm[
"proxy"].as<std::string>());
36 boost::to_lower(proxy);
37 if (proxy ==
"cpu-optimized") proxyType = idg::api::Type::CPU_OPTIMIZED;
38 if (proxy ==
"cpu-reference") proxyType = idg::api::Type::CPU_REFERENCE;
39 if (proxy ==
"cuda-generic") proxyType = idg::api::Type::CUDA_GENERIC;
40 if (proxy ==
"hybrid-cuda-cpu-optimized")
41 proxyType = idg::api::Type::HYBRID_CUDA_CPU_OPTIMIZED;
43 if (vm.count(
"buffersize")) {
44 bufferSize = vm[
"buffersize"].as<
int>();
46 if (vm.count(
"max_nr_w_layers")) {
47 options[
"max_nr_w_layers"] = vm[
"max_nr_w_layers"].as<
int>();
Definition: IDGConfiguration.h:14
static void Read(idg::api::Type &proxyType, int &bufferSize, idg::api::options_type &options)
Definition: IDGConfiguration.h:16