MCPcopy Create free account
hub / github.com/dmlc/parameter_server / read

Method read

src/data/slot_reader.cc:31–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31int SlotReader::read(ExampleInfo* info) {
32 CHECK_GT(FLAGS_num_threads, 0);
33 {
34 Lock l(mu_);
35 loaded_file_count_ = 0;
36 num_ex_.resize(data_.file_size());
37 }
38 {
39 if (FLAGS_verbose) {
40 for (size_t i = 0; i < data_.file_size(); ++i) {
41 LI << "I will load data file [" << i + 1 << "/" <<
42 data_.file_size() << "] [" << data_.file(i) << "]";
43 }
44 }
45
46 ThreadPool pool(FLAGS_num_threads);
47 for (int i = 0; i < data_.file_size(); ++i) {
48 auto one_file = ithFile(data_, i);
49 pool.add([this, one_file, i](){ readOneFile(one_file, i); });
50 }
51 pool.startWorkers();
52 }
53 if (info) *info = info_;
54 for (int i = 0; i < info_.slot_size(); ++i) {
55 slot_info_[info_.slot(i).id()] = info_.slot(i);
56 }
57 return 0;
58}
59
60bool SlotReader::readOneFile(const DataConfig& data, int ith_file) {
61 if (FLAGS_verbose) {

Callers

nothing calls this directly

Calls 7

ithFileFunction · 0.85
file_sizeMethod · 0.80
startWorkersMethod · 0.80
slot_sizeMethod · 0.80
resizeMethod · 0.45
addMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected