| 50 | } |
| 51 | |
| 52 | struct BenchParams |
| 53 | { |
| 54 | BenchType type{HELP}; |
| 55 | std::string field_file_name{""}; |
| 56 | std::vector<std::string> samples_file_names; |
| 57 | // std::string out_file_name {""}; |
| 58 | |
| 59 | unsigned int num_threads{0}; |
| 60 | |
| 61 | PGL_DEVICE_TYPE device_type{PGL_DEVICE_TYPE_NONE}; |
| 62 | |
| 63 | bool validate() |
| 64 | { |
| 65 | bool valid = true; |
| 66 | |
| 67 | switch (type) |
| 68 | { |
| 69 | case HELP: |
| 70 | break; |
| 71 | |
| 72 | case INIT_FIELD: |
| 73 | if(field_file_name == ""/* || |
| 74 | !file_exists(field_file_name)*/) |
| 75 | { |
| 76 | std::cout << "ERROR: Field output file not set." << std::endl; |
| 77 | valid = false; |
| 78 | } |
| 79 | if(samples_file_names.size() == 0 /*|| |
| 80 | !file_exists(samples_file_name)*/) |
| 81 | { |
| 82 | std::cout << "ERROR: Samples file not set" << std::endl; |
| 83 | valid = false; |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | for (int i = 0; i < samples_file_names.size(); i++) |
| 88 | { |
| 89 | if (!file_exists(samples_file_names[i])) |
| 90 | { |
| 91 | std::cout << "ERROR: Samples file does not exists: " << samples_file_names[i] << std::endl; |
| 92 | valid = false; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | if (device_type == PGL_DEVICE_TYPE_NONE) |
| 97 | { |
| 98 | std::cout << "ERROR: Device type not set." << std::endl; |
| 99 | valid = false; |
| 100 | } |
| 101 | |
| 102 | break; |
| 103 | |
| 104 | case BENCH_LOOKUP_SAMPLE: |
| 105 | case BENCH_LOOKUP: |
| 106 | if (field_file_name == "" || !file_exists(field_file_name)) |
| 107 | { |
| 108 | std::cout << "ERROR: Field file not set or does not exists: " << field_file_name << std::endl; |
| 109 | valid = false; |
nothing calls this directly
no outgoing calls
no test coverage detected