Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mhc_rank
Manage
Activity
Members
Labels
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Patrick Skillman-Lawrence
mhc_rank
Commits
03dcdb51
Commit
03dcdb51
authored
7 years ago
by
Tim O'Donnell
Browse files
Options
Downloads
Patches
Plain Diff
fixes
parent
a9ec7e1c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mhcflurry/train_allele_specific_models_command.py
+9
-5
9 additions, 5 deletions
mhcflurry/train_allele_specific_models_command.py
with
9 additions
and
5 deletions
mhcflurry/train_allele_specific_models_command.py
+
9
−
5
View file @
03dcdb51
...
...
@@ -197,6 +197,9 @@ def run(argv=sys.argv[1:]):
worker_init_args
=
None
if
args
.
gpus
:
print
(
"
Attempting to round-robin assign each worker a GPU.
"
)
if
args
.
backend
!=
"
tensorflow-default
"
:
print
(
"
Forcing keras backend to be tensorflow-default
"
)
args
.
backend
=
"
tensorflow-default
"
gpu_assignments_remaining
=
dict
((
(
gpu
,
args
.
max_workers_per_gpu
)
for
gpu
in
range
(
args
.
gpus
)
...
...
@@ -211,6 +214,7 @@ def run(argv=sys.argv[1:]):
gpu_assignments_remaining
[
gpu_num
]
-=
1
if
not
gpu_assignments_remaining
[
gpu_num
]:
del
gpu_assignments_remaining
[
gpu_num
]
gpu_assignment
=
[
gpu_num
]
else
:
# Use CPU
gpu_assignment
=
[]
...
...
@@ -219,9 +223,10 @@ def run(argv=sys.argv[1:]):
'
gpu_device_nums
'
:
gpu_assignment
,
'
keras_backend
'
:
args
.
backend
})
print
(
"
Worker %d assigned GPUs: %s
"
%
(
worker_num
,
gpu_assignment
))
worker_pool
=
Pool
(
initializer
=
worker_init
,
initializer
=
worker_init
_entrypoint
,
initargs
=
(
worker_init_args
,),
processes
=
num_workers
)
print
(
"
Started pool of %d workers: %s
"
%
(
num_workers
,
str
(
worker_pool
)))
...
...
@@ -449,17 +454,16 @@ def calibrate_percentile_ranks(allele, predictor, peptides=None):
def
worker_init_entrypoint
(
arg_queue
):
if
arg_queue
:
(
args
,
kwargs
)
=
arg_queue
.
get
()
kwargs
=
arg_queue
.
get
()
else
:
args
=
[]
kwargs
=
{}
worker_init
(
*
args
,
**
kwargs
)
worker_init
(
**
kwargs
)
def
worker_init
(
keras_backend
=
None
,
gpu_device_nums
=
None
):
if
keras_backend
or
gpu_device_nums
:
print
(
"
WORKER pid=%d assigned GPU devices: %s
"
%
(
os
.
getp
g
id
()
)
,
gpu_device_nums
)
os
.
getpid
(),
gpu_device_nums
)
)
set_keras_backend
(
keras_backend
,
gpu_device_nums
=
gpu_device_nums
)
...
...
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