parallel processing - Port old X10 Example to version 2.5 -
parallel processing - Port old X10 Example to version 2.5 -
i have old x10 illustration in class i'm trying compile.
import x10.array.array; import x10.io.console; ... public static def main(args: array[string](1)) { val regiontest = 1..12; val testarray = new array[int](1..12, (point)=>0); ([i] in testarray) { testarray(i) = i; console.out.println("testarray("+i+") = " + testarray(i)); } }
unfortunately seems outdated. figure out myself have write public static def main(args:rail[string])
now. definition of val regiontest = 1..12
seems ok. syntax array must wrong, next lines maybe too. tried prepare this guide, did not succeed.
my setup working, initial class in new x10 eclipse ide project runs.
could help me port version 2.5.x?
there number of non-backward-compatible changes in x10 version 2.4, require code changes - see guide "porting x10 2.4".
your illustration updated follows:
import x10.regionarray.array; import x10.regionarray.region; import x10.io.console; .... public static def main(args:rail[string]) { val regiontest = region.makerectangular(1..12); val testarray = new array[int](regiontest, (point)=>0n); ([i] in testarray) { testarray(i) = int; console.out.println("testarray("+i+") = " + testarray(i)); } }
this demonstrates number of of import changes:
(lines 1--2) general-purpose array classes have movedx10.array
bundle x10.regionarray
. these classes no longer imported default. (lines 6--7) there no implicit type conversion longrange
(1..12
) region
. region
object must explicitly constructed , passed x10.regionarray.array
constructor. (line 7) default integral type long
instead of int
. int
literal must suffixed character 'n
' in '(point)=>0n
'. (lines 8--9) index type array classes has changed int
long
(to back upwards big info structures). hence exploded point
iterator for ([i] in testarray)
yields i:long
instead of i:int
- means cast i int
required when assigning int
array element on line 9. parallel-processing x10-language
Comments
Post a Comment