Skip to content

Commit

Permalink
fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
ymjiang committed Nov 18, 2019
1 parent 90406d2 commit a93933b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions byteps/server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,15 @@ void BytePSServerEngineThread(int tid) {
q->WaitAndPop(&msg);
if (msg.ops == TERMINATE) break;
// do some check
CHECK(msg.dst->tensor);
CHECK(msg.src);

bool is_debug = (debug_mode_ && (debug_key_ == msg.key));
switch (msg.ops) {
case ZCOPY_RECV: {
if (is_debug) {
std::lock_guard<std::mutex> lock(debug_mu_);
LOG(INFO) << "stage: ENGINE_ZEROCOPY_RECV_BEFORE \t"
<< "dst: " << DEBUG_PRINT_TENSOR_VALUE(msg.dst->tensor) << "\t"
<< "src: " << DEBUG_PRINT_TENSOR_VALUE(msg.src) << "\t"
<< "dst_addr: " << DEBUG_PRINT_TENSOR_ADDRESS(msg.dst->tensor) << "\t"
<< "src_addr: " << DEBUG_PRINT_TENSOR_ADDRESS(msg.src) << "\t";
}
// zero copy, just hold the sarray ptr of the first recv
// will auto release at the next iteration
msg.dst->tensor = (char*) msg.src;
msg.dst->sarray = msg.sarray;

if (is_debug) {
std::lock_guard<std::mutex> lock(debug_mu_);
LOG(INFO) << "stage: ENGINE_ZEROCOPY_RECV_AFTER \t"
Expand All @@ -98,6 +88,7 @@ void BytePSServerEngineThread(int tid) {
break;
}
case COPY_MERGED: {
CHECK(msg.dst->tensor);
if (is_debug) {
std::lock_guard<std::mutex> lock(debug_mu_);
LOG(INFO) << "stage: ENGINE_COPY_MERGED_TO_STORE_BEFORE \t"
Expand Down Expand Up @@ -133,6 +124,7 @@ void BytePSServerEngineThread(int tid) {
break;
}
case SUM_RECV: {
CHECK(msg.dst->tensor);
auto bps_type = bps_reducer_->GetDataType(msg.type.dtype);
if (is_debug) {
std::lock_guard<std::mutex> lock(debug_mu_);
Expand Down

0 comments on commit a93933b

Please sign in to comment.