forked from gpujs/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_return.js
More file actions
57 lines (48 loc) · 1.06 KB
/
basic_return.js
File metadata and controls
57 lines (48 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function basic_return( mode ) {
var gpu = new GPU();
var f = gpu.createKernel(function() {
return 42.0;
}, {
dimensions : [1],
mode : mode
});
QUnit.ok( f !== null, "function generated test");
QUnit.close(f(), 42.0, 0.01, "basic return function test");
}
QUnit.test( "basic_return (auto)", function() {
basic_return(null);
});
QUnit.test( "basic_return (GPU)", function() {
basic_return("gpu");
});
QUnit.test( "basic_return (CPU)", function() {
basic_return("cpu");
});
/*
function basic_booleanBranch( mode ) {
var f = GPU(function() {
var ret = 0.0;
if(true) {
ret = 4.0;
} else {
ret = 2.0;
}
return ret;
}, {
thread : [1],
block : [1],
mode : mode
});
QUnit.ok( f !== null, "function generated test");
QUnit.close(f(), 42.0, 0.01, "basic return function test");
}
QUnit.test( "basic_booleanBranch (auto)", function() {
basic_booleanBranch(null);
});
QUnit.test( "basic_booleanBranch (GPU)", function() {
basic_booleanBranch("gpu");
});
QUnit.test( "basic_booleanBranch (CPU)", function() {
basic_booleanBranch("cpu");
});
*/