Skip to content

Commit ce6bbca

Browse files
committed
Merge pull request gpujs#44 from gpujs/eugene-#25-demo
Eugene gpujs#25 demo
2 parents 97b016c + feeb9cb commit ce6bbca

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ var C = mat_mult(A, B);
3030

3131
You can run a benchmark of this [here](http://gpu.rocks). Typically, it will run at 1-15x speedup depending on your hardware.
3232

33+
Or alternatively you can experiment around with the [kernel playground here](http://gpu.rocks/playground/playground.html)
34+
3335
# Getting Started
3436

3537
## Installation

demo/playground.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<title>GPU.JS - playground : GPU Accelerated JavaScript</title>
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<meta name="description" content="gpu.js - playground. Run and benchmark demos for gpu.js - is a single-file JavaScript library for GPGPU in the browser. gpu.js will automatically compile specially written JavaScript functions into shader language and run them on the GPU using the WebGL API. In the case where WebGL is not available, the functions will still run in regular JavaScript." />
8+
9+
<meta property="og:title" content="gpu.js - playground : GPU Accelerated JavaScript" />
10+
<meta property="og:type" content="website" />
11+
<meta property="og:url" content="http://gpu.rocks/" />
12+
<meta property="og:image" content="http://gpu.rocks/img/ogimage.png" />
13+
14+
<title>gpu.js - playground : GPU Accelerated JavaScript</title>
15+
<link rel="icon" href="img/jelly.png">
616

717
<!-- jquery + bootstrap -->
818
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>

demo/playground.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ $(function() {
366366
"function kernel(A,B) {\n"+
367367
" var sum = 0;\n"+
368368
" for (var i=0; i<512; i++) {\n"+
369-
" sum = (sum*A[this.thread.x] + i)/B[this.thread.x];\n"+
369+
" sum = Math.pow((A[this.thread.x]-sum)/B[this.thread.x],2);\n"+
370370
" }\n"+
371371
" return sum;\n"+
372372
"}";
@@ -563,9 +563,9 @@ $(function() {
563563
if( cpu_time == gpu_time ) {
564564
gain_per = 0;
565565
} else if( gpu_time < cpu_time ) {
566-
gain_per = cpu_time / gpu_time * 100.0;
566+
gain_per = cpu_time / gpu_time * 100.0 - 100.0;
567567
} else {
568-
gain_per = -(gpu_time / cpu_time * 100.0);
568+
gain_per = -(gpu_time / cpu_time * 100.0) + 100.0;
569569
}
570570

571571
bench_labels.push( sampleSize );

0 commit comments

Comments
 (0)