Skip to content

Commit

Permalink
skip training defunct OneDNN
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanglirong1999 committed Nov 14, 2023
1 parent 196b745 commit 7c3361c
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 50 deletions.
6 changes: 0 additions & 6 deletions paddle/fluid/distributed/fleet_executor/fleet_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@ void FleetExecutor::Init(
0,
platform::errors::InvalidArgument(
"Fleet executor is inited with empty task node"));
#ifdef PADDLE_WITH_DNNL
if (!platform::is_cpu_place(place)) {
FLAGS_use_mkldnn = false;
}
#endif

// Set the unused var after running while op
std::set<TaskNode*> sub_block_tasks;
std::vector<std::string> while_block_vars;
Expand Down
8 changes: 1 addition & 7 deletions paddle/fluid/framework/executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,7 @@ ExecutorPrepareContext::~ExecutorPrepareContext() {
VLOG(5) << "destroy ExecutorPrepareContext";
}

Executor::Executor(const platform::Place& place) : place_(place) {
#ifdef PADDLE_WITH_DNNL
if (!platform::is_cpu_place(place_)) {
FLAGS_use_mkldnn = false;
}
#endif
}
Executor::Executor(const platform::Place& place) : place_(place) {}

Executor::~Executor() {
#ifdef PADDLE_WITH_DNNL
Expand Down
9 changes: 0 additions & 9 deletions paddle/fluid/framework/naive_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,8 @@
#include "paddle/fluid/operators/lite/lite_engine_op.h"
#endif

PHI_DECLARE_bool(use_mkldnn);

namespace paddle {
namespace framework {
NaiveExecutor::NaiveExecutor(const platform::Place &place) : place_(place) {
#ifdef PADDLE_WITH_DNNL
if (!platform::is_cpu_place(place_)) {
FLAGS_use_mkldnn = false;
}
#endif
}
void NaiveExecutor::Prepare(Scope *scope,
const ProgramDesc &program_desc,
int block_id,
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/naive_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class NaiveExecutor {
public:
using HookFunc = std::function<void(OperatorBase*, Scope*)>;

explicit NaiveExecutor(const platform::Place& place);
explicit NaiveExecutor(const platform::Place& place) : place_(place) {}

~NaiveExecutor();

Expand Down
6 changes: 0 additions & 6 deletions paddle/fluid/framework/new_executor/standalone_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ StandaloneExecutor::StandaloneExecutor(const platform::Place& place,
const interpreter::Plan& plan,
Scope* scope)
: place_(place), plan_(plan), scope_(scope) {
#ifdef PADDLE_WITH_DNNL
if (!platform::is_cpu_place(place_)) {
FLAGS_use_mkldnn = false;
}
#endif

int64_t micro_batch_num = plan_.MicroBatchNum();
vec_force_events_to_wait_.resize(micro_batch_num);
for (int64_t i = 0; i < micro_batch_num; ++i) {
Expand Down
13 changes: 0 additions & 13 deletions paddle/fluid/framework/parallel_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -676,19 +676,6 @@ ParallelExecutor::ParallelExecutor(const std::vector<platform::Place> &places,
const BuildStrategy &build_strategy,
ir::Graph *graph)
: member_(new ParallelExecutorPrivate(places, scope)) {
#ifdef PADDLE_WITH_DNNL
for (size_t i = 0; i < places.size(); i++) {
if (!platform::is_cpu_place(places[i])) {
FLAGS_use_mkldnn = false;
break;
} else {
char *p = getenv("FLAGS_use_mkldnn");
if (p == nullptr) {
FLAGS_use_mkldnn = true;
}
}
}
#endif
PADDLE_ENFORCE_EQ(!places.empty(),
true,
platform::errors::Unavailable(
Expand Down
8 changes: 0 additions & 8 deletions paddle/phi/core/flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -680,15 +680,7 @@ PHI_DEFINE_EXPORTED_bool(
* Example:
* Note:
*/
// #ifdef PADDLE_WITH_DNNL
// PHI_DEFINE_EXPORTED_bool(
// use_mkldnn,
// phi::backends::cpu::MayIUse(phi::backends::cpu::cpu_isa_t::avx2) ? true
// : false,
// "Use MKLDNN to run");
// #else
PHI_DEFINE_EXPORTED_bool(use_mkldnn, false, "Use MKLDNN to run");
// #endif

/**
* Debug related FLAG
Expand Down

0 comments on commit 7c3361c

Please sign in to comment.