MCPcopy Create free account
hub / github.com/LBANN/lbann / fetch

Method fetch

src/data_readers/data_reader.cpp:86–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86int lbann::generic_data_reader::fetch(std::vector<conduit::Node>& samples,
87 El::Matrix<El::Int>& indices_fetched,
88 El::Int current_position_in_data_set,
89 El::Int sample_stride,
90 size_t mb_size,
91 const execution_mode mode)
92{
93 // Check to make sure that a valid map was passed
94 if (samples.empty()) {
95 LBANN_ERROR("fetch function called with no valid buffers");
96 }
97
98 // BVE FIXME
99 if (!(current_position_in_data_set < get_num_data()) /*position_valid()*/) {
100 if (current_position_in_data_set >=
101 get_num_data() /*position_is_overrun()*/) {
102 return 0;
103 }
104 else {
105 LBANN_ERROR(
106 std::string{} + "generic data reader load error: !position_valid" +
107 " -- current pos = " + std::to_string(current_position_in_data_set) +
108 " and there are " + std::to_string(m_shuffled_indices.size()) +
109 " indices");
110 }
111 }
112
113 /// Allow each thread to perform any preprocessing necessary on the
114 /// data source prior to fetching data
115 for (int t = 0; t < static_cast<int>(m_io_thread_pool->get_num_threads());
116 t++) {
117 preprocess_data_source(t);
118 }
119
120 // Fetch data is executed by the thread pool so it has to dispatch
121 // work to other threads in the thread pool and do some work locally
122 for (int t = 0; t < static_cast<int>(m_io_thread_pool->get_num_threads());
123 t++) {
124 // Queue up work into other threads and then finish off the
125 // mini-batch in the active thread
126 if (t == m_io_thread_pool->get_local_thread_id()) {
127 continue;
128 }
129 else {
130 m_io_thread_pool->submit_job_to_work_group(
131 std::bind(&generic_data_reader::fetch_data_block_conduit,
132 this,
133 std::ref(samples),
134 current_position_in_data_set,
135 t,
136 m_io_thread_pool->get_num_threads(),
137 sample_stride,
138 mb_size,
139 std::ref(indices_fetched),
140 mode));
141 }
142 }
143 fetch_data_block_conduit(samples,

Calls 12

get_num_threadsMethod · 0.80
get_local_thread_idMethod · 0.80
finish_work_groupMethod · 0.80
HeightMethod · 0.80
WidthMethod · 0.80
am_world_masterMethod · 0.80
endMethod · 0.80
to_stringFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
get_nameMethod · 0.45

Tested by

no test coverage detected