Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiling with PPE for Local #326

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Profiling with PPE for Local #326

wants to merge 7 commits into from

Conversation

kuenishi
Copy link
Member

PR draft to discuss the base design for #258.

With a test script like below:

import pytorch_pfn_extras as ppe

from pfio.v2 import Local, Path

@ppe.profiler.record_function("my_tag_2")
def my_run2(x):
    pass

def my_run1(x):
    pass

def p():
    with ppe.profiler.record("my_tag_1"):
        my_run1('hoge')

    for i in range(10):
        my_run2("far")

    total = 0
    count = 0
            
    p = Path()
    for f in p.glob("*"):
        s = f.stat()
        total += s.size
        count += 1

    d = 0
    with Local() as fs:
        for f in fs.list():
            if fs.isdir(f.strip()):
                d += 1
                continue
                
            len(fs.open(f).read())

    print(count - d, "files", d, "dirs", total, "bytes for files")

    ts = ppe.profiler.get_time_summary()

    with ts.summary() as o:
        print(o)

p()

It yields a result like this:

$ python p.py
15 files 13 dirs 8490 bytes for files
(<pytorch_pfn_extras.reporting.DictSummary object at 0x7fae6b3204d0>, {'my_tag_1.min': 9.5367431640625e-06, 'my_tag_1
.max': 9.5367431640625e-06, 'my_tag_2.min': 9.5367431640625e-07, 'my_tag_2.max': 2.86102294921875e-06, 'local-stat.mi
n': 9.059906005859375e-06, 'local-stat.max': 4.9591064453125e-05, 'local-open.min': 1.3828277587890625e-05, 'local-op
en.max': 6.914138793945312e-05, 'local-list.min': 6.9141387939453125e-06, 'local-list.max': 0.00014781951904296875})

@kuenishi kuenishi changed the title Profiling with PPE Profiling with PPE for Local Sep 13, 2023
@kuenishi kuenishi mentioned this pull request Sep 13, 2023
7 tasks
@kuenishi kuenishi requested a review from y1r September 13, 2023 07:38
@kuenishi kuenishi marked this pull request as ready for review September 13, 2023 07:39
@kuenishi kuenishi added this to the 2.7.0 milestone Sep 13, 2023
@kuenishi kuenishi added the cat:feature Implementation that introduces new interfaces. label Sep 13, 2023
@kuenishi
Copy link
Member Author

Latest:

$ python p.py
15 files 13 dirs 8491 bytes for files
(<pytorch_pfn_extras.reporting.DictSummary object at 0x7f5bbc7207d0>, {'my_tag_1.min': 1.0967254638671875e-05, 'my_ta
g_1.max': 1.0967254638671875e-05, 'my_tag_2.min': 7.152557373046875e-07, 'my_tag_2.max': 3.0994415283203125e-06, 'pfi
o.v2.Local:glob.min': 0.0004813671112060547, 'pfio.v2.Local:glob.max': 0.0004813671112060547, 'pfio.v2.Local:stat.min
': 8.106231689453125e-06, 'pfio.v2.Local:stat.max': 0.00011372566223144531, 'pfio.v2.Local:open.min': 1.3113021850585
938e-05, 'pfio.v2.Local:open.max': 6.628036499023438e-05, 'pfio.v2.Local:list.min': 8.344650268554688e-06, 'pfio.v2.L
ocal:list.max': 0.0001614093780517578})

Copy link
Member

@y1r y1r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for providing the base design. Overall, LGTM.

Several questions are following:

  • Writing annotations in all FS seems complicated, is it possible to implement them in FS (interface) and then override them if necessary?
  • How do you calculate the cache hit rate in this design? Count call rate of slow FS?
  • How do you measure read/write performance?

@@ -4,6 +4,22 @@
import shutil
from typing import Optional

try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation should be in pfio/v2/_profiler.py or pfio/_profiler.py because these noop implementation will be used in all FS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:feature Implementation that introduces new interfaces.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants