Skip to content

Commit

Permalink
clean up old Append and rename new AppendStruct
Browse files Browse the repository at this point in the history
  • Loading branch information
junzhezhang committed Jan 20, 2019
1 parent ec378e4 commit 6fae4e6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions include/singa/core/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Device {
int id() const { return id_; }

virtual void* UpdateGpuPtr(const Block* block_ptr) = 0;
virtual void AppendStruct(DeviceOptInfoToAppend dev_opt_info) = 0;
virtual void Append(DeviceOptInfoToAppend dev_opt_info) = 0;
private:
Device() {};

Expand Down Expand Up @@ -153,7 +153,7 @@ class CppCPU : public Device {

std::shared_ptr<Device> host() const override { return defaultDevice;}
void SetRandSeed(unsigned seed) override;
void AppendStruct(DeviceOptInfoToAppend dev_opt_info) override {}
void Append(DeviceOptInfoToAppend dev_opt_info) override {}

protected:
void DoExec(function<void(Context*)>&& fn, int executor) override;
Expand Down Expand Up @@ -188,7 +188,7 @@ class CudaGPU : public Device {

void SetRandSeed(unsigned seed) override;
size_t GetAllocatedMem() override;
void AppendStruct(DeviceOptInfoToAppend dev_opt_info) override {}
void Append(DeviceOptInfoToAppend dev_opt_info) override {}


protected:
Expand Down Expand Up @@ -286,7 +286,7 @@ class SwapGPU : public Device {
void SetRandSeed(unsigned seed) override;
size_t GetAllocatedMem() override;
//Append at every index: free, read, mutable
void AppendStruct(DeviceOptInfoToAppend dev_opt_info) override;
void Append(DeviceOptInfoToAppend dev_opt_info) override;

protected:
void DoExec(function<void(Context*)>&& fn, int executor) override;
Expand Down Expand Up @@ -408,7 +408,7 @@ class OpenclDevice : public singa::Device {
virtual void CopyDataToFrom(Block* dst, Block* src, size_t nBytes,
CopyDirection direction, int dst_offset = 0,
int src_offset = 0) override;
void AppendStruct(DeviceOptInfoToAppend dev_opt_info) override {}
void Append(DeviceOptInfoToAppend dev_opt_info) override {}
protected:
/// The OpenCL device that this object represents.
/// Each OpenclDevice contains exactly one cl::Device for the lifetime of the
Expand Down
4 changes: 2 additions & 2 deletions src/core/common/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void* Block::mutable_data() {
DeviceOptInfoToAppend dev_opt_info("Mutable", temp_str,size());
auto t = (std::chrono::system_clock::now()).time_since_epoch().count();
dev_opt_info.t = t;
ptr_device_->AppendStruct(dev_opt_info);
ptr_device_->Append(dev_opt_info);
}

//update ptr after swap in done, if variable is not swapped back yet as expected.
Expand All @@ -60,7 +60,7 @@ const void* Block::data() const {
DeviceOptInfoToAppend dev_opt_info("Read", temp_str,size());
auto t = (std::chrono::system_clock::now()).time_since_epoch().count();
dev_opt_info.t = t;
ptr_device_->AppendStruct(dev_opt_info);
ptr_device_->Append(dev_opt_info);
}

//update ptr after swap in done, if variable is not swapped back yet as expected.
Expand Down
2 changes: 1 addition & 1 deletion src/core/device/device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void Device::FreeBlock(Block* block) {
DeviceOptInfoToAppend dev_opt_info("Free", temp_str,block->size());
auto t = (std::chrono::system_clock::now()).time_since_epoch().count();
dev_opt_info.t = t;
AppendStruct(dev_opt_info);
Append(dev_opt_info);

delete block;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/device/swap_gpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ void SwapGPU::AppendAfterMalloc(Block* block_ptr,void* data_ptr,int size){
DeviceOptInfoToAppend dev_opt_info("Malloc", temp_str,size);
auto t = (std::chrono::system_clock::now()).time_since_epoch().count();
dev_opt_info.t = t;
AppendStruct(dev_opt_info);
Append(dev_opt_info);

}

Expand Down Expand Up @@ -989,7 +989,7 @@ void SwapGPU::DeploySwapExec(int r_global_index){
}
}

void SwapGPU::AppendStruct(DeviceOptInfoToAppend dev_opt_info){
void SwapGPU::Append(DeviceOptInfoToAppend dev_opt_info){

//convert block_ptr from string to Block*
void* temp_ptr;
Expand Down

0 comments on commit 6fae4e6

Please sign in to comment.