From 417b2a4ac7a0eb76ee55ae248227ace204a53384 Mon Sep 17 00:00:00 2001 From: Roger Waleffe Date: Sat, 18 Nov 2023 20:56:01 -0600 Subject: [PATCH] add timing --- src/cpp/src/pipeline/pipeline_gpu.cpp | 44 ++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/cpp/src/pipeline/pipeline_gpu.cpp b/src/cpp/src/pipeline/pipeline_gpu.cpp index fcb23dde..e4e7de96 100644 --- a/src/cpp/src/pipeline/pipeline_gpu.cpp +++ b/src/cpp/src/pipeline/pipeline_gpu.cpp @@ -44,6 +44,8 @@ void updateEvalForBatch(Pipeline* pipeline_, shared_ptr batch) { void RemoteLoadWorker::run() { while (!done_) { while (!paused_) { + Timer t = new Timer(false); + t.start(); // NOTE: this "train" is probably not set correctly all the time shared_ptr batch = std::make_shared(pipeline_->dataloader_->train_); @@ -77,6 +79,8 @@ void RemoteLoadWorker::run() { } else { ((PipelineCPU *)pipeline_)->loaded_batches_->blocking_push(batch); } + t.stop(); + std::cout<<"remote load: "<loaded_batches_->blocking_pop(); + t.stop(); + std::cout<<"remote to block: "<(tup); shared_ptr batch = std::get<1>(tup); if (!popped) { @@ -108,6 +117,8 @@ void RemoteToDeviceWorker::run() { batch->creator_id_ = pipeline_->model_->pg_gloo_->pg->getRank(); batch->remoteTo(pipeline_->model_->pg_gloo_->pg, child, tag); + t.stop(); + std::cout<<"remote to: "<loaded_batches_->blocking_pop(); + t.stop(); + std::cout<<"batch to block: "<(tup); shared_ptr batch = std::get<1>(tup); if (!popped) { @@ -128,6 +144,8 @@ void BatchToDeviceWorker::run() { } batchToDevice(pipeline_, batch); + t.stop(); + std::cout<<"batch to: "<device_loaded_batches_[gpu_id_]->blocking_pop(); + t.stop(); + std::cout<<"compute block: "<(tup); shared_ptr batch = std::get<1>(tup); if (!popped) { @@ -229,6 +252,8 @@ void ComputeWorkerGPU::run() { batch->clear(); } } + t.stop(); + std::cout<<"compute: "<device_update_batches_[gpu_id_]->blocking_pop(); + t.stop(); + std::cout<<"batch to host block: "<(tup); shared_ptr batch = std::get<1>(tup); if (!popped) { @@ -285,6 +315,8 @@ void BatchToHostWorker::run() { } ((PipelineGPU *)pipeline_)->update_batches_->blocking_push(batch); + t.stop(); + std::cout<<"batch to host: "<update_batches_->blocking_pop(); + t.stop(); + std::cout<<"remote to host block: "<(tup); shared_ptr batch = std::get<1>(tup); if (!popped) { @@ -330,7 +367,8 @@ void RemoteToHostWorker::run() { lock.unlock(); batch->remoteTo(pipeline_->model_->pg_gloo_->pg, parent, tag); - + t.stop(); + std::cout<<"remote to host: "< batch = std::make_shared(pipeline_->dataloader_->train_); @@ -370,6 +410,8 @@ void RemoteListenForUpdatesWorker::run() { batch->remoteReceive(pipeline_->model_->pg_gloo_->pg, child, tag); ((PipelineGPU *)pipeline_)->update_batches_->blocking_push(batch); + t.stop(); + std::cout<<"remote listen: "<