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

Make pyperformance runnable from --disable-gil builds #116024

Open
2 of 3 tasks
Tracked by #108219
corona10 opened this issue Feb 28, 2024 · 13 comments
Open
2 of 3 tasks
Tracked by #108219

Make pyperformance runnable from --disable-gil builds #116024

corona10 opened this issue Feb 28, 2024 · 13 comments
Assignees

Comments

@corona10
Copy link
Member

corona10 commented Feb 28, 2024

Under investigation, psutil has an issued with running pypeformance and pyperf (essential one).
With manual uninstalling psutil from pyperf and pyperformance, running the script itself is okay.
So the main issue is related to psutil package.
(Need to investigate essential issue from now on)

We need to fix psutil-related code for the free-threaded build to benchmark performance exactly.
Since psutil in pyperf only used for memory usage checking and disabling psutil from pyperf for free-threaded build for a while, it is acceptable (CPU counting also depends on psutils but it has fallback logic, so it's okay)

For action items

Backtrace
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff0)
  * frame #0: 0x000000018b8a2dc4 libsystem_platform.dylib`_platform_strlen + 4
    frame #1: 0x000000018b70e348 libsystem_c.dylib`__vfprintf + 5120
    frame #2: 0x000000018b71c4c8 libsystem_c.dylib`vfprintf_l + 68
    frame #3: 0x000000018b736fa4 libsystem_c.dylib`printf + 80
    frame #4: 0x00000001000fc070 python`_PyModule_CreateInitialized(module=0x0000000100a88330, module_api_version=3) at moduleobject.c:213:5 [opt]
    frame #5: 0x0000000100a7d630 _psutil_osx.abi3.so`PyInit__psutil_osx + 28
    frame #6: 0x0000000100241e34 python`_PyImport_LoadDynamicModuleWithSpec(spec=0x0000020000474ad0, fp=<unavailable>) at importdl.c:170:9 [opt]
    frame #7: 0x0000000100241558 python`_imp_create_dynamic [inlined] _imp_create_dynamic_impl(module=<unavailable>, spec=0x0000020000474ad0, file=0x0000000000000000) at import.c:3750:11 [opt]
    frame #8: 0x00000001002414f4 python`_imp_create_dynamic(module=<unavailable>, args=0x0000020000631fc8, nargs=<unavailable>) at import.c.h:485:20 [opt]
    frame #9: 0x00000001000fa5fc python`cfunction_vectorcall_FASTCALL(func=0x00000200003082e0, args=0x0000020000631fc8, nargsf=1, kwnames=<unavailable>) at methodobject.c:425:24 [opt]
    frame #10: 0x00000001001d82a8 python`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=0) at generated_cases.c.h:1245:26 [opt]
    frame #11: 0x0000000100091990 python`_PyObject_VectorcallTstate(tstate=0x000000010059c288, callable=0x00000200003d4210, args=0x000000016fdf9df0, nargsf=2, kwnames=0x0000000000000000) at pycore_call.h:168:11 [opt]
    frame #12: 0x0000000100093c54 python`object_vacall(tstate=0x000000010059c288, base=0x0000000000000000, callable=0x00000200003d4210, vargs="") at call.c:819:14 [opt]
    frame #13: 0x0000000100093a78 python`PyObject_CallMethodObjArgs(obj=<unavailable>, name=<unavailable>) at call.c:880:24 [opt]
    frame #14: 0x000000010023e5e0 python`PyImport_ImportModuleLevelObject [inlined] import_find_and_load(tstate=0x000000010059c288, abs_name=0x0000020000d0d6e0) at import.c:2758:11 [opt]
    frame #15: 0x000000010023e4dc python`PyImport_ImportModuleLevelObject(name=0x0000020000d0d6e0, globals=<unavailable>, locals=<unavailable>, fromlist=0x0000000000000000, level=0) at import.c:2838:15 [opt]
    frame #16: 0x00000001001cc478 python`builtin___import__ [inlined] builtin___import___impl(module=<unavailable>, name=0x0000020000d0d6e0, globals=0x0000000000000000, locals=0x0000000000000000, fromlist=0x0000000000000000, level=<unavailable>) at bltinmodule.c:280:12 [opt]
    frame #17: 0x00000001001cc464 python`builtin___import__(module=<unavailable>, args=<unavailable>, nargs=<unavailable>, kwnames=<unavailable>) at bltinmodule.c.h:107:20 [opt]
    frame #18: 0x00000001000fa70c python`cfunction_vectorcall_FASTCALL_KEYWORDS(func=0x0000020000304ca0, args=0x00000200006314d8, nargsf=1, kwnames=0x0000000000000000) at methodobject.c:441:24 [opt]
    frame #19: 0x00000001001d82a8 python`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=0) at generated_cases.c.h:1245:26 [opt]
    frame #20: 0x0000000100091990 python`_PyObject_VectorcallTstate(tstate=0x000000010059c288, callable=0x00000200003d4390, args=0x000000016fdfa360, nargsf=3, kwnames=0x0000000000000000) at pycore_call.h:168:11 [opt]
    frame #21: 0x0000000100093c54 python`object_vacall(tstate=0x000000010059c288, base=0x0000000000000000, callable=0x00000200003d4390, vargs="") at call.c:819:14 [opt]
    frame #22: 0x0000000100093a78 python`PyObject_CallMethodObjArgs(obj=<unavailable>, name=<unavailable>) at call.c:880:24 [opt]
    frame #23: 0x000000010023e6d4 python`PyImport_ImportModuleLevelObject(name=0x00000001005651e8, globals=<unavailable>, locals=<unavailable>, fromlist=0x0000020000631280, level=1) at import.c:2906:25 [opt]
    frame #24: 0x00000001001ea5cc python`_PyEval_EvalFrameDefault at ceval.c:2625:16 [opt]
    frame #25: 0x00000001001ea430 python`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=0) at generated_cases.c.h:2876:19 [opt]
    frame #26: 0x00000001001d2df4 python`_PyEval_Vector [inlined] _PyEval_EvalFrame(tstate=<unavailable>, frame=<unavailable>, throwflag=<unavailable>) at pycore_ceval.h:114:16 [opt] [artificial]
    frame #27: 0x00000001001d2b60 python`PyEval_EvalCode(co=0x0000020000c33810, globals=0x00000200006217b0, locals=0x00000200006217b0) at ceval.c:593:21 [opt]
    frame #28: 0x00000001001cdbac python`builtin_exec at bltinmodule.c:1135:17 [opt]
    frame #29: 0x00000001001cd90c python`builtin_exec(module=<unavailable>, args=<unavailable>, nargs=<unavailable>, kwnames=<unavailable>) at bltinmodule.c.h:521:20 [opt]
    frame #30: 0x00000001000fa70c python`cfunction_vectorcall_FASTCALL_KEYWORDS(func=0x00000200003052c0, args=0x0000020000621778, nargsf=2, kwnames=0x0000000000000000) at methodobject.c:441:24 [opt]
    frame #31: 0x00000001001d82a8 python`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=0) at generated_cases.c.h:1245:26 [opt]
    frame #32: 0x0000000100091990 python`_PyObject_VectorcallTstate(tstate=0x000000010059c288, callable=0x00000200003d4210, args=0x000000016fdfac40, nargsf=2, kwnames=0x0000000000000000) at pycore_call.h:168:11 [opt]
    frame #33: 0x0000000100093c54 python`object_vacall(tstate=0x000000010059c288, base=0x0000000000000000, callable=0x00000200003d4210, vargs="") at call.c:819:14 [opt]
    frame #34: 0x0000000100093a78 python`PyObject_CallMethodObjArgs(obj=<unavailable>, name=<unavailable>) at call.c:880:24 [opt]
    frame #35: 0x000000010023e5e0 python`PyImport_ImportModuleLevelObject [inlined] import_find_and_load(tstate=0x000000010059c288, abs_name=0x0000020000d0c790) at import.c:2758:11 [opt]
    frame #36: 0x000000010023e4dc python`PyImport_ImportModuleLevelObject(name=0x0000020000d0c790, globals=<unavailable>, locals=<unavailable>, fromlist=0x0000000000000000, level=0) at import.c:2838:15 [opt]
    frame #37: 0x00000001001cc478 python`builtin___import__ [inlined] builtin___import___impl(module=<unavailable>, name=0x0000020000d0c790, globals=0x0000000000000000, locals=0x0000000000000000, fromlist=0x0000000000000000, level=<unavailable>) at bltinmodule.c:280:12 [opt]
    frame #38: 0x00000001001cc464 python`builtin___import__(module=<unavailable>, args=<unavailable>, nargs=<unavailable>, kwnames=<unavailable>) at bltinmodule.c.h:107:20 [opt]
    frame #39: 0x00000001000fa70c python`cfunction_vectorcall_FASTCALL_KEYWORDS(func=0x0000020000304ca0, args=0x0000020000630ad8, nargsf=1, kwnames=0x0000000000000000) at methodobject.c:441:24 [opt]
    frame #40: 0x00000001001d82a8 python`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=0) at generated_cases.c.h:1245:26 [opt]
    frame #41: 0x0000000100091990 python`_PyObject_VectorcallTstate(tstate=0x000000010059c288, callable=0x00000200003d4390, args=0x000000016fdfb1b0, nargsf=3, kwnames=0x0000000000000000) at pycore_call.h:168:11 [opt]
    frame #42: 0x0000000100093c54 python`object_vacall(tstate=0x000000010059c288, base=0x0000000000000000, callable=0x00000200003d4390, vargs="") at call.c:819:14 [opt]
    frame #43: 0x0000000100093a78 python`PyObject_CallMethodObjArgs(obj=<unavailable>, name=<unavailable>) at call.c:880:24 [opt]
    frame #44: 0x000000010023e6d4 python`PyImport_ImportModuleLevelObject(name=0x00000001005651e8, globals=<unavailable>, locals=<unavailable>, fromlist=0x0000020000ae5f10, level=1) at import.c:2906:25 [opt]
    frame #45: 0x00000001001ea5cc python`_PyEval_EvalFrameDefault at ceval.c:2625:16 [opt]
    frame #46: 0x00000001001ea430 python`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=0) at generated_cases.c.h:2876:19 [opt]
    frame #47: 0x00000001001d2df4 python`_PyEval_Vector [inlined] _PyEval_EvalFrame(tstate=<unavailable>, frame=<unavailable>, throwflag=<unavailable>) at pycore_ceval.h:114:16 [opt] [artificial]
    frame #48: 0x00000001001d2b60 python`PyEval_EvalCode(co=0x00000200002bb610, globals=0x0000020000c75e30, locals=0x0000020000c75e30) at ceval.c:593:21 [opt]
    frame #49: 0x00000001001cdbac python`builtin_exec at bltinmodule.c:1135:17 [opt]
    frame #50: 0x00000001001cd90c python`builtin_exec(module=<unavailable>, args=<unavailable>, nargs=<unavailable>, kwnames=<unavailable>) at bltinmodule.c.h:521:20 [opt]
    frame #51: 0x00000001000fa70c python`cfunction_vectorcall_FASTCALL_KEYWORDS(func=0x00000200003052c0, args=0x00000200006215f8, nargsf=2, kwnames=0x0000000000000000) at methodobject.c:441:24 [opt]
    frame #52: 0x00000001001d82a8 python`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=0) at generated_cases.c.h:1245:26 [opt]
    frame #53: 0x0000000100091990 python`_PyObject_VectorcallTstate(tstate=0x000000010059c288, callable=0x00000200003d4210, args=0x000000016fdfba90, nargsf=2, kwnames=0x0000000000000000) at pycore_call.h:168:11 [opt]
    frame #54: 0x0000000100093c54 python`object_vacall(tstate=0x000000010059c288, base=0x0000000000000000, callable=0x00000200003d4210, vargs="") at call.c:819:14 [opt]
    frame #55: 0x0000000100093a78 python`PyObject_CallMethodObjArgs(obj=<unavailable>, name=<unavailable>) at call.c:880:24 [opt]
    frame #56: 0x000000010023e5e0 python`PyImport_ImportModuleLevelObject [inlined] import_find_and_load(tstate=0x000000010059c288, abs_name=0x0000020000d0a650) at import.c:2758:11 [opt]
    frame #57: 0x000000010023e4dc python`PyImport_ImportModuleLevelObject(name=0x0000020000d0a650, globals=<unavailable>, locals=<unavailable>, fromlist=0x0000000000000000, level=0) at import.c:2838:15 [opt]
    frame #58: 0x00000001001cc478 python`builtin___import__ [inlined] builtin___import___impl(module=<unavailable>, name=0x0000020000d0a650, globals=0x0000000000000000, locals=0x0000000000000000, fromlist=0x0000000000000000, level=<unavailable>) at bltinmodule.c:280:12 [opt]
    frame #59: 0x00000001001cc464 python`builtin___import__(module=<unavailable>, args=<unavailable>, nargs=

cc @mdboom @colesbury @giampaolo

@corona10

This comment was marked as resolved.

@corona10
Copy link
Member Author

corona10 commented Feb 28, 2024

Ah, it looks like, psutil should publish package for free-threaded build :(
We need to use sdist build for a while. I will take a look at what can we do.

creating stub loader for psutil/_psutil_osx.cpython-313t-darwin.so
creating stub loader for psutil/_psutil_posix.cpython-313t-darwin.so

@corona10
Copy link
Member Author

corona10 commented Feb 28, 2024

I need to read https://discuss.python.org/t/python-abis-and-pep-703/ :)
Anyway, this is not a psutil source code issue but more a packaging issue.

@colesbury
Copy link
Contributor

I think the fixes are already upstream, but need a new release of pypa/packaging and an update and release of pip.

See pypa/packaging#755

@vstinner
Copy link
Member

vstinner commented Mar 5, 2024

Under investigation, psutil has an issued with running pypeformance and pyperf (essential one).

Which issue? It cannot be installed? It does crash?

@corona10
Copy link
Member Author

corona10 commented Mar 5, 2024

Which issue? It cannot be installed? It does crash?

#116024 (comment)

@corona10
Copy link
Member Author

corona10 commented Mar 9, 2024

https://pypi.org/project/pyperformance/1.11.0/ is released, use this version for a while.

@corona10
Copy link
Member Author

For psutil, @colesbury submitted the patch. giampaolo/psutil#2402

@xbit18
Copy link

xbit18 commented Jun 12, 2024

Hi, so is this issue solved? I tried running pyperformance with 3.13.0b2 and had no problems but I remembered this issue and wondered if I was missing something.

@corona10
Copy link
Member Author

@xbit18 well, pyperformance should re-enable psutil for free-threaded build, it is not fixed yet.

@xbit18
Copy link

xbit18 commented Jun 20, 2024

@xbit18 well, pyperformance should re-enable psutil for free-threaded build, it is not fixed yet.

Thanks for the answer. Just for clarity, what's the use of psutil?

@colesbury
Copy link
Contributor

I think it's used by pyperf for tracking peak memory usage and counting the number of CPUs.

@xbit18
Copy link

xbit18 commented Jun 20, 2024

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants