Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Metal Demo
Search
alienxp03
September 14, 2015
Programming
0
120
Metal Demo
alienxp03
September 14, 2015
Tweet
Share
More Decks by alienxp03
See All by alienxp03
Rails, Capistrano & AWS
alienxp03
0
89
iOS Tools
alienxp03
1
190
RxSwift+MVVM
alienxp03
1
500
From a student to a developer
alienxp03
1
110
Other Decks in Programming
See All in Programming
複雑なドメインに挑む.pdf
yukisakai1225
5
1.2k
楽して成果を出すためのセルフリソース管理
clipnote
0
190
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
130
1から理解するWeb Push
dora1998
7
1.9k
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
GitHubとGitLabとAWS CodePipelineでCI/CDを組み比べてみた
satoshi256kbyte
4
250
Swift Updates - Learn Languages 2025
koher
2
510
Tool Catalog Agent for Bedrock AgentCore Gateway
licux
7
2.5k
Ruby Parser progress report 2025
yui_knk
1
460
testingを眺める
matumoto
1
140
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
610
Featured
See All Featured
Designing for Performance
lara
610
69k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Large-scale JavaScript Application Architecture
addyosmani
513
110k
Code Review Best Practice
trishagee
71
19k
How GitHub (no longer) Works
holman
315
140k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Visualization
eitanlees
148
16k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
53k
Why Our Code Smells
bkeepers
PRO
339
57k
Transcript
GPU Programming in Metal • Twitter: @alienxp03 • Not a
GPU programmer
Metal • Introduced in iOS 8 • Only for iOS
devices • Usage - Graphic rendering - Parallel data computation
Basic guide • Initialise Metal
Basic guide • Call the compiled shader function
Basic guide • Set parameters
Basic guide • Threadgroups
Basic guide • Run the computation • Get the result
Shader language • Using C++11 with some extension and limitation
pow(x, y) • 12,228 integers - CPU : 0.028833416668931 secs
- GPU : 0.0302730000112206 secs
pow(x, y) • 33,554,432 integers (2 ^ 25 ) -
CPU : 73.7681545416708 secs - GPU : 38.1098593333445 secs
Implementation • Didn’t compare precise::pow vs fast::pow • Initialise the
array on CPU, then pass it to GPU for computation • Using CPU cache memory
None
iOS 9 • Metal is now available on OS X
too • MTLResourceOptions
iOS 9 • Instrument, Metal System Trace
None
Lesson learned • We have GPU too, and it’s pretty
powerful • And it’s idle almost the whole time
Real world application • For data simulation or visualisation •
Though the truth is, I have no idea • Just did it for fun
GPU Programming in Metal • Twitter: @alienxp03 • Not a
GPU programmer