Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
1f5192a2
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1f5192a2
编写于
10月 06, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix executor gpu unittest
上级
39f75a13
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
8 deletion
+19
-8
paddle/framework/executor.cc
paddle/framework/executor.cc
+1
-1
paddle/framework/executor_test.cc
paddle/framework/executor_test.cc
+15
-5
paddle/operators/fetch_op.cu
paddle/operators/fetch_op.cu
+1
-1
paddle/platform/gpu_info.cc
paddle/platform/gpu_info.cc
+2
-1
未找到文件。
paddle/framework/executor.cc
浏览文件 @
1f5192a2
...
...
@@ -30,7 +30,7 @@ Executor::Executor(const std::vector<platform::Place>& places) {
device_contexts_
[
i
]
=
new
platform
::
CPUDeviceContext
(
boost
::
get
<
platform
::
CPUPlace
>
(
places
[
i
]));
}
else
if
(
platform
::
is_gpu_place
(
places
[
i
]))
{
#ifdef PADDLE_WITH_
GPU
#ifdef PADDLE_WITH_
CUDA
device_contexts_
[
i
]
=
new
platform
::
CUDADeviceContext
(
boost
::
get
<
platform
::
GPUPlace
>
(
places
[
i
]));
#else
...
...
paddle/framework/executor_test.cc
浏览文件 @
1f5192a2
...
...
@@ -293,7 +293,7 @@ TEST_F(ExecutorTesterFeed, CPU) {
delete
executor
;
}
#ifdef PADDLE_WITH_
GPU
#ifdef PADDLE_WITH_
CUDA
TEST_F
(
ExecutorTesterRandom
,
GPU
)
{
std
::
vector
<
Place
>
places
;
GPUPlace
gpu_place
(
0
);
...
...
@@ -315,10 +315,20 @@ TEST_F(ExecutorTesterFeed, GPU) {
Executor
*
executor
=
new
Executor
(
places
);
// need to set feed variable before Executor::Run
set_feed_variable
<
float
>
(
inputs_
);
executor
->
Run
(
pdesc_
,
GetScope
());
// 3 mini-batch
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
// need to set feed variable before Executor::Run
std
::
cout
<<
"start mini-batch "
<<
i
<<
std
::
endl
;
set_feed_variable
<
float
>
(
inputs_
);
executor
->
Run
(
pdesc_
,
GetScope
());
std
::
vector
<
std
::
vector
<
float
>>
result
=
get_fetch_variable
<
float
>
();
for
(
auto
&
vec
:
result
)
{
for
(
auto
&
num
:
vec
)
{
std
::
cout
<<
num
<<
" "
;
}
std
::
cout
<<
std
::
endl
;
}
}
delete
executor
;
}
#endif
paddle/operators/fetch_op.cu
浏览文件 @
1f5192a2
...
...
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/operators/fe
ed
_op.h"
#include "paddle/operators/fe
tch
_op.h"
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_GPU_KERNEL
(
fetch
,
ops
::
FetchKernel
<
float
>
);
paddle/platform/gpu_info.cc
浏览文件 @
1f5192a2
...
...
@@ -43,7 +43,8 @@ int GetCurrentDeviceId() {
}
void
SetDeviceId
(
int
id
)
{
PADDLE_ENFORCE
(
id
<
GetDeviceCount
(),
"id must less than GPU count"
);
// TODO(qijun): find a better way to cache the cuda device count
PADDLE_ENFORCE
(
id
<
GetCUDADeviceCount
(),
"id must less than GPU count"
);
PADDLE_ENFORCE
(
cudaSetDevice
(
id
),
"cudaSetDevice failed in paddle::platform::SetDeviceId"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录