/
proof-of-concept
/
math-webgpu-sandbox
Jump to
/
Appearance
Match my system
Paper
GitHub
Slate
Midnight
Terminal
Sign in
proof-of-concept
/
math-webgpu-sandbox
Code
Commits
Issues
0
Pull requests
0
Actions
Branches
1
Tags
0
Site
e01ddf1
Branches
main
math-webgpu-sandbox
/
examples
/
reductions.m
11 lines · 296 B
Copy
Copied
Blame
History
Raw
1
% Reductions take a fused loader: dot, norm and max each read their
2
% operands exactly once -- sum(a.*b) is one pass, not two.
3
n =
10000000
;
4
a = rand(n,
1
);
5
b = rand(n,
1
);
6
tic;
7
d = dot(a, b);
8
nrm = norm(a - b);
9
mx = max(abs(a - b));
10
toc
11
fprintf(
'dot %.0f norm %.2f max %.6f\n'
, d, nrm, mx);
↑
↓
move
↵
open
esc
close