Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-cp2k
Commits
cdfd5b09
Commit
cdfd5b09
authored
Mar 13, 2016
by
Lauri Himanen
Browse files
Added profiling script.
parent
2091f384
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
parser/parser-cp2k/cp2kparser/utils/baseclasses.py
View file @
cdfd5b09
...
...
@@ -393,7 +393,9 @@ class MainParser(HierarchicalParser):
process just override this method.
"""
# Initialize the parser builder
parserBuilder
=
SimpleParserBuilder
(
self
.
root_matcher
,
self
.
backend
.
metaInfoEnv
(),
self
.
metainfo_to_keep
,
units
=
self
.
parser_context
.
units
)
default_units
=
self
.
parser_context
.
default_units
metainfo_units
=
self
.
parser_context
.
metainfo_units
parserBuilder
=
SimpleParserBuilder
(
self
.
root_matcher
,
self
.
backend
.
metaInfoEnv
(),
self
.
metainfo_to_keep
,
default_units
=
default_units
,
metainfo_units
=
metainfo_units
)
# Verify the metainfo
if
not
parserBuilder
.
verifyMetaInfo
(
sys
.
stderr
):
...
...
@@ -415,8 +417,9 @@ class MainParser(HierarchicalParser):
defaultDataCachingLevel
=
self
.
default_data_caching_level
,
defaultSectionCachingLevel
=
self
.
default_section_caching_level
,
onClose
=
onClose
,
superBackend
=
self
.
backend
)
self
.
caching_backend
.
units
=
self
.
parser_context
.
units
superBackend
=
self
.
backend
,
default_units
=
default_units
,
metainfo_units
=
metainfo_units
)
# Compile the SimpleMatcher tree
parserBuilder
.
compile
()
...
...
@@ -452,10 +455,11 @@ class MainParser(HierarchicalParser):
class
ParserContext
(
object
):
"""Contains everything needed to instantiate a parser implementation.
"""
def
__init__
(
self
,
files
=
None
,
metainfo_to_keep
=
None
,
backend
=
None
,
version_id
=
None
,
main_file
=
None
,
units
=
None
):
def
__init__
(
self
,
files
=
None
,
metainfo_to_keep
=
None
,
backend
=
None
,
version_id
=
None
,
main_file
=
None
,
default_units
=
None
,
metainfo_
units
=
None
):
self
.
files
=
files
self
.
version_id
=
version_id
self
.
metainfo_to_keep
=
metainfo_to_keep
self
.
backend
=
backend
self
.
main_file
=
main_file
self
.
units
=
units
self
.
default_units
=
default_units
self
.
metainfo_units
=
metainfo_units
test/unittests/cp2k_2.6.2/BASIS_SET
0 → 100644
View file @
cdfd5b09
This diff is collapsed.
Click to expand it.
test/unittests/cp2k_2.6.2/GTH_POTENTIALS
0 → 100644
View file @
cdfd5b09
This diff is collapsed.
Click to expand it.
test/unittests/cp2k_2.6.2/energy_force/si_bulk8.out
0 → 100644
View file @
cdfd5b09
This diff is collapsed.
Click to expand it.
test/unittests/cp2k_2.6.2/profiling.py
0 → 100644
View file @
cdfd5b09
import
cProfile
import
pstats
from
run_tests
import
get_results
def
profile_energy_force
():
"""Used to profile the CPU usage in parsing RUN_TYPE ENERGY_FORCE.
"""
profile
=
cProfile
.
Profile
()
profile
.
run
(
'get_results("energy_force", "section_run")'
)
stats
=
pstats
.
Stats
(
profile
)
# stats.strip_dirs()
stats
.
sort_stats
(
"cumulative"
)
stats
.
print_stats
(
30
)
if
__name__
==
"__main__"
:
profile_energy_force
()
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