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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Riku Sakamoto
September 10, 2026
Programming
370
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
200
論文紹介“Infinite-Fidelity Coregionalization for Physical Simulation ”, Shibo. L. et, al
riku_sakamoto
0
490
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
430
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
4
200
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.2k
FreeBSDでZabbixを動かす
kenkino
0
340
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
260
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
190
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.2k
Webの地図
yosuke_furukawa
PRO
6
5k
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
310
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.2k
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
29
13k
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
760
Featured
See All Featured
Bash Introduction
62gerente
615
220k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
570
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
710
Making the Leap to Tech Lead
cromwellryan
135
10k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Everyday Curiosity
cassininazir
0
330
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