Mercurial > projects > cl4d
comparison main.d @ 0:3cea44337083
initial commit
author | Trass3r |
---|---|
date | Wed, 02 Dec 2009 17:40:59 +0100 |
parents | |
children | c78ffc9a7434 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3cea44337083 |
---|---|
1 module main; | |
2 | |
3 import common; | |
4 | |
5 import opencl.c.opencl; | |
6 import opencl.context; | |
7 import opencl.device; | |
8 import opencl.platform; | |
9 | |
10 import std.stdio; | |
11 | |
12 void main(istring[] args) | |
13 { | |
14 auto platform = CLPlatform.getPlatforms[0]; | |
15 writefln("%s %s %s %s %s", platform.name, platform.vendor, platform.clversion, platform.profile, platform.extensions); | |
16 | |
17 auto devices = platform.getDevices(CL_DEVICE_TYPE_ALL); | |
18 | |
19 foreach(device; devices) | |
20 writefln("%s %s %s %s %s", device.name, device.vendor, device.driverVersion, device.clVersion, device.profile, device.extensions); | |
21 | |
22 auto context = new CLContext(devices); | |
23 | |
24 auto program = context.createProgram(` | |
25 __kernel void sum( __global const float* a, | |
26 __global const float* b, | |
27 __global float* c) | |
28 { | |
29 int i = get_global_id(0); | |
30 c[i] = a[i] + b[i]; | |
31 } `).buildDebug(); | |
32 | |
33 } |