freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pooma-dev] How Write Data Parallel Statement?


From: Jeffrey Oldham
Subject: Re: [pooma-dev] How Write Data Parallel Statement?
Date: Thu, 12 Apr 2001 13:23:51 -0700
User-agent: Mutt/1.2.5i

On Thu, Apr 12, 2001 at 09:11:10AM -0700, Stephen Smith wrote:
> There's a function that provides indices called Iota
> that can be used for this:
> 
>     #include <cmath>
>     #include "Pooma/NewFields.h"
> 
>     int main(int argc, char *argv[])
>     {
>       Pooma::initialize(argc,argv);
> 
>       Array<2,Vector<2> > c(5,4);
>       Iota<2>::Iota_t ij(c.domain());
> 
>       c.comp(0) = ij.comp(0) * cos(ij.comp(1));
>       c.comp(1) = ij.comp(0) * sin(ij.comp(1));
> 
>       // How do I write a data-parallel statement equivalent to?
>       for (unsigned i = all values in c's domain's first component)
>       for (unsigned j = all values in c's domain's second component)
>         c(i,j) = Vector<2>(i * cos (j), i * sin (j));
> 
>       Pooma::finalize();
>       return 0;
>     }

Compiling the attached program, basically the same as you suggested,
using gcc 3.1 causes numerous compilation errors.  Do you also see
these errors?  I will now look into their sources.

> You could use the IndexFunction engine to perform an arbitrary
> computation on the indices and get the compuation you want in one
> step.  You'd need to write the expression
> Vector<2>(i * cos (j), i * sin (j));
> out-of-line in a functor object.  See the file src/Pooma/Indices.h
> to see how to use an index function engine.

I am looking into Engine/IndexFunctionEngine.h because an index
function engine looks promising.

Thanks,
Jeffrey D. Oldham
address@hidden

Attachment: goo.cc
Description: Text document

Attachment: goo.compile
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]