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
56323e30
Commit
56323e30
authored
7 years ago
by
Tim O'Donnell
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #99 from hammerlab/add-speed-script
Add speed test script
parents
5e83353d
f1221e9f
No related branches found
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
.travis.yml
+1
-1
1 addition, 1 deletion
.travis.yml
test/test_speed.py
+58
-0
58 additions, 0 deletions
test/test_speed.py
with
59 additions
and
1 deletion
.travis.yml
+
1
−
1
View file @
56323e30
...
...
@@ -45,6 +45,6 @@ script:
# download data and models, then run tests
-
mhcflurry-downloads fetch
-
mhcflurry-downloads info
# just to test this command works
-
nosetests test --with-coverage --cover-package=mhcflurry && ./lint.sh
-
nosetests test
-sv
--with-coverage --cover-package=mhcflurry && ./lint.sh
after_success
:
coveralls
This diff is collapsed.
Click to expand it.
test/test_speed.py
0 → 100644
+
58
−
0
View file @
56323e30
import
numpy
numpy
.
random
.
seed
(
0
)
import
time
import
cProfile
import
pstats
import
pandas
from
mhcflurry
import
Class1AffinityPredictor
from
mhcflurry.common
import
random_peptides
NUM
=
10000
DOWNLOADED_PREDICTOR
=
Class1AffinityPredictor
.
load
()
def
test_speed
(
profile
=
False
):
starts
=
{}
timings
=
{}
profilers
=
{}
def
start
(
name
):
starts
[
name
]
=
time
.
time
()
if
profile
:
profilers
[
name
]
=
cProfile
.
Profile
()
profilers
[
name
].
enable
()
def
end
(
name
):
timings
[
name
]
=
time
.
time
()
-
starts
[
name
]
if
profile
:
profilers
[
name
].
disable
()
start
(
"
first
"
)
DOWNLOADED_PREDICTOR
.
predict
([
"
SIINFEKL
"
],
allele
=
"
HLA-A*02:01
"
)
end
(
"
first
"
)
peptides
=
random_peptides
(
NUM
)
start
(
"
pred_%d
"
%
NUM
)
DOWNLOADED_PREDICTOR
.
predict
(
peptides
,
allele
=
"
HLA-A*02:01
"
)
end
(
"
pred_%d
"
%
NUM
)
print
(
"
SPEED BENCHMARK
"
)
print
(
"
Results:
\n
%s
"
%
str
(
pandas
.
Series
(
timings
)))
return
dict
(
(
key
,
pstats
.
Stats
(
value
))
for
(
key
,
value
)
in
profilers
.
items
())
if
__name__
==
'
__main__
'
:
# If run directly from python, do profiling and leave the user in a shell
# to explore results.
result
=
test_speed
(
profile
=
True
)
result
[
"
pred_%d
"
%
NUM
].
sort_stats
(
"
cumtime
"
).
reverse_order
().
print_stats
()
# Leave in ipython
locals
().
update
(
result
)
import
ipdb
;
ipdb
.
set_trace
()
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