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
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
490
contenteditable と日本語入力に向き合う
colorful12
0
170
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
140
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
130
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
3
4.1k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
残高管理から台帳サービスへの進化
artoy
0
170
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
1
2.2k
Java 27新機能 / Java 27 new features
kishida
2
200
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
480
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
180
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
How to Talk to Developers About Accessibility
jct
2
560
RailsConf 2023
tenderlove
30
1.6k
Product Roadmaps are Hard
iamctodd
55
13k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
790
Color Theory Basics | Prateek | Gurzu
gurzu
1
480
Design in an AI World
tapps
1
350
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
How to make the Groovebox
asonas
2
2.5k
My Coaching Mixtape
mlcsv
0
340
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
610
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