Comments (4)
Sorry for this late response,
If you are asking about pure OpenGL textures, I don't have enough experience with them. But if you just need some array with specific format, then I can help you. Even hello world example can be adjusted to generate an array with some format. I will add some here.
from cekirdekler.
For example, below code should generate 4096 element arrays with zero on all elements by initializing them as float4 (4-element float vectors) inside kernel (using 1024 threads spanning all GPUs, each thread initializing 1 float4 for a(f), 1 float4 for b(g)).
ClPlatforms platforms = ClPlatforms.all();
var selectedDevices = platforms.devicesWithMostComputeUnits().gpus(true);
selectedDevices.logInfo();
ClNumberCruncher gpu = new ClNumberCruncher(selectedDevices, @"
__kernel void algorithmTest(__global float4 * a, __global float4 * b)
{
int i=get_global_id(0);
a[i]=(float4)(0.0f,0.0f,0.0f,0.0f);
b[i]=(float4)(0.0f,0.0f,0.0f,0.0f);
}
");
ClArray<float> f = new ClArray<float>(4096);
f.numberOfElementsPerWorkItem = 4;
f.writeOnly=true;
f.zeroCopy=true;
f.write = true;
f.read = false;
f.readOnly = false;
ClArray<float> g = new ClArray<float>(4096);
g.numberOfElementsPerWorkItem = 4;
g.writeOnly=true;
g.zeroCopy=true;
g.write = true;
g.read = false;
g.readOnly = false;
gpu.performanceFeed = true;
// parameter "64" is the minimum allowed thread trade between GPUs so that the balance the workload
f.nextParam(g).compute(gpu, 1, "algorithmTest", 4096/4, 64);
// here f[index] and g[index] must have zero
from cekirdekler.
Also here is how I tried producing vertices (as height-map of a sphere)
https://github.com/tugrul512bit/unityTestMeshDeformation/blob/master/gpgpu_test/Assets/Kamera.cs
(kernel is from line 236 to 245)
In there, to use "structs" of Unity, such as
public Vector3[] verticesBase
you can use
xyzGPU = ClArray<byte>.wrapArrayOfStructs(verticesBase);
it wraps around whole structs and treats all items in them as floats or whatever items in kernel as you like. Using byte type is just for treating as a data transmission buffer on host side. In kernel, you can use their elements by casting to different type on proper alignment points. You shouldn't dereference a non-multiple of 4 address as a float nor int.
from cekirdekler.
from cekirdekler.
Related Issues (20)
- nonPartialWrite capability for buffers HOT 3
- Enqueue mode with single gpu (and for device to device pipeline) ---- lower latency per command HOT 3
- Read-only and write-only flags for ClArray HOT 2
- ClArray.name to bind an array to a kernel parameter with exact spelling HOT 1
- ClArray.async to make an array copy operation done on another commandQueue(concurrently) HOT 1
- clNumberCruncher.enqueueModeAsyncEnable to enqueue different kernels and arrays concurrently
- single device pipeline: overlapping regions percentage in total latency
- single device pipeline: kernel repeat option
- add "batch mode compute"(pool of devices for pool of kernels) with multiple devices where each compute() is computed by 1 device only, with greedy scheduling
- array.nextParam(array2).task() ---> creates ClTask to compute later in pool, with all the fields set at that time but with the latest array data
- add multiple opencl-kernel instances for different compute-id values, for tiled computing, in task pool, with device pool
- add callback option to ClTask
- add duplicated compute option to device pool / task pool / task for initializing same buffer on all devices
- add task types to control pool behavior (sync, broadcast task, shutdown devices)
- 1D NBODY scores HOT 9
- Can you set pipeline mode for each device separately? HOT 5
- Any of the opencl 2 version does not work HOT 38
- How to share Big Array, like a lookup table among various kernel calls HOT 6
- Mandelbrot benchmark's or other test's source
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cekirdekler.