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
SaCS
decentralizepy
Commits
bee80272
Commit
bee80272
authored
3 years ago
by
Jeffrey Wigger
Browse files
Options
Downloads
Patches
Plain Diff
dynamically limiting the number of threads per proc
parent
6496eb69
No related branches found
No related tags found
1 merge request
!2
moving to pickle; two threads per proc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/decentralizepy/mappings/Linear.py
+13
-0
13 additions, 0 deletions
src/decentralizepy/mappings/Linear.py
src/decentralizepy/mappings/Mapping.py
+13
-0
13 additions, 0 deletions
src/decentralizepy/mappings/Mapping.py
src/decentralizepy/node/Node.py
+7
-1
7 additions, 1 deletion
src/decentralizepy/node/Node.py
with
33 additions
and
1 deletion
src/decentralizepy/mappings/Linear.py
+
13
−
0
View file @
bee80272
...
...
@@ -59,3 +59,16 @@ class Linear(Mapping):
"""
return
(
uid
%
self
.
procs_per_machine
),
(
uid
//
self
.
procs_per_machine
)
def
get_local_procs_count
(
self
):
"""
Gives number of processes that run on the node
Returns
-------
int
the number of local processes
"""
return
self
.
procs_per_machine
This diff is collapsed.
Click to expand it.
src/decentralizepy/mappings/Mapping.py
+
13
−
0
View file @
bee80272
...
...
@@ -67,3 +67,16 @@ class Mapping:
"""
raise
NotImplementedError
def
get_local_procs_count
(
self
):
"""
Gives number of processes that run on the node
Returns
-------
int
the number of local processes
"""
raise
NotImplementedError
This diff is collapsed.
Click to expand it.
src/decentralizepy/node/Node.py
+
7
−
1
View file @
bee80272
import
importlib
import
json
import
logging
import
math
import
os
import
torch
...
...
@@ -421,7 +422,9 @@ class Node:
Other arguments
"""
torch
.
set_num_threads
(
2
)
total_threads
=
os
.
cpu_count
()
threads_per_proc
=
max
(
math
.
floor
(
total_threads
/
mapping
.
procs_per_machine
),
1
)
torch
.
set_num_threads
(
threads_per_proc
)
torch
.
set_num_interop_threads
(
1
)
self
.
instantiate
(
rank
,
...
...
@@ -435,5 +438,8 @@ class Node:
test_after
,
*
args
)
logging
.
info
(
"
Each proc uses %d threads out of %d.
"
,
threads_per_proc
,
total_threads
)
self
.
run
()
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