Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SaCS
Semester-Projects-Spring22
decentralizepy-sgx
Commits
3dc179a8
Commit
3dc179a8
authored
Feb 17, 2022
by
Rishi Sharma
Browse files
Add Roundrobin, fix formatting
parent
080a2391
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/decentralizepy/sharing/RoundRobinPartial.py
View file @
3dc179a8
...
...
@@ -57,8 +57,11 @@ class RoundRobinPartial(Sharing):
self
.
alpha
=
alpha
random
.
seed
(
self
.
mapping
.
get_uid
(
rank
,
machine_id
))
n_params
=
self
.
model
.
count_params
()
logging
.
info
(
"Total number of parameters: {}"
.
format
(
n_params
))
self
.
block_size
=
math
.
ceil
(
self
.
alpha
*
n_params
)
self
.
num_blocks
=
n_params
//
self
.
block_size
logging
.
info
(
"Block_size: {}"
.
format
(
self
.
block_size
))
self
.
num_blocks
=
math
.
ceil
(
n_params
/
self
.
block_size
)
logging
.
info
(
"Total number of blocks: {}"
.
format
(
n_params
))
self
.
current_block
=
random
.
randint
(
0
,
self
.
num_blocks
-
1
)
def
serialized_model
(
self
):
...
...
@@ -81,7 +84,7 @@ class RoundRobinPartial(Sharing):
block_end
=
min
(
T
.
shape
[
0
],
(
self
.
current_block
+
1
)
*
self
.
block_size
)
self
.
current_block
=
(
self
.
current_block
+
1
)
%
self
.
num_blocks
T_send
=
T
[
block_start
:
block_end
]
logging
.
info
(
"Range sending: {}-{}"
.
format
(
block_start
,
block_end
))
logging
.
info
(
"Generating dictionary to send"
)
m
=
dict
()
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment