Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
d0a04757
P
Paddle
项目概览
机器未来
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d0a04757
编写于
1月 24, 2018
作者:
Y
Yang Yu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename is_compile_gpu to is_compiled_with_cuda
The English of the previous API is bad.
上级
bac401cd
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
19 addition
and
18 deletion
+19
-18
paddle/pybind/pybind.cc
paddle/pybind/pybind.cc
+2
-2
python/paddle/v2/fluid/__init__.py
python/paddle/v2/fluid/__init__.py
+1
-1
python/paddle/v2/fluid/tests/op_test.py
python/paddle/v2/fluid/tests/op_test.py
+2
-2
python/paddle/v2/fluid/tests/test_adagrad_op.py
python/paddle/v2/fluid/tests/test_adagrad_op.py
+1
-1
python/paddle/v2/fluid/tests/test_adam_op.py
python/paddle/v2/fluid/tests/test_adam_op.py
+1
-1
python/paddle/v2/fluid/tests/test_batch_norm_op.py
python/paddle/v2/fluid/tests/test_batch_norm_op.py
+1
-1
python/paddle/v2/fluid/tests/test_gaussian_random_op.py
python/paddle/v2/fluid/tests/test_gaussian_random_op.py
+1
-1
python/paddle/v2/fluid/tests/test_normalization_wrapper.py
python/paddle/v2/fluid/tests/test_normalization_wrapper.py
+1
-1
python/paddle/v2/fluid/tests/test_op_support_gpu.py
python/paddle/v2/fluid/tests/test_op_support_gpu.py
+2
-1
python/paddle/v2/fluid/tests/test_parallel_op.py
python/paddle/v2/fluid/tests/test_parallel_op.py
+1
-1
python/paddle/v2/fluid/tests/test_profiler.py
python/paddle/v2/fluid/tests/test_profiler.py
+2
-2
python/paddle/v2/fluid/tests/test_reorder_lod_tensor.py
python/paddle/v2/fluid/tests/test_reorder_lod_tensor.py
+1
-1
python/paddle/v2/fluid/tests/test_sgd_op.py
python/paddle/v2/fluid/tests/test_sgd_op.py
+1
-1
python/paddle/v2/fluid/tests/test_split_selected_rows_op.py
python/paddle/v2/fluid/tests/test_split_selected_rows_op.py
+1
-1
python/paddle/v2/fluid/tests/test_uniform_random_op.py
python/paddle/v2/fluid/tests/test_uniform_random_op.py
+1
-1
未找到文件。
paddle/pybind/pybind.cc
浏览文件 @
d0a04757
...
@@ -53,7 +53,7 @@ static size_t UniqueIntegerGenerator(const std::string &prefix) {
...
@@ -53,7 +53,7 @@ static size_t UniqueIntegerGenerator(const std::string &prefix) {
return
generators
[
prefix
].
fetch_add
(
1
);
return
generators
[
prefix
].
fetch_add
(
1
);
}
}
bool
IsCompile
GPU
()
{
bool
IsCompile
dWithCUDA
()
{
#ifndef PADDLE_WITH_CUDA
#ifndef PADDLE_WITH_CUDA
return
false
;
return
false
;
#else
#else
...
@@ -431,7 +431,7 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -431,7 +431,7 @@ All parameter, weight, gradient are variables in Paddle.
m
.
def
(
"init_glog"
,
framework
::
InitGLOG
);
m
.
def
(
"init_glog"
,
framework
::
InitGLOG
);
m
.
def
(
"init_devices"
,
&
framework
::
InitDevices
);
m
.
def
(
"init_devices"
,
&
framework
::
InitDevices
);
m
.
def
(
"is_compile
_gpu"
,
IsCompileGPU
);
m
.
def
(
"is_compile
d_with_cuda"
,
IsCompiledWithCUDA
);
m
.
def
(
"set_feed_variable"
,
framework
::
SetFeedVariable
);
m
.
def
(
"set_feed_variable"
,
framework
::
SetFeedVariable
);
m
.
def
(
"get_fetch_variable"
,
framework
::
GetFetchVariable
);
m
.
def
(
"get_fetch_variable"
,
framework
::
GetFetchVariable
);
...
...
python/paddle/v2/fluid/__init__.py
浏览文件 @
d0a04757
...
@@ -89,7 +89,7 @@ def __bootstrap__():
...
@@ -89,7 +89,7 @@ def __bootstrap__():
read_env_flags
=
[
read_env_flags
=
[
'use_pinned_memory'
,
'check_nan_inf'
,
'do_memory_benchmark'
'use_pinned_memory'
,
'check_nan_inf'
,
'do_memory_benchmark'
]
]
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
read_env_flags
+=
[
'fraction_of_gpu_memory_to_use'
,
'op_sync'
]
read_env_flags
+=
[
'fraction_of_gpu_memory_to_use'
,
'op_sync'
]
core
.
init_gflags
([
sys
.
argv
[
0
]]
+
core
.
init_gflags
([
sys
.
argv
[
0
]]
+
[
"--tryfromenv="
+
","
.
join
(
read_env_flags
)])
[
"--tryfromenv="
+
","
.
join
(
read_env_flags
)])
...
...
python/paddle/v2/fluid/tests/op_test.py
浏览文件 @
d0a04757
...
@@ -334,7 +334,7 @@ class OpTest(unittest.TestCase):
...
@@ -334,7 +334,7 @@ class OpTest(unittest.TestCase):
def
check_output
(
self
,
atol
=
1e-5
):
def
check_output
(
self
,
atol
=
1e-5
):
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
()
and
core
.
op_support_gpu
(
self
.
op_type
):
if
core
.
is_compile
d_with_cuda
()
and
core
.
op_support_gpu
(
self
.
op_type
):
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
self
.
check_output_with_place
(
place
,
atol
)
self
.
check_output_with_place
(
place
,
atol
)
...
@@ -367,7 +367,7 @@ class OpTest(unittest.TestCase):
...
@@ -367,7 +367,7 @@ class OpTest(unittest.TestCase):
max_relative_error
=
0.005
,
max_relative_error
=
0.005
,
user_defined_grads
=
None
):
user_defined_grads
=
None
):
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
()
and
core
.
op_support_gpu
(
self
.
op_type
):
if
core
.
is_compile
d_with_cuda
()
and
core
.
op_support_gpu
(
self
.
op_type
):
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
self
.
check_grad_with_place
(
place
,
inputs_to_check
,
output_names
,
self
.
check_grad_with_place
(
place
,
inputs_to_check
,
output_names
,
...
...
python/paddle/v2/fluid/tests/test_adagrad_op.py
浏览文件 @
d0a04757
...
@@ -180,7 +180,7 @@ class TestSparseAdagradOp(unittest.TestCase):
...
@@ -180,7 +180,7 @@ class TestSparseAdagradOp(unittest.TestCase):
def
test_sparse_adagrad
(
self
):
def
test_sparse_adagrad
(
self
):
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
self
.
check_with_place
(
place
)
self
.
check_with_place
(
place
)
...
...
python/paddle/v2/fluid/tests/test_adam_op.py
浏览文件 @
d0a04757
...
@@ -305,7 +305,7 @@ class TestSparseAdamOp(unittest.TestCase):
...
@@ -305,7 +305,7 @@ class TestSparseAdamOp(unittest.TestCase):
def
test_sparse_sgd
(
self
):
def
test_sparse_sgd
(
self
):
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
self
.
check_with_place
(
place
)
self
.
check_with_place
(
place
)
...
...
python/paddle/v2/fluid/tests/test_batch_norm_op.py
浏览文件 @
d0a04757
...
@@ -352,7 +352,7 @@ class TestBatchNormOp(OpTest):
...
@@ -352,7 +352,7 @@ class TestBatchNormOp(OpTest):
print
"op test backward passed: "
,
str
(
place
),
data_layout
print
"op test backward passed: "
,
str
(
place
),
data_layout
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
()
and
core
.
op_support_gpu
(
"batch_norm"
):
if
core
.
is_compile
d_with_cuda
()
and
core
.
op_support_gpu
(
"batch_norm"
):
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
...
...
python/paddle/v2/fluid/tests/test_gaussian_random_op.py
浏览文件 @
d0a04757
...
@@ -33,7 +33,7 @@ class TestGaussianRandomOp(unittest.TestCase):
...
@@ -33,7 +33,7 @@ class TestGaussianRandomOp(unittest.TestCase):
self
.
gaussian_random_test
(
place
=
fluid
.
CPUPlace
())
self
.
gaussian_random_test
(
place
=
fluid
.
CPUPlace
())
def
test_gpu
(
self
):
def
test_gpu
(
self
):
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
self
.
gaussian_random_test
(
place
=
fluid
.
CUDAPlace
(
0
))
self
.
gaussian_random_test
(
place
=
fluid
.
CUDAPlace
(
0
))
def
gaussian_random_test
(
self
,
place
):
def
gaussian_random_test
(
self
,
place
):
...
...
python/paddle/v2/fluid/tests/test_normalization_wrapper.py
浏览文件 @
d0a04757
...
@@ -46,7 +46,7 @@ class TestNormalization(unittest.TestCase):
...
@@ -46,7 +46,7 @@ class TestNormalization(unittest.TestCase):
"""Run the test program.
"""Run the test program.
"""
"""
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
...
...
python/paddle/v2/fluid/tests/test_op_support_gpu.py
浏览文件 @
d0a04757
...
@@ -18,7 +18,8 @@ import paddle.v2.fluid.core as core
...
@@ -18,7 +18,8 @@ import paddle.v2.fluid.core as core
class
TestOpSupportGPU
(
unittest
.
TestCase
):
class
TestOpSupportGPU
(
unittest
.
TestCase
):
def
test_case
(
self
):
def
test_case
(
self
):
self
.
assertEqual
(
core
.
is_compile_gpu
(),
core
.
op_support_gpu
(
"sum"
))
self
.
assertEqual
(
core
.
is_compiled_with_cuda
(),
core
.
op_support_gpu
(
"sum"
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
python/paddle/v2/fluid/tests/test_parallel_op.py
浏览文件 @
d0a04757
...
@@ -53,7 +53,7 @@ class BaseParallelForTest(unittest.TestCase):
...
@@ -53,7 +53,7 @@ class BaseParallelForTest(unittest.TestCase):
fetch
=
fetch
,
fetch
=
fetch
,
place
=
cpu
,
place
=
cpu
,
use_parallel
=
True
)
use_parallel
=
True
)
if
fluid
.
core
.
is_compile
_gpu
():
if
fluid
.
core
.
is_compile
d_with_cuda
():
gpu
=
fluid
.
CUDAPlace
(
0
)
gpu
=
fluid
.
CUDAPlace
(
0
)
result_gpu
=
self
.
_run_test_impl_
(
result_gpu
=
self
.
_run_test_impl_
(
callback
=
callback
,
callback
=
callback
,
...
...
python/paddle/v2/fluid/tests/test_profiler.py
浏览文件 @
d0a04757
...
@@ -23,7 +23,7 @@ import paddle.v2.fluid.core as core
...
@@ -23,7 +23,7 @@ import paddle.v2.fluid.core as core
class
TestProfiler
(
unittest
.
TestCase
):
class
TestProfiler
(
unittest
.
TestCase
):
def
test_nvprof
(
self
):
def
test_nvprof
(
self
):
if
not
fluid
.
core
.
is_compile
_gpu
():
if
not
fluid
.
core
.
is_compile
d_with_cuda
():
return
return
epoc
=
8
epoc
=
8
dshape
=
[
4
,
3
,
28
,
28
]
dshape
=
[
4
,
3
,
28
,
28
]
...
@@ -42,7 +42,7 @@ class TestProfiler(unittest.TestCase):
...
@@ -42,7 +42,7 @@ class TestProfiler(unittest.TestCase):
os
.
remove
(
output_file
)
os
.
remove
(
output_file
)
def
net_profiler
(
self
,
state
):
def
net_profiler
(
self
,
state
):
if
state
==
'GPU'
and
not
core
.
is_compile
_gpu
():
if
state
==
'GPU'
and
not
core
.
is_compile
d_with_cuda
():
return
return
startup_program
=
fluid
.
Program
()
startup_program
=
fluid
.
Program
()
main_program
=
fluid
.
Program
()
main_program
=
fluid
.
Program
()
...
...
python/paddle/v2/fluid/tests/test_reorder_lod_tensor.py
浏览文件 @
d0a04757
...
@@ -45,7 +45,7 @@ class TestReorderLoDTensor(unittest.TestCase):
...
@@ -45,7 +45,7 @@ class TestReorderLoDTensor(unittest.TestCase):
outputs
=
[]
outputs
=
[]
input_grads
=
[]
input_grads
=
[]
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
self
.
set_inputs
(
place
)
self
.
set_inputs
(
place
)
...
...
python/paddle/v2/fluid/tests/test_sgd_op.py
浏览文件 @
d0a04757
...
@@ -91,7 +91,7 @@ class TestSparseSGDOp(unittest.TestCase):
...
@@ -91,7 +91,7 @@ class TestSparseSGDOp(unittest.TestCase):
def
test_sparse_sgd
(
self
):
def
test_sparse_sgd
(
self
):
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
for
place
in
places
:
for
place
in
places
:
self
.
check_with_place
(
place
)
self
.
check_with_place
(
place
)
...
...
python/paddle/v2/fluid/tests/test_split_selected_rows_op.py
浏览文件 @
d0a04757
...
@@ -21,7 +21,7 @@ from paddle.v2.fluid.op import Operator
...
@@ -21,7 +21,7 @@ from paddle.v2.fluid.op import Operator
class
TestSpliteSelectedRows
(
unittest
.
TestCase
):
class
TestSpliteSelectedRows
(
unittest
.
TestCase
):
def
get_places
(
self
):
def
get_places
(
self
):
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
places
.
append
(
core
.
CUDAPlace
(
0
))
places
.
append
(
core
.
CUDAPlace
(
0
))
return
places
return
places
...
...
python/paddle/v2/fluid/tests/test_uniform_random_op.py
浏览文件 @
d0a04757
...
@@ -36,7 +36,7 @@ class TestUniformRandomOp(unittest.TestCase):
...
@@ -36,7 +36,7 @@ class TestUniformRandomOp(unittest.TestCase):
self
.
uniform_random_test
(
place
=
core
.
CPUPlace
())
self
.
uniform_random_test
(
place
=
core
.
CPUPlace
())
def
test_gpu
(
self
):
def
test_gpu
(
self
):
if
core
.
is_compile
_gpu
():
if
core
.
is_compile
d_with_cuda
():
self
.
uniform_random_test
(
place
=
core
.
CUDAPlace
(
0
))
self
.
uniform_random_test
(
place
=
core
.
CUDAPlace
(
0
))
def
uniform_random_test
(
self
,
place
):
def
uniform_random_test
(
self
,
place
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录