Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
decentralizepy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milos Vujasinovic
decentralizepy
Commits
aec49a05
Commit
aec49a05
authored
3 years ago
by
Rishi Sharma
Browse files
Options
Downloads
Patches
Plain Diff
Fix termination bug TCP
parent
3849b18b
Branches
3D_parallel
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/decentralizepy/communication/TCP.py
+13
-1
13 additions, 1 deletion
src/decentralizepy/communication/TCP.py
testing.py
+19
-6
19 additions, 6 deletions
testing.py
with
32 additions
and
7 deletions
src/decentralizepy/communication/TCP.py
+
13
−
1
View file @
aec49a05
...
@@ -98,7 +98,7 @@ class TCP(Communication):
...
@@ -98,7 +98,7 @@ class TCP(Communication):
elif
recv
==
BYE
:
elif
recv
==
BYE
:
logging
.
info
(
"
Recieved {} from {}
"
.
format
(
BYE
,
sender
))
logging
.
info
(
"
Recieved {} from {}
"
.
format
(
BYE
,
sender
))
self
.
barrier
.
remove
(
sender
)
self
.
barrier
.
remove
(
sender
)
self
.
disconnect_neighbors
()
return
self
.
receive
()
else
:
else
:
logging
.
debug
(
"
Recieved message from {}
"
.
format
(
sender
))
logging
.
debug
(
"
Recieved message from {}
"
.
format
(
sender
))
return
self
.
decrypt
(
sender
,
recv
)
return
self
.
decrypt
(
sender
,
recv
)
...
@@ -114,3 +114,15 @@ class TCP(Communication):
...
@@ -114,3 +114,15 @@ class TCP(Communication):
for
sock
in
self
.
peer_sockets
.
values
():
for
sock
in
self
.
peer_sockets
.
values
():
sock
.
send
(
BYE
)
sock
.
send
(
BYE
)
self
.
sent_disconnections
=
True
self
.
sent_disconnections
=
True
while
len
(
self
.
barrier
):
sender
,
recv
=
self
.
router
.
recv_multipart
()
if
recv
==
BYE
:
logging
.
info
(
"
Recieved {} from {}
"
.
format
(
BYE
,
sender
))
self
.
barrier
.
remove
(
sender
)
else
:
logging
.
critical
(
"
Recieved unexpected {} from {}
"
.
format
(
recv
,
sender
)
)
raise
RuntimeError
(
"
Received a message when expecting BYE from {}
"
.
format
(
sender
)
)
This diff is collapsed.
Click to expand it.
testing.py
+
19
−
6
View file @
aec49a05
import
argparse
import
argparse
import
datetime
import
logging
import
logging
from
pathlib
import
Path
from
localconfig
import
LocalConfig
from
localconfig
import
LocalConfig
from
torch
import
multiprocessing
as
mp
from
torch
import
multiprocessing
as
mp
...
@@ -20,20 +22,31 @@ def read_ini(file_path):
...
@@ -20,20 +22,31 @@ def read_ini(file_path):
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
config
=
read_ini
(
"
config.ini
"
)
my_config
=
dict
()
for
section
in
config
:
my_config
[
section
]
=
dict
(
config
.
items
(
section
))
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
-mid
"
,
"
--machine_id
"
,
type
=
int
,
default
=
0
)
parser
.
add_argument
(
"
-mid
"
,
"
--machine_id
"
,
type
=
int
,
default
=
0
)
parser
.
add_argument
(
"
-ps
"
,
"
--procs_per_machine
"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"
-ps
"
,
"
--procs_per_machine
"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"
-ms
"
,
"
--machines
"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"
-ms
"
,
"
--machines
"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"
-ld
"
,
"
--log_dir
"
,
type
=
str
,
default
=
"
./{}
"
.
format
(
datetime
.
datetime
.
now
())
)
parser
.
add_argument
(
"
-is
"
,
"
--iterations
"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"
-cf
"
,
"
--config_file
"
,
type
=
str
,
default
=
"
config.ini
"
)
parser
.
add_argument
(
"
-ll
"
,
"
--log_level
"
,
type
=
str
,
default
=
"
INFO
"
)
parser
.
add_argument
(
"
-gf
"
,
"
--graph_file
"
,
type
=
str
,
default
=
"
36_nodes.edges
"
)
parser
.
add_argument
(
"
-gt
"
,
"
--graph_type
"
,
type
=
str
,
default
=
"
edges
"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
Path
(
args
.
log_dir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
config
=
read_ini
(
args
.
config_file
)
my_config
=
dict
()
for
section
in
config
:
my_config
[
section
]
=
dict
(
config
.
items
(
section
))
g
=
Graph
()
g
=
Graph
()
g
.
read_graph_from_file
(
"
36_nodes.edges
"
,
"
edges
"
)
g
.
read_graph_from_file
(
args
.
graph_file
,
args
.
graph_type
)
n_machines
=
args
.
machines
n_machines
=
args
.
machines
procs_per_machine
=
args
.
procs_per_machine
procs_per_machine
=
args
.
procs_per_machine
l
=
Linear
(
n_machines
,
procs_per_machine
)
l
=
Linear
(
n_machines
,
procs_per_machine
)
...
@@ -42,5 +55,5 @@ if __name__ == "__main__":
...
@@ -42,5 +55,5 @@ if __name__ == "__main__":
mp
.
spawn
(
mp
.
spawn
(
fn
=
Node
,
fn
=
Node
,
nprocs
=
procs_per_machine
,
nprocs
=
procs_per_machine
,
args
=
[
m_id
,
l
,
g
,
my_config
,
20
,
"
results
"
,
logging
.
INFO
],
args
=
[
m_id
,
l
,
g
,
my_config
,
args
.
iterations
,
args
.
log_dir
,
args
.
log_level
],
)
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment