-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Auto Parallel] Add C++ DeviceMesh (#44951)
* [Auto Parallel] Add ProcessMesh, DeviceMesh and DistributedMapper * [Auto Parallel] Remove unecessary codes * [Auto Parallel] Comment out unnecessary cmake statements
- Loading branch information
Showing
7 changed files
with
998 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
cc_library( | ||
device_mesh | ||
SRCS device_mesh.cc | ||
DEPS auto_parallel_proto) | ||
cc_test( | ||
device_mesh_test | ||
SRCS device_mesh_test.cc | ||
DEPS device_mesh) | ||
|
||
# cc_library( | ||
# process_mesh | ||
# SRCS process_mesh.cc | ||
# DEPS auto_parallel_proto) | ||
# cc_test( | ||
# process_mesh_test | ||
# SRCS process_mesh_test.cc | ||
# DEPS process_mesh) | ||
|
||
# cc_library( | ||
# dist_attr | ||
# SRCS dist_attr.cc | ||
# DEPS process_mesh auto_parallel_proto proto_desc) | ||
# cc_test( | ||
# dist_attr_test | ||
# SRCS dist_attr_test.cc | ||
# DEPS dist_attr) | ||
|
||
# cc_library( | ||
# dist_mapper | ||
# SRCS dist_mapper.cc | ||
# DEPS device_mesh auto_parallel_proto) | ||
# cc_test( | ||
# dist_mapper_test | ||
# SRCS dist_mapper_test.cc | ||
# DEPS dist_mapper) | ||
|
||
proto_library(auto_parallel_proto SRCS auto_parallel.proto) | ||
|
||
# cc_library(auto_parallel DEPS process_mesh device_mesh dist_attr dist_mapper | ||
# auto_parallel_proto) |
88 changes: 88 additions & 0 deletions
88
paddle/fluid/distributed/auto_parallel/auto_parallel.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless optional by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
syntax = "proto2"; | ||
|
||
package paddle.distributed.auto_parallel; | ||
|
||
// This proto describes the capability of one device such as the computation and memory. | ||
message DeviceCapabilityProto { | ||
optional double single_precision_flops = 1; | ||
|
||
optional double double_precision_flops = 2; | ||
|
||
optional double memory_size_in_bytes = 3; | ||
|
||
optional double clock_rate_in_ghz = 4; | ||
} | ||
|
||
// This proto represents a device. | ||
message DeviceProto { | ||
// The global id of this device within the cluster. | ||
optional int64 global_id = 1; | ||
|
||
// The local id of this device within the machine. | ||
optional int64 local_id = 2; | ||
|
||
// The id of the machine own this device. | ||
optional int64 machine_id = 3; | ||
|
||
// The id of the machine has this device. | ||
optional string type = 4; | ||
|
||
// The capability of this device. | ||
optional DeviceCapabilityProto capability = 5; | ||
} | ||
|
||
// This proto describes the capability of the link between two devices. | ||
message LinkCapabilityProto { | ||
optional int64 bandwidth = 1; // Bytes/s | ||
optional int64 latency = 2; | ||
} | ||
|
||
message LinkProto { | ||
// The global id of the source device. | ||
optional int64 source_id = 1; | ||
|
||
// The global id of the source device. | ||
optional int64 target_id = 2; | ||
|
||
// Represent the link type. | ||
optional string type = 3; | ||
|
||
// The capability of this link. | ||
optional LinkCapabilityProto capability = 4; | ||
} | ||
|
||
// DeviceMesh is used to organize devices and like n-dimension array. | ||
message DeviceMeshProto { | ||
// The global id of this mesh. | ||
optional string name = 1; | ||
|
||
// The size of each dimension. | ||
repeated int64 shape = 2; | ||
|
||
// These device ids are stored by a row-major way. | ||
// There are no duplicate device ids within one device mesh. | ||
repeated int64 device_ids = 3; | ||
|
||
// The name of each dimension. | ||
repeated string dim_names = 4; | ||
|
||
// The devices of this mesh. | ||
repeated DeviceProto devices = 5; | ||
|
||
// The links are between devices. | ||
repeated LinkProto links = 6; | ||
} |
Oops, something went wrong.