@@ -296,6 +296,11 @@ ParallelExecutor::ParallelExecutor(const std::vector<platform::Place> &places,
296
296
member_->use_all_reduce_ =
297
297
build_strategy.reduce_ == BuildStrategy::ReduceStrategy::kAllReduce ;
298
298
member_->nranks_ = build_strategy.num_trainers_ * places.size ();
299
+ #if defined(PADDLE_WITH_CUDA) && defined(_WIN32)
300
+ if (member_->use_cuda_ ) {
301
+ PADDLE_ENFORCE (places.size () == 1 , " Windows can support Single GPU only." );
302
+ }
303
+ #endif
299
304
if (!member_->use_all_reduce_ ) {
300
305
PADDLE_ENFORCE (places.size () > 1 ,
301
306
" If you set build_strategy.reduce with 'Reduce',"
@@ -361,8 +366,6 @@ ParallelExecutor::ParallelExecutor(const std::vector<platform::Place> &places,
361
366
member_->nccl_ctxs_ .DefaultFlatCtx ()->at (member_->places_ [dev_id]);
362
367
dev_ctx->set_nccl_comm (nccl_ctx.comm ());
363
368
}
364
- #else
365
- PADDLE_THROW (" Not compiled with CUDA" );
366
369
#endif
367
370
}
368
371
// broadcast parameters from the 0th device to others:
@@ -544,8 +547,6 @@ void ParallelExecutor::BCastParamsToDevices(
544
547
}
545
548
nccl_ctxs->WaitAll ();
546
549
}
547
- #else
548
- PADDLE_THROW (" Not compiled with CUDA" );
549
550
#endif
550
551
} else {
551
552
platform::CPUPlace cpu;
@@ -650,7 +651,9 @@ ParallelExecutor::~ParallelExecutor() {
650
651
bool ParallelExecutor::EnableParallelGraphExecution (
651
652
const ir::Graph &graph, const ExecutionStrategy &exec_strategy,
652
653
const BuildStrategy &build_strategy) const {
653
- if (!FLAGS_enable_parallel_graph) return false ;
654
+ if (!FLAGS_enable_parallel_graph) {
655
+ return false ;
656
+ }
654
657
655
658
bool enable_parallel_graph = true ;
656
659
@@ -670,11 +673,19 @@ bool ParallelExecutor::EnableParallelGraphExecution(
670
673
}
671
674
}
672
675
673
- if (!member_->use_all_reduce_ || !member_->use_cuda_ )
674
-
676
+ if (!member_->use_all_reduce_ || !member_->use_cuda_ ) {
675
677
if (build_strategy.enable_sequential_execution_ ||
676
- exec_strategy.type_ == ExecutionStrategy::ExecutorType::kExperimental )
678
+ exec_strategy.type_ == ExecutionStrategy::ExecutorType::kExperimental ) {
677
679
enable_parallel_graph = false ;
680
+ }
681
+ }
682
+
683
+ #ifdef WIN32
684
+ VLOG (1 ) << " Windows has no support to parallel graph, enable_parallel_graph "
685
+ " would be forced to false." ;
686
+ enable_parallel_graph = false ;
687
+ #endif
688
+
678
689
return enable_parallel_graph;
679
690
}
680
691
0 commit comments