Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
7cc10b2e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7cc10b2e
编写于
2月 21, 2023
作者:
Z
zqw_1997
提交者:
GitHub
2月 21, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove the module: fluid.install_check (#50456)
上级
5f443601
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
1 addition
and
192 deletion
+1
-192
paddle/scripts/installation_validate.py
paddle/scripts/installation_validate.py
+1
-2
python/paddle/fluid/__init__.py
python/paddle/fluid/__init__.py
+0
-2
python/paddle/fluid/install_check.py
python/paddle/fluid/install_check.py
+0
-185
python/paddle/fluid/tests/unittests/test_install_check.py
python/paddle/fluid/tests/unittests/test_install_check.py
+0
-3
未找到文件。
paddle/scripts/installation_validate.py
浏览文件 @
7cc10b2e
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
paddle
as
pd
import
paddle.fluid
as
fluid
fluid
.
install_check
.
run_check
()
pd
.
utils
.
run_check
()
print
(
pd
.
__version__
)
python/paddle/fluid/__init__.py
浏览文件 @
7cc10b2e
...
...
@@ -96,7 +96,6 @@ from .parallel_executor import *
from
.
import
compiler
from
.compiler
import
*
from
paddle.fluid.layers.math_op_patch
import
monkey_patch_variable
from
.
import
install_check
from
.dygraph.layers
import
*
from
.dygraph.base
import
enable_dygraph
,
disable_dygraph
from
.io
import
save
,
load
,
load_program_state
,
set_program_state
...
...
@@ -161,7 +160,6 @@ __all__ = (
'profiler'
,
'unique_name'
,
'Scope'
,
'install_check'
,
'save'
,
'load'
,
'_cuda_synchronize'
,
...
...
python/paddle/fluid/install_check.py
已删除
100644 → 0
浏览文件 @
5f443601
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
import
os
import
paddle
from
.framework
import
(
Program
,
program_guard
,
unique_name
,
cuda_places
,
cpu_places
,
)
from
.param_attr
import
ParamAttr
from
.
import
layers
from
.
import
backward
from
.dygraph
import
Layer
from
.
import
executor
from
.
import
optimizer
from
.
import
core
from
.
import
compiler
import
logging
import
numpy
as
np
__all__
=
[
'run_check'
]
class
SimpleLayer
(
Layer
):
def
__init__
(
self
,
input_size
):
super
().
__init__
()
self
.
_linear1
=
paddle
.
nn
.
Linear
(
input_size
,
3
,
weight_attr
=
ParamAttr
(
initializer
=
paddle
.
nn
.
initializer
.
Constant
(
value
=
0.1
)
),
)
def
forward
(
self
,
inputs
):
x
=
self
.
_linear1
(
inputs
)
x
=
paddle
.
sum
(
x
)
return
x
def
run_check
():
"""To check whether install is successful
This func should not be called only if you need to verify installation
Examples:
.. code-block:: python
import paddle.fluid as fluid
fluid.install_check.run_check()
# If installed successfully, output may be
# Running Verify Fluid Program ...
# W0805 04:24:59.496919 35357 device_context.cc:268] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 10.2, Runtime API Version: 10.1
# W0805 04:24:59.505594 35357 device_context.cc:276] device: 0, cuDNN Version: 7.6.
# Your Paddle Fluid works well on SINGLE GPU or CPU.
# Your Paddle Fluid works well on MUTIPLE GPU or CPU.
# Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now
"""
paddle
.
enable_static
()
print
(
"Running Verify Fluid Program ... "
)
device_list
=
[]
if
core
.
is_compiled_with_cuda
():
try
:
core
.
get_cuda_device_count
()
except
Exception
as
e
:
logging
.
warning
(
"You are using GPU version Paddle Fluid, But Your CUDA Device is not set properly"
"
\n
Original Error is {}"
.
format
(
e
)
)
return
0
device_list
=
cuda_places
()
else
:
device_list
=
[
core
.
CPUPlace
(),
core
.
CPUPlace
()]
np_inp_single
=
np
.
array
([[
1.0
,
2.0
],
[
3.0
,
4.0
]],
dtype
=
np
.
float32
)
inp
=
[]
for
i
in
range
(
len
(
device_list
)):
inp
.
append
(
np_inp_single
)
np_inp_muti
=
np
.
array
(
inp
)
np_inp_muti
=
np_inp_muti
.
reshape
(
len
(
device_list
),
2
,
2
)
def
test_parallerl_exe
():
train_prog
=
Program
()
startup_prog
=
Program
()
scope
=
core
.
Scope
()
with
executor
.
scope_guard
(
scope
):
with
program_guard
(
train_prog
,
startup_prog
):
with
unique_name
.
guard
():
build_strategy
=
compiler
.
BuildStrategy
()
build_strategy
.
enable_inplace
=
True
inp
=
paddle
.
static
.
data
(
name
=
"inp"
,
shape
=
[
-
1
,
2
,
2
])
simple_layer
=
SimpleLayer
(
input_size
=
2
)
out
=
simple_layer
(
inp
)
exe
=
executor
.
Executor
(
core
.
CUDAPlace
(
0
)
if
core
.
is_compiled_with_cuda
()
and
(
core
.
get_cuda_device_count
()
>
0
)
else
core
.
CPUPlace
()
)
loss
=
paddle
.
mean
(
out
)
loss
.
persistable
=
True
optimizer
.
SGD
(
learning_rate
=
0.01
).
minimize
(
loss
)
startup_prog
.
random_seed
=
1
compiled_prog
=
compiler
.
CompiledProgram
(
train_prog
).
with_data_parallel
(
build_strategy
=
build_strategy
,
loss_name
=
loss
.
name
,
places
=
device_list
,
)
exe
.
run
(
startup_prog
)
exe
.
run
(
compiled_prog
,
feed
=
{
inp
.
name
:
np_inp_muti
},
fetch_list
=
[
loss
.
name
],
)
def
test_simple_exe
():
train_prog
=
Program
()
startup_prog
=
Program
()
scope
=
core
.
Scope
()
with
executor
.
scope_guard
(
scope
):
with
program_guard
(
train_prog
,
startup_prog
):
with
unique_name
.
guard
():
inp0
=
paddle
.
static
.
data
(
name
=
"inp"
,
shape
=
[
2
,
2
])
simple_layer0
=
SimpleLayer
(
input_size
=
2
)
out0
=
simple_layer0
(
inp0
)
param_grads
=
backward
.
append_backward
(
out0
,
parameter_list
=
[
simple_layer0
.
_linear1
.
weight
.
name
],
)[
0
]
exe0
=
executor
.
Executor
(
core
.
CUDAPlace
(
0
)
if
core
.
is_compiled_with_cuda
()
and
(
core
.
get_cuda_device_count
()
>
0
)
else
core
.
CPUPlace
()
)
exe0
.
run
(
startup_prog
)
exe0
.
run
(
feed
=
{
inp0
.
name
:
np_inp_single
},
fetch_list
=
[
out0
.
name
,
param_grads
[
1
].
name
],
)
test_simple_exe
()
print
(
"Your Paddle Fluid works well on SINGLE GPU or CPU."
)
try
:
test_parallerl_exe
()
print
(
"Your Paddle Fluid works well on MUTIPLE GPU or CPU."
)
print
(
"Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now"
)
except
Exception
as
e
:
logging
.
warning
(
"Your Paddle Fluid has some problem with multiple GPU. This may be caused by:"
"
\n
1. There is only 1 or 0 GPU visible on your Device;"
"
\n
2. No.1 or No.2 GPU or both of them are occupied now"
"
\n
3. Wrong installation of NVIDIA-NCCL2, please follow instruction on https://github.com/NVIDIA/nccl-tests "
"
\n
to test your NCCL, or reinstall it following https://docs.nvidia.com/deeplearning/sdk/nccl-install-guide/index.html"
)
print
(
"
\n
Original Error is: {}"
.
format
(
e
))
print
(
"Your Paddle Fluid is installed successfully ONLY for SINGLE GPU or CPU! "
"
\n
Let's start deep Learning with Paddle Fluid now"
)
paddle
.
disable_static
()
python/paddle/fluid/tests/unittests/test_install_check.py
浏览文件 @
7cc10b2e
...
...
@@ -19,9 +19,6 @@ import paddle
class
TestInstallCheck
(
unittest
.
TestCase
):
def
test_paddle_fluid
(
self
):
paddle
.
fluid
.
install_check
.
run_check
()
def
test_paddle_utils
(
self
):
paddle
.
utils
.
run_check
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录