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
darshan
darshan
Commits
4912d57e
Commit
4912d57e
authored
Aug 06, 2020
by
Jakob Luettgau
Browse files
Refactor the mode switch to be named dtype, update documentation.
parent
c82301c4
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
darshan-util/pydarshan/darshan/backend/cffi_backend.py
View file @
4912d57e
...
...
@@ -359,13 +359,16 @@ def log_get_generic_record(log, mod_name, mod_type, mode='numpy'):
fcdict
=
dict
(
zip
(
fcounter_names
(
mod_name
),
rec
[
'fcounters'
]))
if
mode
==
"dict"
:
rec
=
{
'counters'
:
cdict
,
'fcounter'
:
fcdict
}
rec
.
update
({
'counters'
:
cdict
,
'fcounters'
:
fcdict
})
if
mode
==
"pandas"
:
rec
=
{
'counters'
:
pd
.
DataFrame
(
cdict
,
index
=
[
0
]),
'fcounters'
:
pd
.
DataFrame
(
fcdict
,
index
=
[
0
])
}
rec
.
update
(
{
'counters'
:
pd
.
DataFrame
(
cdict
,
index
=
[
0
]),
'fcounters'
:
pd
.
DataFrame
(
fcdict
,
index
=
[
0
])
}
)
return
rec
...
...
darshan-util/pydarshan/darshan/report.py
View file @
4912d57e
...
...
@@ -278,13 +278,13 @@ class DarshanReport(object):
pass
def
mod_read_all_records
(
self
,
mod
,
mod
e
=
'numpy'
,
warnings
=
True
):
def
mod_read_all_records
(
self
,
mod
,
dtyp
e
=
'numpy'
,
warnings
=
True
):
"""
Reads all generic records for module
Args:
mod (str): Identifier of module to fetch all records
mod
e (str): 'numpy' for ndarray (default), 'dict' for python dictionary
dtyp
e (str): 'numpy' for ndarray (default), 'dict' for python dictionary
, 'pandas'
Return:
None
...
...
@@ -314,16 +314,18 @@ class DarshanReport(object):
self
.
counters
[
mod
][
'fcounters'
]
=
fcn
rec
=
backend
.
log_get_generic_record
(
self
.
log
,
mod
,
structdefs
[
mod
],
mode
=
mod
e
)
rec
=
backend
.
log_get_generic_record
(
self
.
log
,
mod
,
structdefs
[
mod
],
mode
=
dtyp
e
)
while
rec
!=
None
:
if
mod
e
==
'pandas'
:
if
dtyp
e
==
'pandas'
:
self
.
records
[
mod
].
append
(
rec
)
if
mod
e
==
'numpy'
:
if
dtyp
e
==
'numpy'
:
self
.
records
[
mod
].
append
(
rec
)
else
:
c
=
dict
(
zip
(
cn
,
rec
[
'counters'
]))
fc
=
dict
(
zip
(
fcn
,
rec
[
'fcounters'
]))
self
.
records
[
mod
].
append
([
c
,
fc
])
self
.
records
[
mod
].
append
(
rec
)
#c = dict(zip(cn, rec['counters']))
#fc = dict(zip(fcn, rec['fcounters']))
#self.records[mod].append([c])
self
.
modules
[
mod
][
'num_records'
]
+=
1
...
...
@@ -331,16 +333,26 @@ class DarshanReport(object):
# fetch next
rec
=
backend
.
log_get_generic_record
(
self
.
log
,
mod
,
structdefs
[
mod
])
# process/combine records if the format dtype allows for this
if
dtype
==
'pandas'
:
# TODO: merge pandas
#self.records[mod].append(rec)
pass
pass
def
mod_read_all_dxt_records
(
self
,
mod
,
mod
e
=
'numpy'
,
warnings
=
True
,
reads
=
True
,
writes
=
True
):
def
mod_read_all_dxt_records
(
self
,
mod
,
dtyp
e
=
'numpy'
,
warnings
=
True
,
reads
=
True
,
writes
=
True
):
"""
Reads all dxt records for provided module.
Args:
mod (str): Identifier of module to fetch all records
mod
e (str): 'numpy' for ndarray (default), 'dict' for python dictionary
dtyp
e (str): 'numpy' for ndarray (default), 'dict' for python dictionary
Return:
None
...
...
@@ -377,7 +389,7 @@ class DarshanReport(object):
rec
=
backend
.
log_get_dxt_record
(
self
.
log
,
mod
,
structdefs
[
mod
])
while
rec
!=
None
:
if
mod
e
==
'numpy'
:
if
dtyp
e
==
'numpy'
:
self
.
records
[
mod
].
append
(
rec
)
else
:
print
(
"Not implemented."
)
...
...
@@ -397,7 +409,7 @@ class DarshanReport(object):
pass
def
mod_records
(
self
,
mod
,
mod
e
=
'numpy'
,
warnings
=
True
):
def
mod_records
(
self
,
mod
,
dtyp
e
=
'numpy'
,
warnings
=
True
):
"""
Return generator for lazy record loading and traversal.
...
...
@@ -405,7 +417,7 @@ class DarshanReport(object):
Args:
mod (str): Identifier of module to fetch records for
mod
e (str): 'numpy' for ndarray (default), 'dict' for python dictionary
dtyp
e (str): 'numpy' for ndarray (default), 'dict' for python dictionary
Return:
None
...
...
@@ -419,7 +431,7 @@ class DarshanReport(object):
self
.
counters
[
mod
][
'counters'
]
=
cn
self
.
counters
[
mod
][
'fcounters'
]
=
fcn
rec
=
backend
.
log_get_generic_record
(
self
.
log
,
mod
,
structdefs
[
mod
],
mode
=
mod
e
)
rec
=
backend
.
log_get_generic_record
(
self
.
log
,
mod
,
structdefs
[
mod
],
mode
=
dtyp
e
)
while
rec
!=
None
:
yield
rec
...
...
darshan-util/pydarshan/examples/01_darshan-introduction.ipynb
View file @
4912d57e
This diff is collapsed.
Click to expand it.
darshan-util/pydarshan/examples/99-graph-visualization.ipynb
View file @
4912d57e
This diff is collapsed.
Click to expand it.
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