Skip to content

Commit

Permalink
Destruct scheduler before instances on model destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
kthui committed Jun 28, 2023
1 parent 5adf085 commit 10a0b7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/backend_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ TritonModel::~TritonModel()
// Clear library handles.
ClearHandles();

// Explicitly delete/finalize the scheduler before the model instances.
scheduler_.reset(nullptr);

// Explicitly delete/finalize all model instances before finalizing
// the model itself.
instances_.clear();
Expand Down
12 changes: 5 additions & 7 deletions src/sequence_batch_scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1429,18 +1429,16 @@ DirectSequenceBatch::BatcherThread(const int nice)
#ifndef _WIN32
if (setpriority(PRIO_PROCESS, syscall(SYS_gettid), nice) == 0) {
LOG_VERBOSE(1) << "Starting Direct sequence-batch scheduler thread "
<< model_instance_->Name() << " [" << (size_t)model_instance_
<< "] at nice " << nice << "...";
<< model_instance_->Name() << " at nice " << nice << "...";
} else {
LOG_VERBOSE(1) << "Starting Direct sequence-batch scheduler thread "
<< model_instance_->Name() << " [" << (size_t)model_instance_
<< "] at default nice (requested nice " << nice
<< model_instance_->Name()
<< " at default nice (requested nice " << nice
<< " failed)...";
}
#else
LOG_VERBOSE(1) << "Starting Direct sequence-batch scheduler thread "
<< model_instance_->Name() << " [" << (size_t)model_instance_
<< "] at default nice...";
<< model_instance_->Name() << " at default nice...";
#endif

// For debugging and testing, delay start of thread until queues
Expand Down Expand Up @@ -1742,7 +1740,7 @@ DirectSequenceBatch::BatcherThread(const int nice)
} // end runner loop

LOG_VERBOSE(1) << "Stopping Direct sequence-batch scheduler thread "
<< (size_t)model_instance_ << "...";
<< model_instance_->Name() << "...";
}

OldestSequenceBatch::OldestSequenceBatch(
Expand Down

0 comments on commit 10a0b7f

Please sign in to comment.