02f2376Scale examples to 1-4 s of GPU work so tic/toc comparisons are meaningfulJeremy Magland 1% Two million logistic maps x <- r x (1 - x) iterated 4000 times in
2% lockstep (8 billion updates). The loop body compiles once and replays.
3n = 2000000;
4niter = 4000;
e01ddf1MATLAB-syntax scripts on WebGPU: fused kernels, tic/toc timing, CPU comparisonJeremy Magland 5r = 3.5 + 0.5*rand(n, 1);
6x = rand(n, 1);
7tic;
02f2376Scale examples to 1-4 s of GPU work so tic/toc comparisons are meaningfulJeremy Magland 8for k = 1:niter
e01ddf1MATLAB-syntax scripts on WebGPU: fused kernels, tic/toc timing, CPU comparisonJeremy Magland 9 x = r .* x .* (1 - x);
10end
02f2376Scale examples to 1-4 s of GPU work so tic/toc comparisons are meaningfulJeremy Magland 11t = toc;
12fprintf('%.0f million map-updates/sec\n', niter*n/1e6/t);
13fprintf('mean x after %d iterations: %.4f\n', niter, mean(x));