Simple OpenCL program in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg121317] Simple OpenCL program in Mathematica
- From: Anna Ceguerra <anna.ceguerra at sydney.edu.au>
- Date: Sat, 10 Sep 2011 07:28:40 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Hi,
This program that I'm trying in notebook doesn't work, but the documentation
doesn't say how to fix it (what is a valid argtype for string?):
Needs["OpenCLLink`"]
src2 = "
__kernel void hello(__global char * arry, mint len) {
size_t index = get_global_id(0);
if (index >= len) return;
arry[index] = index + '0';
}
";
helloWorld = OpenCLFunctionLoad[src2, "hello", {{_Character}, _Integer},
16];
helloWorld["0000000000", 10]
Error message:
OpenCLFunctionLoad::invtypspec: "{_Character} is not a valid argument type."
I would like to be able to set the ASCII characters in the char * array in
OpenCL, and print the result to the notebook in Mathematica. I tried several
things, including changing _Character to _String, and changing all strings
to integer array.
What do I need to be able to get this to work? If you need further details
on what I'm trying to do, please let me know.
Thanks and regards,
Anna.