Skip to content

Commit

Permalink
Always enable local rpc backend (#4505)
Browse files Browse the repository at this point in the history
* always enable local

* add static_assert

* add log info

Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
  • Loading branch information
jackalcooper and oneflow-ci-bot authored Mar 25, 2021
1 parent a7b53ed commit 54d5520
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 2 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,8 @@ if (RPC_BACKEND MATCHES "GRPC")
message("-- RPC backend enabled: gRPC")
set(SUPPORTED_RPC_BACKEND_FOUND 1)
endif()
if (RPC_BACKEND MATCHES "LOCAL")
add_definitions(-DRPC_BACKEND_LOCAL)
message("-- RPC backend enabled: local")
set(SUPPORTED_RPC_BACKEND_FOUND 1)
endif()
if(NOT SUPPORTED_RPC_BACKEND_FOUND)
message(FATAL_ERROR "RPC_BACKEND: ${RPC_BACKEND} not supported")
endif()
add_definitions(-DRPC_BACKEND_LOCAL)
message("-- RPC backend enabled: local")
enable_testing()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
5 changes: 3 additions & 2 deletions oneflow/core/job/env_global_objects_scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,16 @@ Maybe<void> EnvGlobalObjectsScope::Init(const EnvProto& env_proto) {
auto* local_manager = new LocalRpcManager();
Global<RpcManager>::SetAllocated(local_manager);
#else
UNIMPLEMENTED();
static_assert(false, "requires rpc backend local to run oneflow in single processs");
#endif // RPC_BACKEND_LOCAL
} else /*multi process, multi machine*/ {
#ifdef RPC_BACKEND_GRPC
LOG(ERROR) << "using rpc backend: gRPC";
auto* grpc_manager = new GrpcRpcManager();
Global<RpcManager>::SetAllocated(grpc_manager);
#else
UNIMPLEMENTED();
UNIMPLEMENTED() << "to run distributed oneflow, you must enable at least one multi-node rpc "
"backend by adding cmake argument, for instance: -DRPC_BACKEND=GRPC";
#endif // RPC_BACKEND_GRPC
}
CHECK_JUST(Global<RpcManager>::Get()->CreateServer());
Expand Down

0 comments on commit 54d5520

Please sign in to comment.