MCPcopy Create free account
hub / github.com/apache/singa / wait

Method wait

src/io/communicator.cc:169–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void Communicator::wait() {
170 if (!device_) {
171 // just return if it has not been synchronized
172 return;
173 }
174
175 device_->Exec(
176 [this](Context *ctx) mutable {
177 // synchronizing on all the CUDA streams used by communicator
178 CUDA_CHECK(cudaEventRecord(event, ctx->s));
179 CUDA_CHECK(cudaStreamWaitEvent(ctx->stream, event, 0));
180 CUDA_CHECK(cudaEventRecord(event, ctx->c1));
181 CUDA_CHECK(cudaStreamWaitEvent(ctx->stream, event, 0));
182 CUDA_CHECK(cudaEventRecord(event, ctx->c2));
183 CUDA_CHECK(cudaStreamWaitEvent(ctx->stream, event, 0));
184 },
185 blocks_, blocks_, "Waiting");
186}
187
188Communicator::~Communicator() {
189 // finalizing NCCL

Callers 15

test_dist_opt_fp32Method · 0.45
test_dist_opt_fp16Method · 0.45
Cpp>Method · 0.45
CpuConvForwardFunction · 0.45
CpuConvBackwardxFunction · 0.45
CpuConvBackwardWFunction · 0.45

Calls 1

ExecMethod · 0.80

Tested by 6

test_dist_opt_fp32Method · 0.36
test_dist_opt_fp16Method · 0.36