@ -12,8 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License . */
limitations under the License . */
# include <algorithm>
# include "paddle/fluid/framework/executor.h"
# include "paddle/fluid/framework/executor.h"
# include "paddle/fluid/framework/feed_fetch_method.h"
# include "paddle/fluid/framework/feed_fetch_method.h"
@ -48,7 +46,6 @@ ExecutorPrepareContext::~ExecutorPrepareContext() {
VLOG ( 5 ) < < " destroy ExecutorPrepareContext " ;
VLOG ( 5 ) < < " destroy ExecutorPrepareContext " ;
}
}
# ifndef _WIN32
template < typename RefCntMap >
template < typename RefCntMap >
static void DeleteUnusedTensors ( const Scope & scope , const OperatorBase * op ,
static void DeleteUnusedTensors ( const Scope & scope , const OperatorBase * op ,
GarbageCollector < Tensor > * gc ,
GarbageCollector < Tensor > * gc ,
@ -83,7 +80,6 @@ static void DeleteUnusedTensors(const Scope& scope, const OperatorBase* op,
gc - > Add ( erase_tensors ) ;
gc - > Add ( erase_tensors ) ;
}
}
}
}
# endif
Executor : : Executor ( const platform : : Place & place ) : place_ ( place ) { }
Executor : : Executor ( const platform : : Place & place ) : place_ ( place ) { }
@ -371,7 +367,6 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope,
CreateVariables ( ctx - > prog_ , local_scope , ctx - > block_id_ ) ;
CreateVariables ( ctx - > prog_ , local_scope , ctx - > block_id_ ) ;
}
}
# ifndef _WIN32
int64_t max_memory_size = GetEagerDeletionThreshold ( ) ;
int64_t max_memory_size = GetEagerDeletionThreshold ( ) ;
std : : unique_ptr < GarbageCollector < Tensor > > gc ;
std : : unique_ptr < GarbageCollector < Tensor > > gc ;
// WhileOp would set keep_kids to false
// WhileOp would set keep_kids to false
@ -413,16 +408,6 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope,
} else {
} else {
platform : : DeviceContextPool : : Instance ( ) . Get ( place_ ) - > Wait ( ) ;
platform : : DeviceContextPool : : Instance ( ) . Get ( place_ ) - > Wait ( ) ;
}
}
# else // WIN32
for ( auto & op : ctx - > ops_ ) {
op - > Run ( * local_scope , place_ ) ;
if ( FLAGS_benchmark ) {
VLOG ( 2 ) < < " Memory used after operator " + op - > Type ( ) + " running: "
< < memory : : memory_usage ( place_ ) ;
}
}
platform : : DeviceContextPool : : Instance ( ) . Get ( place_ ) - > Wait ( ) ;
# endif // NOT WIN32
if ( local_scope ! = scope ) {
if ( local_scope ! = scope ) {
scope - > DeleteScope ( local_scope ) ;
scope - > DeleteScope ( local_scope ) ;