Hi All,
I am trying to write a class that will do a prefix sum on an array. I have
written the single-place version and a single-place version that uses multiple
activities to compute the sums. I am now trying to write the distributed
version. Both classes are included (I will eventually write an interface for
these classes).
I have been able to write the constructors and call them without run-time
exceptions occurring. Now, I want to write a function that returns a single
string representation of a dist array. I wrote a function that should create a
string representation of all dist array elements at a given location (I called
it place_str), and then I want to loop over all places:
(from DistPrefixSum.x10):
public def str():String
{
var s : String = "";
//var is mutable
for (var place_id:int=0; place_id<Place.MAX_PLACES; place_id++)
{
s += at (Place.places(place_id)) place_str();
if (place_id != (Place.MAX_PLACES - 1)) {
s += ", ";
} //if
} //for i
return s;
}
My error occurs on the at statement:
dhu...@oscnet166 35%> x10c++ -O -o Driver Driver.x10 PrefixSum.x10
AsyncPrefixSum.x10 DistPrefixSum.x10
/Users/dhudak/osc/research/x10/tutorial/examples/GoodPrefixSum/src/DistPrefixSum.x10:49:
Local variable "place_id" is accessed from an inner class or a closure, and
must be declared final or shared.
1 error.
Does anyone have any recommendations? Creating a single string from a dist
array of integers is a reduction just like finding the sum or max of the
entries, so I figure its well understood...
Thanks,
Dave
---
David E. Hudak, Ph.D. dhu...@osc.edu
Program Director, HPC Engineering
Ohio Supercomputer Center
http://www.osc.edu
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users