Skip to content

Instantly share code, notes, and snippets.

@smarr

smarr/01.log-x86 Secret

Last active November 14, 2023 23:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarr/684e71be23a0a393f06739e0303cbc70 to your computer and use it in GitHub Desktop.
Save smarr/684e71be23a0a393f06739e0303cbc70 to your computer and use it in GitHub Desktop.
Python GIL Semantics
GIL Semantics Test Runner
=========================
Generated by runner.py in https://github.com/smarr/gil-sem-demos
Testing the following versions:
../cpython38/python Python 3.8.18+
../cpython39/python Python 3.9.18+
../cpython310/python Python 3.10.13+
../cpython311/python Python 3.11.6+
../cpython312/python Python 3.12.0+
../cpython313/python Python 3.13.0a1+
../cpython313-disable-gil/python Python 3.13.0a1+
../cpython-colesbury-nogil/python Python 3.12.0a4
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 Python 3.9.18 (c5262994620471e725f57d652d78d842270649d6, Sep 27 2023, 13:43:44), [PyPy 7.3.13 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 Python 3.10.13 (f1607341da97ff5a1e93430b6e8c4af0ad1aa019, Sep 28 2023, 05:41:26), [PyPy 7.3.13 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]
/data/home/cur/sm951/.local/graalpy/bin/graalpy GraalPy 3.10.8 (Oracle GraalVM Native 23.1.0)
001_perf_benefit.py
-------------------
Demonstrate the impact of switching threads and no-GIL on performance.
../cpython38/python 001_perf_benefit.py Completed Time taken: 21291 ms
../cpython38/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 24987 ms
../cpython39/python 001_perf_benefit.py Completed Time taken: 21808 ms
../cpython39/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 25818 ms
../cpython310/python 001_perf_benefit.py Completed Time taken: 20978 ms
../cpython310/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 24861 ms
../cpython311/python 001_perf_benefit.py Completed Time taken: 16966 ms
../cpython311/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 20788 ms
../cpython312/python 001_perf_benefit.py Completed Time taken: 20005 ms
../cpython312/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 23216 ms
../cpython313/python 001_perf_benefit.py Completed Time taken: 21842 ms
../cpython313/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 27912 ms
../cpython313-disable-gil/python 001_perf_benefit.py Completed Time taken: 23362 ms
../cpython313-disable-gil/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 27353 ms
../cpython-colesbury-nogil/python 001_perf_benefit.py Completed Time taken: 326 ms
../cpython-colesbury-nogil/python 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 330 ms
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 001_perf_benefit.py Completed Time taken: 545 ms
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 14115 ms
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 001_perf_benefit.py Completed Time taken: 547 ms
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 13800 ms
/data/home/cur/sm951/.local/graalpy/bin/graalpy 001_perf_benefit.py Completed Time taken: 445 ms
/data/home/cur/sm951/.local/graalpy/bin/graalpy 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 492 ms
010_conc_insert.py
------------------
Check whether a loop with len;in can observe non-atomic behavior
when another thread is running a loop with append;pop.
../cpython38/python 010_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython38/python 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython39/python 010_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython39/python 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython310/python 010_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython310/python 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython311/python 010_conc_insert.py Completed
../cpython311/python 010_conc_insert.py --minimal-switch-interval Completed
../cpython312/python 010_conc_insert.py Completed
../cpython312/python 010_conc_insert.py --minimal-switch-interval Completed
../cpython313/python 010_conc_insert.py Completed
../cpython313/python 010_conc_insert.py --minimal-switch-interval Completed
../cpython313-disable-gil/python 010_conc_insert.py Completed
../cpython313-disable-gil/python 010_conc_insert.py --minimal-switch-interval Completed
../cpython-colesbury-nogil/python 010_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython-colesbury-nogil/python 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 010_conc_insert.py Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 010_conc_insert.py Completed
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
/data/home/cur/sm951/.local/graalpy/bin/graalpy 010_conc_insert.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 010_conc_insert.py --minimal-switch-interval Completed
011_conc_insert.py
------------------
Check whether a loop with len;list[0] can observe non-atomic behavior
when another thread is running a loop with append;pop.
../cpython38/python 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython38/python 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython39/python 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython39/python 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython310/python 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython310/python 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython311/python 011_conc_insert.py Completed
../cpython311/python 011_conc_insert.py --minimal-switch-interval Completed
../cpython312/python 011_conc_insert.py Completed
../cpython312/python 011_conc_insert.py --minimal-switch-interval Completed
../cpython313/python 011_conc_insert.py Completed
../cpython313/python 011_conc_insert.py --minimal-switch-interval Completed
../cpython313-disable-gil/python 011_conc_insert.py Completed
../cpython313-disable-gil/python 011_conc_insert.py --minimal-switch-interval Completed
../cpython-colesbury-nogil/python 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython-colesbury-nogil/python 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 011_conc_insert.py Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
/data/home/cur/sm951/.local/graalpy/bin/graalpy 011_conc_insert.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 011_conc_insert.py --minimal-switch-interval Completed
012_conc_insert.py
------------------
Check whether a loop with len;in can observe non-atomic behavior
when another thread is running a loop with append;pop;append;pop.
../cpython38/python 012_conc_insert.py Aborted loop bodies not atomic. length: 0, element in list: True
../cpython38/python 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 1, element in list: False
../cpython39/python 012_conc_insert.py Aborted loop bodies not atomic. length: 1, element in list: False
../cpython39/python 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 0, element in list: True
../cpython310/python 012_conc_insert.py Aborted loop bodies not atomic. length: 0, element in list: True
../cpython310/python 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 1, element in list: False
../cpython311/python 012_conc_insert.py Completed
../cpython311/python 012_conc_insert.py --minimal-switch-interval Completed
../cpython312/python 012_conc_insert.py Completed
../cpython312/python 012_conc_insert.py --minimal-switch-interval Completed
../cpython313/python 012_conc_insert.py Completed
../cpython313/python 012_conc_insert.py --minimal-switch-interval Completed
../cpython313-disable-gil/python 012_conc_insert.py Completed
../cpython313-disable-gil/python 012_conc_insert.py --minimal-switch-interval Completed
../cpython-colesbury-nogil/python 012_conc_insert.py Aborted loop bodies not atomic. length: 1, element in list: False
../cpython-colesbury-nogil/python 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 0, element in list: True
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 012_conc_insert.py Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 0, element in list: True
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 012_conc_insert.py Completed
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 0, element in list: True
/data/home/cur/sm951/.local/graalpy/bin/graalpy 012_conc_insert.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 012_conc_insert.py --minimal-switch-interval Completed
020_conc_delete_insert.py
-------------------------
This one is to make sure that we cannot observe the list having a negative length.
This is an issue with some concurrent data structures on top of other
language implementations such as the JVM.
../cpython38/python 020_conc_delete_insert.py Completed
../cpython38/python 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython39/python 020_conc_delete_insert.py Completed
../cpython39/python 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython310/python 020_conc_delete_insert.py Completed
../cpython310/python 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython311/python 020_conc_delete_insert.py Completed
../cpython311/python 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython312/python 020_conc_delete_insert.py Completed
../cpython312/python 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython313/python 020_conc_delete_insert.py Completed
../cpython313/python 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython313-disable-gil/python 020_conc_delete_insert.py Completed
../cpython313-disable-gil/python 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython-colesbury-nogil/python 020_conc_delete_insert.py Completed
../cpython-colesbury-nogil/python 020_conc_delete_insert.py --minimal-switch-interval Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 020_conc_delete_insert.py Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 020_conc_delete_insert.py --minimal-switch-interval Completed
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 020_conc_delete_insert.py Completed
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 020_conc_delete_insert.py --minimal-switch-interval Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 020_conc_delete_insert.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 020_conc_delete_insert.py --minimal-switch-interval Completed
030_pics.py
-----------
This one is to test the lookup cache semantics.
This is more of a theoretical nature, and thus, not likely to show any issues.
The current implementations should not fail on this test.
../cpython38/python 030_pics.py Completed
../cpython38/python 030_pics.py --minimal-switch-interval Completed
../cpython39/python 030_pics.py Completed
../cpython39/python 030_pics.py --minimal-switch-interval Completed
../cpython310/python 030_pics.py Completed
../cpython310/python 030_pics.py --minimal-switch-interval Completed
../cpython311/python 030_pics.py Completed
../cpython311/python 030_pics.py --minimal-switch-interval Completed
../cpython312/python 030_pics.py Completed
../cpython312/python 030_pics.py --minimal-switch-interval Completed
../cpython313/python 030_pics.py Completed
../cpython313/python 030_pics.py --minimal-switch-interval Completed
../cpython313-disable-gil/python 030_pics.py Completed
../cpython313-disable-gil/python 030_pics.py --minimal-switch-interval Completed
../cpython-colesbury-nogil/python 030_pics.py Completed
../cpython-colesbury-nogil/python 030_pics.py --minimal-switch-interval Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 030_pics.py Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 030_pics.py --minimal-switch-interval Completed
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 030_pics.py Completed
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 030_pics.py --minimal-switch-interval Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 030_pics.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 030_pics.py --minimal-switch-interval Completed
040_conc_insert_pairs.py
------------------------
This is to demonstrate the granularity of the GIL.
This test is expected to "fail" and report how many tries it took before
seeing non-atomic loop bodies. The reported number depends on the used
Python implementation and version.
../cpython38/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 12971
../cpython38/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
../cpython39/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 13300
../cpython39/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 416
../cpython310/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython310/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
../cpython311/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython311/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 69
../cpython312/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython312/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 388
../cpython313/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython313/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
../cpython313-disable-gil/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 15381
../cpython313-disable-gil/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 328
../cpython-colesbury-nogil/python 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython-colesbury-nogil/python 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 040_conc_insert_pairs.py Aborted List length was 1 at attempt 707742
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 040_conc_insert_pairs.py Completed
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
/data/home/cur/sm951/.local/graalpy/bin/graalpy 040_conc_insert_pairs.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 040_conc_insert_pairs.py --minimal-switch-interval Completed
041_conc_insert_pairs.py
------------------------
This is to demonstrate the granularity of the GIL.
This test is expected to "fail" and report how many tries it took before
seeing non-atomic loop bodies. The reported number depends on the used
Python implementation and version.
../cpython38/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 79703
../cpython38/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 0
../cpython39/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 77595
../cpython39/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 364
../cpython310/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 57530
../cpython310/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 479
../cpython311/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 195289
../cpython311/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 0
../cpython312/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 56873
../cpython312/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 4381
../cpython313/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 0
../cpython313/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 6736
../cpython313-disable-gil/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 65362
../cpython313-disable-gil/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 2808
../cpython-colesbury-nogil/python 041_conc_insert_pairs.py Aborted List length was 1, at attempt 0
../cpython-colesbury-nogil/python 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 0
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 041_conc_insert_pairs.py Completed
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 3
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 041_conc_insert_pairs.py Aborted List length was 1, at attempt 0
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 9
/data/home/cur/sm951/.local/graalpy/bin/graalpy 041_conc_insert_pairs.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 041_conc_insert_pairs.py --minimal-switch-interval Completed
999_example_bug.py
------------------
This example is derived from https://github.com/deltachat/deltachat-core-rust/pull/4947
and demonstrates that the += operator is not atomic on some Python implementations/versions.
../cpython38/python 999_example_bug.py Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
../cpython38/python 999_example_bug.py --minimal-switch-interval Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 19919 times.
../cpython39/python 999_example_bug.py Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 19981 times.
../cpython39/python 999_example_bug.py --minimal-switch-interval Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20024 times.
../cpython310/python 999_example_bug.py Completed
../cpython310/python 999_example_bug.py --minimal-switch-interval Completed
../cpython311/python 999_example_bug.py Completed
../cpython311/python 999_example_bug.py --minimal-switch-interval Completed
../cpython312/python 999_example_bug.py Completed
../cpython312/python 999_example_bug.py --minimal-switch-interval Completed
../cpython313/python 999_example_bug.py Completed
../cpython313/python 999_example_bug.py --minimal-switch-interval Completed
../cpython313-disable-gil/python 999_example_bug.py Completed
../cpython313-disable-gil/python 999_example_bug.py --minimal-switch-interval Completed
../cpython-colesbury-nogil/python 999_example_bug.py Aborted *** stack smashing detected ***: terminated
../cpython-colesbury-nogil/python 999_example_bug.py --minimal-switch-interval Aborted
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 999_example_bug.py Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 19999 times.
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 999_example_bug.py --minimal-switch-interval Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 999_example_bug.py Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 999_example_bug.py --minimal-switch-interval Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
/data/home/cur/sm951/.local/graalpy/bin/graalpy 999_example_bug.py Completed
/data/home/cur/sm951/.local/graalpy/bin/graalpy 999_example_bug.py --minimal-switch-interval Completed
../cpython38/python Python 3.8.18+
Completed: 6
Aborted: 12
../cpython39/python Python 3.9.18+
Completed: 6
Aborted: 12
../cpython310/python Python 3.10.13+
Completed: 8
Aborted: 10
../cpython311/python Python 3.11.6+
Completed: 14
Aborted: 4
../cpython312/python Python 3.12.0+
Completed: 14
Aborted: 4
../cpython313/python Python 3.13.0a1+
Completed: 14
Aborted: 4
../cpython313-disable-gil/python Python 3.13.0a1+
Completed: 14
Aborted: 4
../cpython-colesbury-nogil/python Python 3.12.0a4
Completed: 6
Aborted: 12
/data/home/cur/sm951/.local/pypy39/bin/pypy3.9 Python 3.9.18 (c5262994620471e725f57d652d78d842270649d6, Sep 27 2023, 13:43:44)
Completed: 10
Aborted: 8
/data/home/cur/sm951/.local/pypy/bin/pypy3.10 Python 3.10.13 (f1607341da97ff5a1e93430b6e8c4af0ad1aa019, Sep 28 2023, 05:41:26)
Completed: 9
Aborted: 9
/data/home/cur/sm951/.local/graalpy/bin/graalpy GraalPy 3.10.8 (Oracle GraalVM Native 23.1.0)
Completed: 18
Aborted: 0
GIL Semantics Test Runner
=========================
Generated by runner.py in https://github.com/smarr/gil-sem-demos
Testing the following versions:
../cpython39/python.exe Python 3.9.18
../cpython310/python.exe Python 3.10.13
../cpython311/python.exe Python 3.11.6
../cpython312/python.exe Python 3.12.0
../cpython313/python.exe Python 3.13.0a1+
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 Python 3.9.18 (c5262994620471e725f57d652d78d842270649d6, Sep 27 2023, 16:18:04), [PyPy 7.3.13 with GCC Apple LLVM 13.1.6 (clang-1316.0.21.2.5)]
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 Python 3.10.13 (f1607341da97ff5a1e93430b6e8c4af0ad1aa019, Sep 28 2023, 20:47:55), [PyPy 7.3.13 with GCC Apple LLVM 13.1.6 (clang-1316.0.21.2.5)]
001_perf_benefit.py
-------------------
Demonstrate the impact of switching threads and no-GIL on performance.
../cpython39/python.exe 001_perf_benefit.py Completed Time taken: 2173 ms
../cpython39/python.exe 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 11445 ms
../cpython310/python.exe 001_perf_benefit.py Completed Time taken: 2107 ms
../cpython310/python.exe 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 11648 ms
../cpython311/python.exe 001_perf_benefit.py Completed Time taken: 1872 ms
../cpython311/python.exe 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 10134 ms
../cpython312/python.exe 001_perf_benefit.py Completed Time taken: 2194 ms
../cpython312/python.exe 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 13386 ms
../cpython313/python.exe 001_perf_benefit.py Completed Time taken: 2173 ms
../cpython313/python.exe 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 11644 ms
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 001_perf_benefit.py Completed Time taken: 196 ms
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 2731 ms
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 001_perf_benefit.py Completed Time taken: 196 ms
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 001_perf_benefit.py --minimal-switch-interval Completed Time taken: 2832 ms
010_conc_insert.py
------------------
Check whether a loop with len;in can observe non-atomic behavior
when another thread is running a loop with append;pop.
../cpython39/python.exe 010_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython39/python.exe 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython310/python.exe 010_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython310/python.exe 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython311/python.exe 010_conc_insert.py Completed
../cpython311/python.exe 010_conc_insert.py --minimal-switch-interval Completed
../cpython312/python.exe 010_conc_insert.py Completed
../cpython312/python.exe 010_conc_insert.py --minimal-switch-interval Completed
../cpython313/python.exe 010_conc_insert.py Completed
../cpython313/python.exe 010_conc_insert.py --minimal-switch-interval Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 010_conc_insert.py Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 010_conc_insert.py Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 010_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
011_conc_insert.py
------------------
Check whether a loop with len;list[0] can observe non-atomic behavior
when another thread is running a loop with append;pop.
../cpython39/python.exe 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython39/python.exe 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython310/python.exe 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../cpython310/python.exe 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../cpython311/python.exe 011_conc_insert.py Completed
../cpython311/python.exe 011_conc_insert.py --minimal-switch-interval Completed
../cpython312/python.exe 011_conc_insert.py Completed
../cpython312/python.exe 011_conc_insert.py --minimal-switch-interval Completed
../cpython313/python.exe 011_conc_insert.py Completed
../cpython313/python.exe 011_conc_insert.py --minimal-switch-interval Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 011_conc_insert.py Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 011_conc_insert.py Aborted append;pop not atomic, or not atomically observable. length: 1, element in list: False
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 011_conc_insert.py --minimal-switch-interval Aborted append;pop not atomic, or not atomically observable. length: 0, element in list: True
012_conc_insert.py
------------------
Check whether a loop with len;in can observe non-atomic behavior
when another thread is running a loop with append;pop;append;pop.
../cpython39/python.exe 012_conc_insert.py Aborted loop bodies not atomic. length: 1, element in list: False
../cpython39/python.exe 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 1, element in list: False
../cpython310/python.exe 012_conc_insert.py Aborted loop bodies not atomic. length: 0, element in list: True
../cpython310/python.exe 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 1, element in list: False
../cpython311/python.exe 012_conc_insert.py Completed
../cpython311/python.exe 012_conc_insert.py --minimal-switch-interval Completed
../cpython312/python.exe 012_conc_insert.py Completed
../cpython312/python.exe 012_conc_insert.py --minimal-switch-interval Completed
../cpython313/python.exe 012_conc_insert.py Completed
../cpython313/python.exe 012_conc_insert.py --minimal-switch-interval Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 012_conc_insert.py Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 0, element in list: True
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 012_conc_insert.py Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 012_conc_insert.py --minimal-switch-interval Aborted loop bodies not atomic. length: 0, element in list: True
020_conc_delete_insert.py
-------------------------
This one is to make sure that we cannot observe the list having a negative length.
This is an issue with some concurrent data structures on top of other
language implementations such as the JVM.
../cpython39/python.exe 020_conc_delete_insert.py Completed
../cpython39/python.exe 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython310/python.exe 020_conc_delete_insert.py Completed
../cpython310/python.exe 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython311/python.exe 020_conc_delete_insert.py Completed
../cpython311/python.exe 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython312/python.exe 020_conc_delete_insert.py Completed
../cpython312/python.exe 020_conc_delete_insert.py --minimal-switch-interval Completed
../cpython313/python.exe 020_conc_delete_insert.py Completed
../cpython313/python.exe 020_conc_delete_insert.py --minimal-switch-interval Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 020_conc_delete_insert.py Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 020_conc_delete_insert.py --minimal-switch-interval Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 020_conc_delete_insert.py Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 020_conc_delete_insert.py --minimal-switch-interval Completed
030_pics.py
-----------
This one is to test the lookup cache semantics.
This is more of a theoretical nature, and thus, not likely to show any issues.
The current implementations should not fail on this test.
../cpython39/python.exe 030_pics.py Completed
../cpython39/python.exe 030_pics.py --minimal-switch-interval Completed
../cpython310/python.exe 030_pics.py Completed
../cpython310/python.exe 030_pics.py --minimal-switch-interval Completed
../cpython311/python.exe 030_pics.py Completed
../cpython311/python.exe 030_pics.py --minimal-switch-interval Completed
../cpython312/python.exe 030_pics.py Completed
../cpython312/python.exe 030_pics.py --minimal-switch-interval Completed
../cpython313/python.exe 030_pics.py Completed
../cpython313/python.exe 030_pics.py --minimal-switch-interval Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 030_pics.py Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 030_pics.py --minimal-switch-interval Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 030_pics.py Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 030_pics.py --minimal-switch-interval Completed
040_conc_insert_pairs.py
------------------------
This is to demonstrate the granularity of the GIL.
This test is expected to "fail" and report how many tries it took before
seeing non-atomic loop bodies. The reported number depends on the used
Python implementation and version.
../cpython39/python.exe 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython39/python.exe 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
../cpython310/python.exe 040_conc_insert_pairs.py Aborted List length was 1 at attempt 565729
../cpython310/python.exe 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
../cpython311/python.exe 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython311/python.exe 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 59
../cpython312/python.exe 040_conc_insert_pairs.py Aborted List length was 1 at attempt 0
../cpython312/python.exe 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
../cpython313/python.exe 040_conc_insert_pairs.py Aborted List length was 1 at attempt 412268
../cpython313/python.exe 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 040_conc_insert_pairs.py Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 1
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 040_conc_insert_pairs.py Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 040_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1 at attempt 0
041_conc_insert_pairs.py
------------------------
This is to demonstrate the granularity of the GIL.
This test is expected to "fail" and report how many tries it took before
seeing non-atomic loop bodies. The reported number depends on the used
Python implementation and version.
../cpython39/python.exe 041_conc_insert_pairs.py Aborted List length was 1, at attempt 0
../cpython39/python.exe 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 85
../cpython310/python.exe 041_conc_insert_pairs.py Aborted List length was 1, at attempt 556708
../cpython310/python.exe 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 471
../cpython311/python.exe 041_conc_insert_pairs.py Aborted List length was 1, at attempt 974682
../cpython311/python.exe 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 949
../cpython312/python.exe 041_conc_insert_pairs.py Aborted List length was 1, at attempt 414733
../cpython312/python.exe 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 0
../cpython313/python.exe 041_conc_insert_pairs.py Aborted List length was 1, at attempt 1647573
../cpython313/python.exe 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 570
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 041_conc_insert_pairs.py Aborted List length was 1, at attempt 0
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 4
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 041_conc_insert_pairs.py Completed
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 041_conc_insert_pairs.py --minimal-switch-interval Aborted List length was 1, at attempt 0
999_example_bug.py
------------------
This example is derived from https://github.com/deltachat/deltachat-core-rust/pull/4947
and demonstrates that the += operator is not atomic on some Python implementations/versions.
../cpython39/python.exe 999_example_bug.py Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20006 times.
../cpython39/python.exe 999_example_bug.py --minimal-switch-interval Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 19976 times.
../cpython310/python.exe 999_example_bug.py Completed
../cpython310/python.exe 999_example_bug.py --minimal-switch-interval Completed
../cpython311/python.exe 999_example_bug.py Completed
../cpython311/python.exe 999_example_bug.py --minimal-switch-interval Completed
../cpython312/python.exe 999_example_bug.py Completed
../cpython312/python.exe 999_example_bug.py --minimal-switch-interval Completed
../cpython313/python.exe 999_example_bug.py Completed
../cpython313/python.exe 999_example_bug.py --minimal-switch-interval Completed
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 999_example_bug.py Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 999_example_bug.py --minimal-switch-interval Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 999_example_bug.py Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 999_example_bug.py --minimal-switch-interval Aborted += not atomic. If atomic, ids are used 2000 times, but one was used 20001 times.
../cpython39/python.exe Python 3.9.18
Completed: 6
Aborted: 12
../cpython310/python.exe Python 3.10.13
Completed: 8
Aborted: 10
../cpython311/python.exe Python 3.11.6
Completed: 14
Aborted: 4
../cpython312/python.exe Python 3.12.0
Completed: 14
Aborted: 4
../cpython313/python.exe Python 3.13.0a1+
Completed: 14
Aborted: 4
../pypy3.9-v7.3.13-macos_arm64/bin/pypy3.9 Python 3.9.18 (c5262994620471e725f57d652d78d842270649d6, Sep 27 2023, 16:18:04)
Completed: 10
Aborted: 8
../pypy3.10-v7.3.13-macos_arm64/bin/pypy3.10 Python 3.10.13 (f1607341da97ff5a1e93430b6e8c4af0ad1aa019, Sep 28 2023, 20:47:55)
Completed: 10
Aborted: 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment