Can I create CUDA/OpenCL applications using Delphi or FreePascal?
Or am I forced to use C++ and Visual Studio?
A quick search: cuda + pascal
Turns up some promising leads, but none of them seem to work out, what options do I have if I want to fire up all those unused cores using Pascal?
Try it DELPHI CUDA In delphi you shoud use DRIVER API for run kernel , this implementation help you. There are examples in source code http://code.google.com/p/pascuda/
GLScene has CUDA + OpenCL header conversions in it's ComputeAPIs folder, but unfortunately there is no Pascal for CUDA/OpenCL, so the actual kernels will need to be written in C for OpenCL/CUDA.
It is possible to use clEnqueueNativeKernel to use purely all Delphi code, but native kernels will only work on the CPU, not on any existing GPU at the moment. In recent Delphi versions, it is possible to combine native kernels with anonymous methods, to produce a fairly nice solution.
eg. You could write a wrapper function that accepts an anonymous method as a parameter, and passes it to OpenCL as a native kernel, the wrapper function could operate something like this:
var
input1, input2, output: array[0..1023] of integer;
begin
Parallel.For(0, 1023,
procedure(i: Integer)
begin
output[i] := SomeFunc(input1[i]) + AnotherFunc(input2[i]);
end);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With