Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4854

Simple OpenCL program in Mathematica

From Anna Ceguerra <anna.ceguerra@sydney.edu.au>
Newsgroups comp.soft-sys.math.mathematica
Subject Simple OpenCL program in Mathematica
Date 2011-09-10 11:29 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j4fhm2$2e2$1@smc.vnet.net> (permalink)

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Simple OpenCL program in Mathematica Anna Ceguerra <anna.ceguerra@sydney.edu.au> - 2011-09-10 11:29 +0000

csiph-web