From db9e700ba1d7fb4a264225439bf66f24fba66ff4 Mon Sep 17 00:00:00 2001 From: Dun Liang Date: Fri, 25 Jan 2019 15:21:06 +0800 Subject: [PATCH] default use pin place && test=develop --- paddle/fluid/API.spec | 2 +- python/paddle/fluid/layers/io.py | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index d2a9899ea54..98726315530 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -218,7 +218,7 @@ paddle.fluid.layers.shuffle ArgSpec(args=['reader', 'buffer_size'], varargs=None paddle.fluid.layers.batch ArgSpec(args=['reader', 'batch_size'], varargs=None, keywords=None, defaults=None) paddle.fluid.layers.double_buffer ArgSpec(args=['reader', 'place', 'name'], varargs=None, keywords=None, defaults=(None, None)) paddle.fluid.layers.random_data_generator ArgSpec(args=['low', 'high', 'shapes', 'lod_levels', 'for_parallel'], varargs=None, keywords=None, defaults=(True,)) -paddle.fluid.layers.py_reader ArgSpec(args=['capacity', 'shapes', 'dtypes', 'lod_levels', 'name', 'use_double_buffer', 'use_cuda_pinned_place'], varargs=None, keywords=None, defaults=(None, None, True, None)) +paddle.fluid.layers.py_reader ArgSpec(args=['capacity', 'shapes', 'dtypes', 'lod_levels', 'name', 'use_double_buffer'], varargs=None, keywords=None, defaults=(None, None, True)) paddle.fluid.layers.create_py_reader_by_data ArgSpec(args=['capacity', 'feed_list', 'name', 'use_double_buffer'], varargs=None, keywords=None, defaults=(None, True)) paddle.fluid.layers.Preprocessor.__init__ ArgSpec(args=['self', 'reader', 'name'], varargs=None, keywords=None, defaults=(None,)) paddle.fluid.layers.Preprocessor.block ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None) diff --git a/python/paddle/fluid/layers/io.py b/python/paddle/fluid/layers/io.py index a5f91aad79b..47686eb60a2 100644 --- a/python/paddle/fluid/layers/io.py +++ b/python/paddle/fluid/layers/io.py @@ -483,9 +483,8 @@ def _py_reader(capacity, lod_levels=None, name=None, use_double_buffer=True, - use_cuda_pinned_place=False, feed_list=None): - + use_cuda_pinned_place = use_double_buffer and core.is_compiled_with_cuda() if feed_list is not None: if not isinstance(feed_list, list): raise TypeError("feed_list should be a list of Variable" @@ -639,8 +638,7 @@ def py_reader(capacity, dtypes, lod_levels=None, name=None, - use_double_buffer=True, - use_cuda_pinned_place=None): + use_double_buffer=True): """ Create a Python reader for data feeding in Python @@ -664,9 +662,6 @@ def py_reader(capacity, name(basestring): The prefix Python queue name and Reader name. None will be generated automatically. use_double_buffer(bool): Whether use double buffer or not. - use_cuda_pinned_place(bool): Whether use cuda pinned place or not, - this option only works with double buffer and cuda enabled. - None will be enabled when double buffer and cuda are enabled. Returns: Variable: A Reader from which we can get feeding data. @@ -762,22 +757,13 @@ def py_reader(capacity, >>> except fluid.core.EOFException: >>> test_reader.reset() """ - if use_double_buffer and core.is_compiled_with_cuda(): - if use_cuda_pinned_place == None: - use_cuda_pinned_place = True - else: - if use_cuda_pinned_place: - raise RuntimeError( - "use_cuda_pinned_place can only be used with double buffer and cuda enabled." - ) return _py_reader( capacity=capacity, shapes=shapes, dtypes=dtypes, lod_levels=lod_levels, name=name, - use_double_buffer=use_double_buffer, - use_cuda_pinned_place=use_cuda_pinned_place) + use_double_buffer=use_double_buffer) def create_py_reader_by_data(capacity, -- GitLab