Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

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.





  • Prev by Date: Re: DiscretePlot filling is darker above axis than below
  • Next by Date: Re: DiscretePlot filling is darker above axis than below
  • Previous by thread: Re: execution model: Function vs. delayed execution
  • Next by thread: DiscretePlot or Plot to get subdivided bars?