Skip to content

Commit 15fe5bc

Browse files
notify_all instead of notify_one. Use all devices
1 parent 1d83c0b commit 15fe5bc

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/zm_mx_accl.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bool MxAccl::setup(
8585
// Load and launch module_
8686
Debug(1, "MxAccl: Loading model %s", model_file.c_str());
8787

88-
std::vector<int> device_ids = {0};
88+
std::vector<int> device_ids = {-1};
8989
std::array<bool, 2> use_model_shape = {false, false};
9090

9191
std::string model_file_lower = model_file;
@@ -224,20 +224,16 @@ int MxAccl::send_frame(MxAccl::Job *job, AVFrame *avframe) {
224224

225225
job->m_width_rescale = ((float)input_width / (float)avframe->width);
226226
job->m_height_rescale = ((float)input_height / (float)avframe->height);
227-
Debug(1, "Locking");
228227
job->lock();
229228
{
230229
std::lock_guard<std::mutex> lck(mutex_);
231-
Debug(1, "Have Locking");
232230
send_queue.push_back(job);
233231
condition_.notify_all();
234232
}
235-
Debug(1, "Waiting for inference");
236233
job->wait();
237234
endtime = std::chrono::system_clock::now();
238235
Debug(1, "waiting took: %.3f seconds", FPSeconds(endtime - starttime).count());
239236
job->unlock();
240-
Debug(4, "Done Waiting");
241237

242238
endtime = std::chrono::system_clock::now();
243239
if (endtime - starttime > Milliseconds(60)) {
@@ -292,7 +288,7 @@ bool MxAccl::in_callback_func(vector<const MX::Types::FeatureMap *> dst, int cha
292288
Job *job = nullptr;
293289
{
294290
std::unique_lock<std::mutex> lck(mutex_);
295-
while (!send_queue.size() and ! zm_terminate) {
291+
while (!send_queue.size() and !zm_terminate) {
296292
Debug(1, "MxAccl waiting, queue size %zu", send_queue.size());
297293
condition_.wait(lck);
298294
}
@@ -316,13 +312,10 @@ bool MxAccl::in_callback_func(vector<const MX::Types::FeatureMap *> dst, int cha
316312
Debug(1, "in_callback took: %.3f seconds", FPSeconds(endtime - starttime).count());
317313
}
318314
{
319-
Debug(1, "Locking");
320315
std::lock_guard<std::mutex> lck(mutex_);
321-
Debug(1, "Pushing");
322316
receive_queue.push_back(job);
323317
}
324-
Debug(1, "Notifying");
325-
condition_.notify_one();
318+
condition_.notify_all();
326319
return true;
327320
}
328321

0 commit comments

Comments
 (0)