Skip to content

Commit

Permalink
Reorganize repo and prepare analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
mturilli committed Aug 21, 2019
1 parent 4ff04c2 commit f402736
Show file tree
Hide file tree
Showing 1,040 changed files with 476 additions and 0 deletions.
324 changes: 324 additions & 0 deletions analysis/bin/bin/notebook_utils.py

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions analysis/bin/bin/prrte_profiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python

import sys
import radical.utils as ru
import radical.pilot as rp
import radical.analytics as ra


# ------------------------------------------------------------------------------
#
if __name__ == '__main__':
if len(sys.argv) < 2:
print "\n\tusage: %s <session>\n" % sys.argv[0]
sys.exit(1)

src = sys.argv[1]
stype = 'radical.pilot'

session = ra.Session(src, stype)
units = session.filter(etype='unit', inplace=False)
unit_0 = units.get()[0]

print
print 'session: %s' % session.uid
print 'units: %d' % len(units.get())

# collect all events for some unit which relate to prte
nevents = list()
for e in unit_0.events:
if 'prte' in e[1]:
nevents.append(e)

# for that sample unit, print the events and timestamps (ordered)
print
print 'PRTE events for unit %s' % unit_0.uid
for e in nevents:
if 'prte' in e[1]:
print '%14.7f : %s' % (e[0], e[1])

# for all event pairs (neighbors), compute the duration for (a) the sample
# unit, and (b) the full session
print
print 'PRTE durations for unit %s and session' % unit_0.uid
idx = 0
while idx < len(nevents) - 1:

this = nevents[idx ][1]
that = nevents[idx + 1][1]
duru = unit_0.duration(
event=[{ru.STATE:rp.AGENT_EXECUTING, ru.EVENT:this},
{ru.STATE:rp.AGENT_EXECUTING, ru.EVENT:that}])
durs = units.duration(
event=[{ru.STATE:rp.AGENT_EXECUTING, ru.EVENT:this},
{ru.STATE:rp.AGENT_EXECUTING, ru.EVENT:that}])
print '%3d: %-30s to %-30s = %14.7f [%14.7f]' \
% (idx, this, that, duru, durs)
idx += 1

print
93 changes: 93 additions & 0 deletions analysis/bin/bin/prrte_profiler_multi_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env python

import sys

import radical.utils as ru
import radical.pilot as rp
import radical.analytics as ra


# ------------------------------------------------------------------------------
#
if __name__ == '__main__':

if len(sys.argv) < 2:
print "\n\tusage: %s <session> [...]\n" % sys.argv[0]
sys.exit(1)

session_csv = open('sessions_prte.csv', 'w')
unit_csv = open('units_prte.csv', 'w')

prte_events = list()

for src in sys.argv[1:]:

stype = 'radical.pilot'
session = ra.Session(src, stype)
units = session.filter(etype='unit', inplace=False)
unit_0 = units.get()[0]

print
print 'session: %s' % session.uid
print 'units: %d' % len(units.get())

# collect all events for some unit which relate to prte - if we don't
# have them yet
if not prte_events:
for e in unit_0.events:
if 'prte' in e[1]:
prte_events.append(e[1])
idx = 0
s_row = ['sid']
u_row = ['uid', 'sid']
while idx < len(prte_events) - 1:

this = prte_events[idx]
that = prte_events[idx + 1]
u_row.append('%s_to_%s' % (this, that))
s_row.append('%s_to_%s' % (this, that))
idx += 1
unit_csv.write('%s\n' % ','.join(u_row))
session_csv.write('%s\n' % ','.join(s_row))

# for all event pairs (neighbors), compute the duration for (a) the
# sample unit, and (b) the full session
print
idx = 0
s_row = [session.uid]
while idx < len(prte_events) - 1:

this = prte_events[idx]
that = prte_events[idx + 1]
duru = unit_0.duration(
event=[{ru.STATE: rp.AGENT_EXECUTING, ru.EVENT: this},
{ru.STATE: rp.AGENT_EXECUTING, ru.EVENT: that}])
dur = units.duration(
event=[{ru.STATE: rp.AGENT_EXECUTING, ru.EVENT: this},
{ru.STATE: rp.AGENT_EXECUTING, ru.EVENT: that}])

s_row.append('%.5f' % dur)
idx += 1
print '%3d: %-30s to %-30s = %14.7f [%14.7f]' \
% (idx, this, that, duru, dur)

session_csv.write('%s\n' % ','.join(s_row))

for unit in units.get():
u_row = [unit.uid, session.uid]
idx = 0
s_row = [session.uid]
while idx < len(prte_events) - 1:

this = prte_events[idx]
that = prte_events[idx + 1]
dur = unit_0.duration(
event=[{ru.STATE: rp.AGENT_EXECUTING, ru.EVENT: this},
{ru.STATE: rp.AGENT_EXECUTING, ru.EVENT: that}])
u_row.append('%.5f' % dur)
idx += 1

unit_csv.write('%s\n' % ','.join(u_row))

session_csv.close()
unit_csv.close()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
Loading

0 comments on commit f402736

Please sign in to comment.