Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Oct 7, 2023
1 parent c93f213 commit d5337a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
11 changes: 6 additions & 5 deletions examples/echo_service/prod_test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ CMDPATH=../../../cmd
BINPATH=../../../bin

PROD=1
NUM_NODES=$(shell ls ./other_nodes | wc -l)
NUM_NODES=10
LIST_NODES=$(shell ls ./other_nodes | wc -l)

.PHONY: default init build run clean
default: init clean build run
Expand All @@ -11,7 +12,7 @@ init:
pkill -15 --version

generate-configs:
go run ./gen_cfgs prod_$(PROD)
go run ./gen_cfgs prod_$(PROD) $(NUM_NODES)

build: generate-configs
# MAKEFILE BUILD
Expand All @@ -20,7 +21,7 @@ build: generate-configs
# COPY HLS
cp -r $(BINPATH)/hls ./recv_hls/prog_hls1
cp -r $(BINPATH)/hls ./send_hls/prog_hls2
for i in $$(seq 1 $(NUM_NODES)); do \
for i in $$(seq 1 $(LIST_NODES)); do \
cp -r $(BINPATH)/hls ./other_nodes/other_hls$${i}/prog_other_hls$${i}; \
done;

Expand All @@ -33,12 +34,12 @@ clean:
# MAKEFILE CLEAN
make clean -C ./recv_hls
make clean -C ./send_hls
for i in $$(seq 1 $(NUM_NODES)); do \
for i in $$(seq 1 $(LIST_NODES)); do \
make clean -C ./other_nodes/other_hls$${i}; \
done;
rm -rf other_nodes/

run-other-nodes:
for i in $$(seq 1 $(NUM_NODES)); do \
for i in $$(seq 1 $(LIST_NODES)); do \
make run -C ./other_nodes/other_hls$${i}; \
done;
17 changes: 12 additions & 5 deletions examples/echo_service/prod_test/gen_cfgs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package main
import (
"fmt"
"os"
"strconv"
"strings"
)

const (
cMessageSizeBytes = (8 << 10)
cLenOtherNodes = 10
)

type sNodeHLS struct {
Expand All @@ -18,13 +18,14 @@ type sNodeHLS struct {
}

var (
gNumOtherNodes int
gNetworkKey string
gListOfConnects []string
)

func initRun() error {
if len(os.Args) != 2 {
return fmt.Errorf("len args != 2")
if len(os.Args) != 3 {
return fmt.Errorf("len args != 3")
}

switch os.Args[1] {
Expand All @@ -38,6 +39,12 @@ func initRun() error {
return fmt.Errorf("unknown param")
}

numNodes, err := strconv.Atoi(os.Args[2])
if err != nil {
panic(err)
}

gNumOtherNodes = numNodes
return nil
}

Expand All @@ -55,11 +62,11 @@ func main() {
firstConnect := connects[0]
secondConnect := connects[len(connects)-1]

nodes := make([]*sNodeHLS, 0, 2+cLenOtherNodes) // 2 = recv+send
nodes := make([]*sNodeHLS, 0, 2+gNumOtherNodes) // 2 = recv+send
nodes = append(nodes, initRecvNode(firstConnect), initSendNode(secondConnect))

os.Mkdir("other_nodes", 0744)
for i := 1; i <= cLenOtherNodes; i++ {
for i := 1; i <= gNumOtherNodes; i++ {
node := initOtherNode(i, strConnects)
nodes = append(nodes, node)
os.Mkdir(node.fPath, 0744)
Expand Down

0 comments on commit d5337a0

Please sign in to comment.