Skip to content

Do not invoke GPU method when use_gpu=false#4138

Merged
wangkuiyi merged 1 commit intoPaddlePaddle:developfrom
reyoung:feature/do_not_invoke_gpu_method_when_use_gpu_off
Sep 16, 2017
Merged

Do not invoke GPU method when use_gpu=false#4138
wangkuiyi merged 1 commit intoPaddlePaddle:developfrom
reyoung:feature/do_not_invoke_gpu_method_when_use_gpu_off

Conversation

@reyoung
Copy link
Collaborator

@reyoung reyoung commented Sep 16, 2017

No description provided.

@reyoung reyoung requested a review from Superjomn September 16, 2017 01:54

{
AsyncGpuBlock asyncGpuBlock;
std::unique_ptr<AsyncGpuBlock> asyncBlock;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems no other place use this Block? ? ?.
I am really confusing about Paddle's init logic, almost a black box to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that is very amazing C++ technic which called RAII.

It just creates some resource when the constructor is invoked, and release them when the deconstructor is invoked. It is something similar with with keyword in Python.

It is widely used in std library, such as unique_ptr, lock_guard, shared_ptr, etc.

More details, please refer that wiki page

@wangkuiyi wangkuiyi merged commit 0b373f8 into PaddlePaddle:develop Sep 16, 2017
@reyoung reyoung deleted the feature/do_not_invoke_gpu_method_when_use_gpu_off branch October 2, 2017 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants