[pooma-dev] How Write Data Parallel Statement?
Jeffrey Oldham
oldham at codesourcery.com
Thu Apr 12 20:34:04 UTC 2001
On Thu, Apr 12, 2001 at 01:23:51PM -0700, Jeffrey Oldham wrote:
> 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.
The problem was that I was passing an `int' argument to cos() so it
was returning an `int' and then bitterly complaining.
Oops,
Jeffrey D. Oldham
oldham at codesourcery.com
More information about the pooma-dev
mailing list