Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
thread_parallel_with_free-threaded_Python_and_N...
Search
Riku Sakamoto
September 10, 2026
Programming
380
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
Riku Sakamoto
September 10, 2026
More Decks by Riku Sakamoto
See All by Riku Sakamoto
物理量次元を持つテンソルをサポートした 深層学習ライブラリ Phlower の紹介
riku_sakamoto
0
130
論文紹介 “CKGConv: General Graph Convolution with Continuous Kernels"
riku_sakamoto
0
410
dagstreamでデータ前処理の順序関係を解決する #stapy105
riku_sakamoto
0
210
論文紹介“Infinite-Fidelity Coregionalization for Physical Simulation ”, Shibo. L. et, al
riku_sakamoto
0
490
Other Decks in Programming
See All in Programming
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
400
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
450
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
120
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
450
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
130
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
380
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
340
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
160
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
AWSに止められる覚悟してますか?
morizo_1984
2
520
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
96
6.9k
So, you think you're a good person
axbom
PRO
2
2.2k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.3k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Designing Experiences People Love
moore
143
24k
Deep Space Network (abreviated)
tonyrice
0
360
Everyday Curiosity
cassininazir
0
350
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
310
Amusing Abliteration
ianozsvald
1
330
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Transcript
Free-Threaded Python とNumPyによる スレッド並列処理の紹介 みんなのPython勉強会#122 坂本 陸 2026-09-10
自己紹介 坂本 陸(Sakamoto Riku) • Tech Lead(所属:株式会社 RICOS) ◦ ◦
• 数値シミュレーション結果を予測する機械学習モデルの 研究開発 機械学習ツールの開発、管理 OSS活動: ◦ ◦ (Maintainer) Phlower, dagstream (Contributor) NumPy, PyVista GitHub: @riku-sakamoto 2
プロセス並列とスレッド並列 プロセス並列 スレッド並列 プロセス プロセス1 プロセス2 メモリ メモリ メモリ スレッド
スレッド スレッド 処理A 処理B スレッド 処理A 処理B スレッド並列を使うことで、同じメモリ空間を参照する処理を 同時に実行することができる 3
Free-Threaded Python • • Global Interpreter Lock (GIL)により、1つのPython Interpreter内では、 同時にPython
bytecodeを実行できるスレッドが1つに制限される GIL を外したFree-Threaded Python を利用することで、マルチコアを利用 したスレッド並列な処理を実現できる プロセス uv でinstall した例 メモリ スレッド 処理A スレッド 処理B 4
NumPy におけるマルチスレッド対応 • • NumPy では早くからFree-threaded Python への対応が行われていた 同一プロセス内のスレッド間では、NumPy配列をコピーせず共有できる 5
スレッド並列の注意点 • Race Conditions (データの競合) ◦ ◦ • 配列を Readonly
にして共有する スレッドが同時に書き込むデータを減らす CPU Oversubscription ◦ ◦ 各Pythonスレッドから呼び出したBLAS等が、内部でさらに複数のスレッドを生成する場合 に並列化効率が悪化する threadpoolctl を使うことでBLAS などが使用するスレッド数を制限できる 6
まとめ Free-Threaded Python と NumPy を用いることで、Pythonコードから スレッド並列な処理を広く活用できるようになる • Writing Performant
NumPy Code with Multi-Core CPUs ◦ ◦ • Scaling NumPy on Free-Threaded Python ◦ • NumPy の 公式ドキュメント PR-30820 (私が書きました) NumPy、CPython のコア開発者による実装の解説記事 Python Free-Threading Guide ◦ ◦ Free-Threaded Python 全般に関するドキュメント Quansight社(NumPy や SciPy のコアDeveloper やMaintainer が所属する会社)が管理す る記事 7
8