|
1 |
| -Build container images for CPython, numpy, etc with sanitizer options enbled. |
| 1 | +Build container images for CPython, numpy, etc with sanitizer options enabled. |
| 2 | + |
| 3 | +Available container images |
| 4 | +-------------------------- |
| 5 | + |
| 6 | +Free-threaded Python builds with TSAN enabled: |
| 7 | + |
| 8 | + ghcr.io/nascheme/cpython-tsan:3.13t |
| 9 | + ghcr.io/nascheme/cpython-tsan:3.14t |
| 10 | + |
| 11 | +Above builds with "numpy" compiled with TSAN as well: |
| 12 | + |
| 13 | + ghcr.io/nascheme/numpy-tsan:3.13t |
| 14 | + ghcr.io/nascheme/numpy-tsan:3.14t |
| 15 | + |
| 16 | +Above builds with "scipy" compiled with TSAN as well: |
| 17 | + |
| 18 | + ghcr.io/nascheme/scipy-tsan:3.13t |
| 19 | + ghcr.io/nascheme/scipy-tsan:3.14t |
| 20 | + |
| 21 | + |
| 22 | +Hints |
| 23 | +----- |
| 24 | + |
| 25 | +To open a command prompt inside the container, you can use the following |
| 26 | +command: |
| 27 | + |
| 28 | + docker run -it --rm <image url> bash |
| 29 | + |
| 30 | +If you want to open additional command prompts, you can use "exec", e.g. |
| 31 | + |
| 32 | + docker exec -it <container ID> bash |
| 33 | + |
| 34 | +The container ID is shown in the prompt as `root@<container ID>`. If you want |
| 35 | +changes you make inside the container to persist, you should remove the `--rm` |
| 36 | +command line argument. Note that you will need to remember to manually remove |
| 37 | +the container after you are finished with it. |
| 38 | + |
| 39 | +Python is installed under `/work/.pyenv/versions`. The `python` command |
| 40 | +will already be in the path. |
| 41 | + |
| 42 | +Depending on the version of Linux running on the container host, you may need |
| 43 | +to adjust some settings. To avoid ASLR interferring with the TSAN checking, |
| 44 | +the following config change may be required: |
| 45 | + |
| 46 | + sudo sysctl vm.mmap_rnd_bits=28 |
| 47 | + |
| 48 | +Since this change reduces security, you likely want to revert to the default |
| 49 | +number of bits after running tests. |
| 50 | + |
| 51 | +If you need to install packages using "apt", the list of packages needs |
| 52 | +to be updated first, e.g. |
| 53 | + |
| 54 | + apt-get update && apt-get install <pkg name> |
| 55 | + |
| 56 | + |
| 57 | +Running scipy tests |
| 58 | +------------------- |
| 59 | + |
| 60 | +Example of running a single test with pytest: |
| 61 | + |
| 62 | + cd /work/.pyenv/versions/3.13.2t/lib/python3.13t/site-packages/scipy |
| 63 | + PYTHON_GIL=0 TSAN_OPTIONS=allocator_may_return_null=1:halt_on_error=1 \ |
| 64 | + pytest -v -s optimize/tests/test_minpack.py::TestFSolve::test_concurrent_no_gradient |
0 commit comments