Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
OpenFold
Commits
5a928b47
Commit
5a928b47
authored
Nov 16, 2021
by
Gustaf Ahdritz
Browse files
Replace time.time() with time.perf_counter()
parent
0567d99c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
openfold/data/tools/utils.py
openfold/data/tools/utils.py
+2
-2
openfold/np/relax/amber_minimize.py
openfold/np/relax/amber_minimize.py
+2
-2
run_pretrained_openfold.py
run_pretrained_openfold.py
+4
-4
No files found.
openfold/data/tools/utils.py
View file @
5a928b47
...
...
@@ -36,9 +36,9 @@ def tmpdir_manager(base_dir: Optional[str] = None):
@
contextlib
.
contextmanager
def
timing
(
msg
:
str
):
logging
.
info
(
"Started %s"
,
msg
)
tic
=
time
.
time
()
tic
=
time
.
perf_counter
()
yield
toc
=
time
.
time
()
toc
=
time
.
perf_counter
()
logging
.
info
(
"Finished %s in %.3f seconds"
,
msg
,
toc
-
tic
)
...
...
openfold/np/relax/amber_minimize.py
View file @
5a928b47
...
...
@@ -435,7 +435,7 @@ def _run_one_iteration(
tolerance
=
tolerance
*
ENERGY
stiffness
=
stiffness
*
ENERGY
/
(
LENGTH
**
2
)
start
=
time
.
time
()
start
=
time
.
perf_counter
()
minimized
=
False
attempts
=
0
while
not
minimized
and
attempts
<
max_attempts
:
...
...
@@ -457,7 +457,7 @@ def _run_one_iteration(
logging
.
info
(
e
)
if
not
minimized
:
raise
ValueError
(
f
"Minimization failed after
{
max_attempts
}
attempts."
)
ret
[
"opt_time"
]
=
time
.
time
()
-
start
ret
[
"opt_time"
]
=
time
.
perf_counter
()
-
start
ret
[
"min_attempts"
]
=
attempts
return
ret
...
...
run_pretrained_openfold.py
View file @
5a928b47
...
...
@@ -138,9 +138,9 @@ def main(args):
for
k
,
v
in
batch
.
items
()
}
t
=
time
.
time
()
t
=
time
.
perf_counter
()
out
=
model
(
batch
)
logging
.
info
(
f
"Inference time:
{
time
.
time
()
-
t
}
"
)
logging
.
info
(
f
"Inference time:
{
time
.
perf_counter
()
-
t
}
"
)
# Toss out the recycling dimensions --- we don't need them anymore
batch
=
tensor_tree_map
(
lambda
x
:
np
.
array
(
x
[...,
-
1
].
cpu
()),
batch
)
...
...
@@ -164,9 +164,9 @@ def main(args):
)
# Relax the prediction.
t
=
time
.
time
()
t
=
time
.
perf_counter
()
relaxed_pdb_str
,
_
,
_
=
amber_relaxer
.
process
(
prot
=
unrelaxed_protein
)
logging
.
info
(
f
"Relaxation time:
{
time
.
time
()
-
t
}
"
)
logging
.
info
(
f
"Relaxation time:
{
time
.
perf_counter
()
-
t
}
"
)
# Save the relaxed PDB.
relaxed_output_path
=
os
.
path
.
join
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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