Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Mark all extensions as free-threading safe#28819
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
tacaswell commentedOct 10, 2024
I put together this script to test our thread safety: importthreadingfrompathlibimportPathimporttimeimportnumpyasnpimportmatplotlib.figureasmfiguretarget=Path("/tmp/p_test")target.mkdir(parents=True,exist_ok=True)ω=2N=1024*10N_threads=70defgen_frames(steps):fig=mfigure.Figure(layout="constrained")ax=fig.subplots()ax.set_xlim(0,2*np.pi)ax.set_ylim(-1.1,1.1)# ax.axis("off")x=np.linspace(0,2*np.pi,1024*10) (ln,)=ax.plot(x,np.ones_like(x))fr_ann=ax.annotate("step: ", (1,1),xytext=(-1,-5),xycoords="axes fraction",textcoords="offset points",ha="right",va="top",font="hack",visible=True, )φ_ann=ax.annotate("φ: ", (1,0),xytext=(0,-5),xycoords=fr_ann,textcoords="offset points",ha="right",va="top",font="hack",visible=True, )forstepinsteps:φ=2*np.pi*step/1024y=np.sin(x*ω+φ)ln.set_data(x,y)fr_ann.set_text(f"n:{step: 5d}")φ_ann.set_text(f"φ:{φ:.4f}")fig.savefig(target/f"sin_{step:05d}.png")threads= []forjinrange(N_threads):threads.append(threading.Thread(target=gen_frames,args=(range(j,N,N_threads),)))start=time.monotonic()[t.start()fortinthreads][t.join()fortinthreads]stop=time.monotonic()print(f"Took{stop-start:.2f} for{N} frames with{N_threads} threads") which can be stitched with It seems to work! We currently have a lock on |
QuLogic commentedOct 16, 2024
Next release of NumPyshould have Windows free-threading wheels as well. |
ianthomas23 commentedOct 17, 2024
FYI there are now ContourPy Windows free-threaded wheels available athttps://anaconda.org/scientific-python-nightly-wheels/contourpy/files |
This is not actually guaranteed to be true at the moment, but may beuseful for testing.
NumPy should have those on the nightly channel, and they should beavailable in the next release.
QuLogic commentedOct 17, 2024
I enabled free-threading wheels on Windows now that there are wheels in the nightly repo, which is enough for cibuildwheel's limited testing. |
9489b93 intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
PR summary
This PR includes all the current and future pybind11 PRs, so it might be rebased or otherwise modified without notice. So don't bother reviewing any of the changes, unless you want to note them in the original PRs.
The only important thing here is the resulting wheels, which should be useful for testing.
@greglucas
PR checklist