Merge pull request #124 from taskgraph/revert-122-linkTypeTopology · taskgraph/taskgraph@fe2da02 · GitHub
Skip to content

Commit fe2da02

Browse files
author
Hongchao Deng
committed
Merge pull request #124 from taskgraph/revert-122-linkTypeTopology
Revert "linkTypeTopology"
2 parents bc3886e + 6d9d240 commit fe2da02

21 files changed

Lines changed: 86 additions & 278 deletions

.script/dep.sh

Lines changed: 0 additions & 1 deletion

example/bwmf/bwmf/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
"strings"
1010

1111
"github.com/coreos/go-etcd/etcd"
12-
"github.com/plutoshe/taskgraph/controller"
13-
"github.com/plutoshe/taskgraph/topo"
12+
"github.com/taskgraph/taskgraph/controller"
1413
"github.com/taskgraph/taskgraph/example/bwmf"
14+
"github.com/taskgraph/taskgraph/example/topo"
1515
"github.com/taskgraph/taskgraph/filesystem"
1616
"github.com/taskgraph/taskgraph/framework"
1717
)
@@ -46,8 +46,7 @@ func main() {
4646
etcdUrls := strings.Split(*etcdUrlList, ",")
4747
log.Println("etcd urls: ", etcdUrls)
4848

49-
topoParent := topo.NewFullTopologyOfMaster(uint64(*numTasks))
50-
topoChildren := topo.NewFullTopologyOfNeighbor(uint64(*numTasks))
49+
topo := topo.NewFullTopology(uint64(*numTasks))
5150

5251
switch *jobType {
5352
case "t":
@@ -57,8 +56,7 @@ func main() {
5756
ConfBytes: confData,
5857
}
5958
bootstrap.SetTaskBuilder(taskBuilder)
60-
bootstrap.AddLinkage("Parents", topoParent)
61-
bootstrap.AddLinkage("Children", topoChildren)
59+
bootstrap.SetTopology(topo)
6260
log.Println("Starting task..")
6361
bootstrap.Start()
6462
case "c":

example/bwmf/bwmf_task.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010

1111
"github.com/golang/protobuf/proto"
12-
"github.com/plutoshe/taskgraph"
12+
"github.com/taskgraph/taskgraph"
1313
pb "github.com/taskgraph/taskgraph/example/bwmf/proto"
1414
"github.com/taskgraph/taskgraph/filesystem"
1515
"github.com/taskgraph/taskgraph/op"
@@ -138,25 +138,25 @@ func (t *bwmfTask) initData() {
138138
func (t *bwmfTask) initOptUtil() {
139139
if t.tShard == nil {
140140
// XXX: Initialize it random and sparse.
141-
t.tShard = &pb.MatrixShard{
142-
M: t.dims.n,
143-
N: t.dims.k,
144-
Val: make([]float32, t.dims.n*t.dims.k),
141+
t.tShard = &pb.MatrixShard {
142+
M: t.dims.n,
143+
N: t.dims.k,
144+
Val: make([]float32, t.dims.n * t.dims.k),
145145
}
146-
for i := uint32(0); i < t.tShard.M*t.tShard.N; i++ {
146+
for i := uint32(0); i < t.tShard.M * t.tShard.N; i++ {
147147
t.tShard.Val[i] = rand.Float32()
148148
}
149149
}
150150

151151
if t.dShard == nil {
152152
// XXX: Initial at 0.0.
153-
t.dShard = &pb.MatrixShard{
154-
M: t.dims.m,
155-
N: t.dims.k,
156-
Val: make([]float32, t.dims.m*t.dims.k),
153+
t.dShard = &pb.MatrixShard {
154+
M: t.dims.m,
155+
N: t.dims.k,
156+
Val: make([]float32, t.dims.m * t.dims.k),
157157
}
158158

159-
for i := uint32(0); i < t.dShard.M*t.dShard.N; i++ {
159+
for i := uint32(0); i < t.dShard.M * t.dShard.N; i++ {
160160
t.dShard.Val[i] = rand.Float32()
161161
}
162162
}
@@ -294,7 +294,7 @@ func (t *bwmfTask) doEnterEpoch(ctx context.Context, epoch uint64) {
294294
}
295295

296296
func (t *bwmfTask) fetchShards(ctx context.Context, method string) {
297-
peers := t.framework.GetTopology()["Neighbors"].GetNeighbors(t.epoch)
297+
peers := t.framework.GetTopology().GetNeighbors("Neighbors", t.epoch)
298298
for _, peer := range peers {
299299
t.framework.DataRequest(ctx, peer, method, &pb.Request{})
300300
}

example/bwmf/bwmf_taskbuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66

7-
"github.com/plutoshe/taskgraph"
7+
"github.com/taskgraph/taskgraph"
88
"github.com/taskgraph/taskgraph/filesystem"
99
)
1010

example/regression/demo/main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"net"
77

88
"github.com/coreos/go-etcd/etcd"
9-
"github.com/plutoshe/taskgraph/controller"
9+
"github.com/taskgraph/taskgraph/controller"
1010
"github.com/taskgraph/taskgraph/example/regression"
11-
"github.com/plutoshe/taskgraph/example/topo"
11+
"github.com/taskgraph/taskgraph/example/topo"
1212
"github.com/taskgraph/taskgraph/framework"
1313
)
1414

@@ -38,9 +38,7 @@ func main() {
3838
MasterConfig: map[string]string{"writefile": "result.txt"},
3939
}
4040
bootstrap.SetTaskBuilder(taskBuilder)
41-
42-
bootstrap.AddLinkage("Parents" : topo.NewTreeTopologyOfParent(2, ntask))
43-
bootstrap.AddLinkage("Children" : topo.NewTreeTopologyOfChildren(2, ntask))
41+
bootstrap.SetTopology(topo.NewTreeTopology(2, ntask))
4442
bootstrap.Start()
4543
default:
4644
log.Fatal("Please choose a type: (c) controller, (t) task")

example/regression/master.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strconv"
99

1010
"github.com/golang/protobuf/proto"
11-
"github.com/plutoshe/taskgraph"
11+
"github.com/taskgraph/taskgraph"
1212
pb "github.com/taskgraph/taskgraph/example/regression/proto"
1313
"golang.org/x/net/context"
1414
"google.golang.org/grpc"
@@ -103,7 +103,7 @@ func (t *dummyMaster) enterEpoch(ctx context.Context, epoch uint64) {
103103

104104
t.epoch = epoch
105105
t.param.Value = int32(t.epoch)
106-
for _, c := range t.framework.GetTopology()["Children"].GetNeighbors(epoch) {
106+
for _, c := range t.framework.GetTopology().GetNeighbors("Children", t.epoch) {
107107
t.framework.DataRequest(ctx, c, "/proto.Regression/GetGradient", &pb.Input{})
108108
}
109109
}
@@ -158,7 +158,7 @@ func (t *dummyMaster) ChildDataReady(ctx context.Context, childID uint64, output
158158
// This is a weak form of checking. We can also check the task ids.
159159
// But this really means that we get all the events from children, we
160160
// should go into the next epoch now.
161-
if len(t.fromChildren) == len(t.framework.GetTopology()["Children"].GetNeighbors(t.epoch)) {
161+
if len(t.fromChildren) == len(t.framework.GetTopology().GetNeighbors("Children", t.epoch)) {
162162
t.gradient = new(pb.Gradient)
163163
for _, g := range t.fromChildren {
164164
t.gradient.Value += g.Value

example/regression/regression.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"math/rand"
55
"strconv"
66

7-
"github.com/plutoshe/taskgraph"
7+
"github.com/taskgraph/taskgraph"
88
)
99

1010
/*

example/regression/slave.go

Lines changed: 4 additions & 4 deletions

example/topo/full_topo_master.go

Lines changed: 0 additions & 37 deletions
This file was deleted.

example/topo/full_topo_neighbor.go

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)