Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
4d2a2e75
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看板
提交
4d2a2e75
编写于
5月 17, 2018
作者:
B
baiyfbupt
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/Paddle
into develop
上级
728062a5
d0a62bfc
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
133 addition
and
4319 deletion
+133
-4319
cmake/external/boost.cmake
cmake/external/boost.cmake
+1
-1
cmake/external/eigen.cmake
cmake/external/eigen.cmake
+2
-1
cmake/external/mkldnn.cmake
cmake/external/mkldnn.cmake
+1
-3
cmake/external/mklml.cmake
cmake/external/mklml.cmake
+1
-1
cmake/inference_lib.cmake
cmake/inference_lib.cmake
+8
-0
paddle/fluid/operators/CMakeLists.txt
paddle/fluid/operators/CMakeLists.txt
+7
-5
paddle/scripts/paddle_build.sh
paddle/scripts/paddle_build.sh
+32
-7
paddle/scripts/paddle_docker_build.sh
paddle/scripts/paddle_docker_build.sh
+1
-0
patches/mkldnn.hpp
patches/mkldnn.hpp
+0
-4252
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_conv.py
...-level-api/recognize_digits/test_recognize_digits_conv.py
+12
-12
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_mlp.py
...h-level-api/recognize_digits/test_recognize_digits_mlp.py
+4
-10
python/paddle/fluid/trainer.py
python/paddle/fluid/trainer.py
+63
-26
tools/timeline.py
tools/timeline.py
+1
-1
未找到文件。
cmake/external/boost.cmake
浏览文件 @
4d2a2e75
...
...
@@ -24,7 +24,7 @@ set(BOOST_PROJECT "extern_boost")
# So we use 1.41.0 here.
set
(
BOOST_VER
"1.41.0"
)
set
(
BOOST_TAR
"boost_1_41_0"
)
set
(
BOOST_URL
"http://paddlepaddledeps.
bj
.bcebos.com/
${
BOOST_TAR
}
.tar.gz"
)
set
(
BOOST_URL
"http://paddlepaddledeps.
cdn
.bcebos.com/
${
BOOST_TAR
}
.tar.gz"
)
set
(
BOOST_SOURCES_DIR
${
THIRD_PARTY_PATH
}
/boost
)
set
(
BOOST_DOWNLOAD_DIR
"
${
BOOST_SOURCES_DIR
}
/src/
${
BOOST_PROJECT
}
"
)
set
(
BOOST_INCLUDE_DIR
"
${
BOOST_DOWNLOAD_DIR
}
/
${
BOOST_TAR
}
"
CACHE PATH
"boost include directory."
FORCE
)
...
...
cmake/external/eigen.cmake
浏览文件 @
4d2a2e75
...
...
@@ -21,11 +21,12 @@ else()
ExternalProject_Add
(
extern_eigen3
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/
RLovelett/eigen.git
"
GIT_REPOSITORY
"https://github.com/
eigenteam/eigen-git-mirror
"
# eigen on cuda9.1 missing header of math_funtions.hpp
# https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen
GIT_TAG 917060c364181f33a735dc023818d5a54f60e54c
PREFIX
${
EIGEN_SOURCE_DIR
}
DOWNLOAD_NAME
"eigen"
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
...
...
cmake/external/mkldnn.cmake
浏览文件 @
4d2a2e75
...
...
@@ -53,11 +53,9 @@ ExternalProject_Add(
${
EXTERNAL_PROJECT_LOG_ARGS
}
DEPENDS
${
MKLDNN_DEPENDS
}
GIT_REPOSITORY
"https://github.com/01org/mkl-dnn.git"
GIT_TAG
"
v0.14
"
GIT_TAG
"
db3424ad44901513c03a1ea31ccaacdf633fbe9f
"
PREFIX
${
MKLDNN_SOURCES_DIR
}
UPDATE_COMMAND
""
# Patch MKLDNN to compile with gcc 4.8, the related issue is in intel/mkl-dnn#237.
PATCH_COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
${
CMAKE_CURRENT_SOURCE_DIR
}
/patches/mkldnn.hpp
${
MKLDNN_SOURCES_DIR
}
/src/extern_mkldnn/include/mkldnn.hpp
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
MKLDNN_INSTALL_DIR
}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
CMAKE_ARGS -DMKLROOT=
${
MKLML_ROOT
}
...
...
cmake/external/mklml.cmake
浏览文件 @
4d2a2e75
...
...
@@ -28,7 +28,7 @@ INCLUDE(ExternalProject)
SET
(
MKLML_PROJECT
"extern_mklml"
)
SET
(
MKLML_VER
"mklml_lnx_2018.0.3.20180406"
)
SET
(
MKLML_URL
"http://paddlepaddledeps.
bj
.bcebos.com/
${
MKLML_VER
}
.tgz"
)
SET
(
MKLML_URL
"http://paddlepaddledeps.
cdn
.bcebos.com/
${
MKLML_VER
}
.tgz"
)
SET
(
MKLML_SOURCE_DIR
"
${
THIRD_PARTY_PATH
}
/mklml"
)
SET
(
MKLML_DOWNLOAD_DIR
"
${
MKLML_SOURCE_DIR
}
/src/
${
MKLML_PROJECT
}
"
)
SET
(
MKLML_DST_DIR
"mklml"
)
...
...
cmake/inference_lib.cmake
浏览文件 @
4d2a2e75
...
...
@@ -98,6 +98,14 @@ elseif (WITH_MKLML)
)
endif
()
if
(
WITH_MKLDNN
)
set
(
dst_dir
"
${
CMAKE_INSTALL_PREFIX
}
/third_party/install/mkldnn"
)
copy
(
mkldnn_lib
SRCS
${
MKLDNN_INC_DIR
}
${
MKLDNN_SHARED_LIB
}
DSTS
${
dst_dir
}
${
dst_dir
}
/lib
)
endif
()
if
(
NOT MOBILE_INFERENCE AND NOT RPI
)
set
(
dst_dir
"
${
CMAKE_INSTALL_PREFIX
}
/third_party/install/snappy"
)
copy
(
snappy_lib
...
...
paddle/fluid/operators/CMakeLists.txt
浏览文件 @
4d2a2e75
...
...
@@ -186,11 +186,7 @@ endif()
add_subdirectory
(
detail
)
if
(
WITH_DISTRIBUTE
)
if
(
WITH_GPU
)
op_library
(
gen_nccl_id_op DEPS nccl_common
)
else
()
set
(
DEPS_OPS
${
DEPS_OPS
}
gen_nccl_id_op
)
endif
()
set
(
DISTRIBUTE_DEPS sendrecvop_grpc grpc++_unsecure grpc_unsecure gpr cares zlib protobuf
)
set
(
DISTRIBUTE_COMPILE_FLAGS
"-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor"
)
op_library
(
send_op DEPS
${
DISTRIBUTE_DEPS
}
)
...
...
@@ -208,6 +204,12 @@ if(WITH_DISTRIBUTE)
set_source_files_properties
(
send_recv_op_test.cc PROPERTIES COMPILE_FLAGS
${
DISTRIBUTE_COMPILE_FLAGS
}
)
cc_test
(
test_send_recv SRCS send_recv_op_test.cc DEPS prefetch_op send_op listen_and_serv_op sum_op executor
)
cc_test
(
test_send_nccl_id SRCS test_send_nccl_id.cc DEPS send_op listen_and_serv_op executor
)
if
(
WITH_GPU
)
op_library
(
gen_nccl_id_op DEPS nccl_common sendrecvop_grpc
)
set_source_files_properties
(
gen_nccl_id_op.cc PROPERTIES COMPILE_FLAGS
${
DISTRIBUTE_COMPILE_FLAGS
}
)
else
()
set
(
DEPS_OPS
${
DEPS_OPS
}
gen_nccl_id_op
)
endif
()
else
()
set
(
DEPS_OPS
${
DEPS_OPS
}
send_op prefetch_op recv_op listen_and_serv_op send_vars_op send_barrier_op gen_nccl_id_op
)
endif
()
...
...
paddle/scripts/paddle_build.sh
浏览文件 @
4d2a2e75
...
...
@@ -20,19 +20,15 @@
#=================================================
function
print_usage
()
{
RED
=
'\033[0;31m'
BLUE
=
'\033[0;34m'
BOLD
=
'\033[1m'
NONE
=
'\033[0m'
echo
-e
"
\n
${
RED
}
Usage
${
NONE
}
:
${
BOLD
}
$
0
${
NONE
}
[OPTION]"
${
BOLD
}$
{
SCRIPT_NAME
}
${
NONE
}
[OPTION]"
echo
-e
"
\n
${
RED
}
Options
${
NONE
}
:
${
BLUE
}
build
${
NONE
}
: run build for x86 platform
${
BLUE
}
build_android
${
NONE
}
: run build for android platform
${
BLUE
}
build_ios
${
NONE
}
: run build for ios platform
${
BLUE
}
test
${
NONE
}
: run all unit tests
${
BLUE
}
single_test
${
NONE
}
: run a single unit test
${
BLUE
}
bind_test
${
NONE
}
: parallel tests bind to different GPU
${
BLUE
}
doc
${
NONE
}
: generate paddle documents
${
BLUE
}
html
${
NONE
}
: convert C++ source code into HTML
...
...
@@ -45,7 +41,15 @@ function print_usage() {
}
function
init
()
{
RED
=
'\033[0;31m'
BLUE
=
'\033[0;34m'
BOLD
=
'\033[1m'
NONE
=
'\033[0m'
PADDLE_ROOT
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/../../"
&&
pwd
)
"
if
[
-z
"
${
SCRIPT_NAME
}
"
]
;
then
SCRIPT_NAME
=
$0
fi
}
function
cmake_gen
()
{
...
...
@@ -91,7 +95,6 @@ function cmake_gen() {
-DWITH_AVX=
${
WITH_AVX
:-
OFF
}
-DWITH_GOLANG=
${
WITH_GOLANG
:-
OFF
}
-DCUDA_ARCH_NAME=
${
CUDA_ARCH_NAME
:-
All
}
-DWITH_SWIG_PY=ON
-DWITH_C_API=
${
WITH_C_API
:-
OFF
}
-DWITH_PYTHON=
${
WITH_PYTHON
:-
ON
}
-DWITH_SWIG_PY=
${
WITH_SWIG_PY
:-
ON
}
...
...
@@ -309,6 +312,25 @@ EOF
fi
}
function
single_test
()
{
TEST_NAME
=
$1
if
[
-z
"
${
TEST_NAME
}
"
]
;
then
echo
-e
"
${
RED
}
Usage:
${
NONE
}
"
echo
-e
"
${
BOLD
}${
SCRIPT_NAME
}${
NONE
}
${
BLUE
}
single_test
${
NONE
}
[test_name]"
exit
1
fi
mkdir
-p
${
PADDLE_ROOT
}
/build
cd
${
PADDLE_ROOT
}
/build
if
[
${
WITH_TESTING
:-
ON
}
==
"ON"
]
;
then
cat
<<
EOF
========================================
Running
${
TEST_NAME
}
...
========================================
EOF
ctest
--output-on-failure
-R
${
TEST_NAME
}
fi
}
function
bind_test
()
{
# the number of process to run tests
NUM_PROC
=
6
...
...
@@ -491,6 +513,9 @@ function main() {
test
)
run_test
;;
single_test
)
single_test
$2
;;
bind_test
)
bind_test
;;
...
...
paddle/scripts/paddle_docker_build.sh
浏览文件 @
4d2a2e75
...
...
@@ -63,6 +63,7 @@ EOL
${
DOCKER_CMD
}
run
-it
\
--name
$CONTAINER_ID
\
${
DOCKER_ENV
}
\
-e
SCRIPT_NAME
=
$0
\
-v
$PADDLE_ROOT
:/paddle
\
-v
${
HOME
}
/.ccache:/root/.ccache
\
-w
/paddle
\
...
...
patches/mkldnn.hpp
已删除
100644 → 0
浏览文件 @
728062a5
此差异已折叠。
点击以展开。
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_conv.py
浏览文件 @
4d2a2e75
...
...
@@ -62,31 +62,31 @@ def train(use_cuda, train_program, save_dirname):
optimizer
=
fluid
.
optimizer
.
Adam
(
learning_rate
=
0.001
)
trainer
=
fluid
.
Trainer
(
train_func
=
train_program
,
place
=
place
,
optimizer
=
optimizer
)
train_func
=
train_program
,
place
=
place
,
optimizer
=
optimizer
,
parallel
=
True
)
def
event_handler
(
event
):
if
isinstance
(
event
,
fluid
.
EndEpochEvent
):
test_reader
=
paddle
.
batch
(
paddle
.
dataset
.
mnist
.
test
(),
batch_size
=
BATCH_SIZE
)
test_metrics
=
trainer
.
test
(
avg_cost
,
acc
=
trainer
.
test
(
reader
=
test_reader
,
feed_order
=
[
'img'
,
'label'
])
avg_cost_set
=
test_metrics
[
0
]
acc_set
=
test_metrics
[
1
]
# get test acc and loss
acc
=
numpy
.
array
(
acc_set
).
mean
()
avg_cost
=
numpy
.
array
(
avg_cost_set
).
mean
()
print
(
"avg_cost: %s"
%
avg_cost
)
print
(
"acc : %s"
%
acc
)
if
float
(
acc
)
>
0.2
:
# Smaller value to increase CI speed
if
acc
>
0.2
:
# Smaller value to increase CI speed
trainer
.
save_params
(
save_dirname
)
else
:
print
(
'BatchID {0}, Test Loss {1:0.2}, Acc {2:0.2}'
.
format
(
event
.
epoch
+
1
,
float
(
avg_cost
),
float
(
acc
)
))
if
math
.
isnan
(
float
(
avg_cost
)
):
event
.
epoch
+
1
,
avg_cost
,
acc
))
if
math
.
isnan
(
avg_cost
):
sys
.
exit
(
"got NaN loss, training failed."
)
elif
isinstance
(
event
,
fluid
.
EndStepEvent
):
print
(
"Step {0}, Epoch {1} Metrics {2}"
.
format
(
event
.
step
,
event
.
epoch
,
map
(
numpy
.
array
,
event
.
metrics
)))
train_reader
=
paddle
.
batch
(
paddle
.
reader
.
shuffle
(
...
...
@@ -131,4 +131,4 @@ def main(use_cuda):
if
__name__
==
'__main__'
:
# for use_cuda in (False, True):
main
(
use_cuda
=
Fals
e
)
main
(
use_cuda
=
Tru
e
)
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_mlp.py
浏览文件 @
4d2a2e75
...
...
@@ -55,24 +55,18 @@ def train(use_cuda, train_program, save_dirname):
if
isinstance
(
event
,
fluid
.
EndEpochEvent
):
test_reader
=
paddle
.
batch
(
paddle
.
dataset
.
mnist
.
test
(),
batch_size
=
BATCH_SIZE
)
test_metrics
=
trainer
.
test
(
avg_cost
,
acc
=
trainer
.
test
(
reader
=
test_reader
,
feed_order
=
[
'img'
,
'label'
])
avg_cost_set
=
test_metrics
[
0
]
acc_set
=
test_metrics
[
1
]
# get test acc and loss
acc
=
numpy
.
array
(
acc_set
).
mean
()
avg_cost
=
numpy
.
array
(
avg_cost_set
).
mean
()
print
(
"avg_cost: %s"
%
avg_cost
)
print
(
"acc : %s"
%
acc
)
if
float
(
acc
)
>
0.2
:
# Smaller value to increase CI speed
if
acc
>
0.2
:
# Smaller value to increase CI speed
trainer
.
save_params
(
save_dirname
)
else
:
print
(
'BatchID {0}, Test Loss {1:0.2}, Acc {2:0.2}'
.
format
(
event
.
epoch
+
1
,
float
(
avg_cost
),
float
(
acc
)
))
if
math
.
isnan
(
float
(
avg_cost
)
):
event
.
epoch
+
1
,
avg_cost
,
acc
))
if
math
.
isnan
(
avg_cost
):
sys
.
exit
(
"got NaN loss, training failed."
)
train_reader
=
paddle
.
batch
(
...
...
python/paddle/fluid/trainer.py
浏览文件 @
4d2a2e75
...
...
@@ -20,6 +20,7 @@ import data_feeder
import
contextlib
import
io
import
unique_name
import
parallel_executor
# optimizer is same as the parameter of Trainer.__init__. Rename it to opt_module
import
optimizer
as
opt_module
...
...
@@ -48,12 +49,14 @@ class BeginStepEvent(object):
def
__init__
(
self
,
epoch_id
,
step_id
):
self
.
epoch
=
epoch_id
self
.
step
=
step_id
self
.
fetch_metrics
=
True
class
EndStepEvent
(
object
):
def
__init__
(
self
,
epoch_id
,
step_id
):
def
__init__
(
self
,
epoch_id
,
step_id
,
metrics
):
self
.
epoch
=
epoch_id
self
.
step
=
step_id
self
.
metrics
=
metrics
def
check_and_get_place
(
place
):
...
...
@@ -87,12 +90,17 @@ class Trainer(object):
Args:
train_func(callable): A function which will return loss. The loss must be a scalar.
infer_func(callable): A function which will return predict, used to save inference model
optimizer(optimizer.Optimizer): The optimizer should be an instance of Optimizer
place: The device place of this trainer.
"""
def
__init__
(
self
,
train_func
,
optimizer
,
param_path
=
None
,
place
=
None
):
def
__init__
(
self
,
train_func
,
optimizer
,
param_path
=
None
,
place
=
None
,
parallel
=
False
):
self
.
parallel
=
parallel
# 1. we need to generate a framework.Program by calling
# program_func. Reference: fluid.program_guard in
# test_word2vec.py
...
...
@@ -106,14 +114,14 @@ class Trainer(object):
with
framework
.
program_guard
(
self
.
train_program
,
self
.
startup_program
):
program_func_outs
=
train_func
()
self
.
t
est
_outputs
=
program_func_outs
if
isinstance
(
self
.
t
rain_func
_outputs
=
program_func_outs
if
isinstance
(
program_func_outs
,
list
)
else
[
program_func_outs
]
self
.
test_program
=
self
.
train_program
.
clone
()
if
not
isinstance
(
optimizer
,
opt_module
.
Optimizer
):
raise
TypeError
(
"The optimizer should be an instance of Optimizer"
)
# The fisrt element of program_func_outs is loss.
loss
=
self
.
t
est
_outputs
[
0
]
loss
=
self
.
t
rain_func
_outputs
[
0
]
optimize_ops
,
params_grads
=
optimizer
.
minimize
(
loss
)
self
.
place
=
check_and_get_place
(
place
)
...
...
@@ -202,12 +210,7 @@ class Trainer(object):
'TRAINING_ROLE environment variable must be either TRAINER or PSERVER'
)
def
train
(
self
,
num_epochs
,
event_handler
,
reader
,
feed_order
,
parallel
=
False
):
def
train
(
self
,
num_epochs
,
event_handler
,
reader
=
None
,
feed_order
=
None
):
"""
Train the model.
...
...
@@ -215,25 +218,24 @@ class Trainer(object):
num_epochs: The number of epoch. An epoch will process all data in reader
event_handler: The event handler. A function with type (ev:Event)->void
reader:
parallel: True if use multi-CPUs or multi-GPUs
feed_order: Feeding order of reader. None will following the defining
order in program
Returns:
"""
if
parallel
:
raise
NotImplementedError
(
"Parallel Executor version of trainer is not implemented"
)
training_role
=
os
.
getenv
(
"PADDLE_TRAINING_ROLE"
,
""
)
if
training_role
==
"PSERVER"
:
with
self
.
_prog_and_scope_guard
():
exe
=
executor
.
Executor
(
self
.
place
)
exe
.
run
()
return
self
.
_train_by_executor
(
num_epochs
,
event_handler
,
reader
,
feed_order
)
if
self
.
parallel
:
self
.
_train_by_parallel_executor
(
num_epochs
,
event_handler
,
reader
,
feed_order
)
else
:
self
.
_train_by_executor
(
num_epochs
,
event_handler
,
reader
,
feed_order
)
def
test
(
self
,
reader
,
feed_order
):
"""
...
...
@@ -245,7 +247,8 @@ class Trainer(object):
order in program
"""
return
self
.
_test_by_executor
(
reader
,
feed_order
,
self
.
test_outputs
)
return
self
.
_test_by_executor
(
reader
,
feed_order
,
self
.
train_func_outputs
)
def
save_params
(
self
,
param_path
):
# reference: save_persistables in io.py
...
...
@@ -279,13 +282,25 @@ class Trainer(object):
feeder
=
data_feeder
.
DataFeeder
(
feed_list
=
feed_var_list
,
place
=
self
.
place
)
exe
=
executor
.
Executor
(
self
.
place
)
for
epoch_id
in
range
(
num_epochs
):
event_handler
(
BeginEpochEvent
(
epoch_id
))
for
step_id
,
data
in
enumerate
(
reader
()):
event_handler
(
BeginStepEvent
(
epoch_id
,
step_id
))
exe
.
run
(
feed
=
feeder
.
feed
(
data
),
fetch_list
=
[])
event_handler
(
EndStepEvent
(
epoch_id
,
step_id
))
event_handler
(
EndEpochEvent
(
epoch_id
))
reader
=
feeder
.
decorate_reader
(
reader
,
multi_devices
=
False
)
self
.
_train_by_any_executor
(
event_handler
,
exe
,
num_epochs
,
reader
)
def
_train_by_any_executor
(
self
,
event_handler
,
exe
,
num_epochs
,
reader
):
for
epoch_id
in
range
(
num_epochs
):
event_handler
(
BeginEpochEvent
(
epoch_id
))
for
step_id
,
data
in
enumerate
(
reader
()):
begin_event
=
BeginStepEvent
(
epoch_id
,
step_id
)
event_handler
(
begin_event
)
if
begin_event
.
fetch_metrics
:
metrics
=
exe
.
run
(
feed
=
data
,
fetch_list
=
[
var
.
name
for
var
in
self
.
train_func_outputs
])
else
:
metrics
=
exe
.
run
(
feed
=
data
,
fetch_list
=
[])
event_handler
(
EndStepEvent
(
epoch_id
,
step_id
,
metrics
))
event_handler
(
EndEpochEvent
(
epoch_id
))
def
_test_by_executor
(
self
,
reader
,
feed_order
,
fetch_list
):
with
executor
.
scope_guard
(
self
.
scope
):
...
...
@@ -304,6 +319,28 @@ class Trainer(object):
return
[
x
/
count
for
x
in
accumulated
]
def
_train_by_parallel_executor
(
self
,
num_epochs
,
event_handler
,
reader
,
feed_order
):
with
self
.
_prog_and_scope_guard
():
pe
=
self
.
_get_or_create_parallel_executor
()
feed_var_list
=
build_feed_var_list
(
self
.
train_program
,
feed_order
)
feeder
=
data_feeder
.
DataFeeder
(
feed_list
=
feed_var_list
,
place
=
self
.
place
)
reader
=
feeder
.
decorate_reader
(
reader
,
multi_devices
=
True
)
for
epoch_id
in
range
(
num_epochs
):
self
.
_train_by_any_executor
(
event_handler
,
pe
,
num_epochs
,
reader
)
def
_get_parallel_executor
(
self
):
return
getattr
(
self
,
'parallel_executor'
,
None
)
def
_get_or_create_parallel_executor
(
self
):
if
self
.
_get_parallel_executor
()
is
None
:
self
.
parallel_executor
=
parallel_executor
.
ParallelExecutor
(
use_cuda
=
isinstance
(
self
.
place
,
core
.
CUDAPlace
),
loss_name
=
self
.
train_func_outputs
[
0
].
name
)
return
self
.
_get_parallel_executor
()
def
build_feed_var_list
(
program
,
feed_order
):
if
not
isinstance
(
program
,
framework
.
Program
):
...
...
tools/timeline.py
浏览文件 @
4d2a2e75
...
...
@@ -171,7 +171,7 @@ if args.timeline_path:
profile_paths
=
profile_path
.
split
(
','
)
profile_dict
=
dict
()
if
len
(
profile_path
)
==
1
:
if
len
(
profile_path
s
)
==
1
:
with
open
(
profile_path
,
'r'
)
as
f
:
profile_s
=
f
.
read
()
profile_pb
=
profiler_pb2
.
Profile
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录