Hi community. I love chapel. I love all the functionality. I am used to write code on my own that I now get for for free.
I have grouped together three questions that i don't find answers two online.
I am very productive with arrays. that is what i am focusing on today.
Question 1.
var myArray : [0..10] int = 42;
Does all array values end up with value 42? I am have not yet figured if this is valid chapel. To be honest i don't trust the compiler to catch all the errors I throw at it.
Question 2.
i am doing products and arrays.
module Poc {
proc main() {
var myArray : [0..10] int = {0..10};
var otherArray : [0..20] int = {0..20};
var result = myArray * otherArray;
writeln(result);
}
}
my chapel 1.26 compiler spits out ten squares; 0 1 4 9 16 25 36 49 64 81 100
.
If I switch the order of the two factors around I assumed the result would be the same, but that is not the case.
module Poc {
proc main() {
var myArray : [0..10] int = {0..10};
var otherArray : [0..20] int = {0..20};
var result = otherArray * myArray;
writeln(result);
}
}
gives
error: halt reached - size mismatch in zippered iteration (dimension 0)
.
Is this expeced?
Question 3.
this time i am having a hard time with dmapped domains.
module Poc {
use BlockDist;
proc main() {
writeln("started");
var A : domain(1) dmapped Block({0..10}) = {0..10};
var myArray : [A] int = {0..10};
var B : domain(1) = {0..10};
var otherArray : [B] int = {0..10};
var result = myArray * otherArray;
writeln(result);
writeln("finished");
}
}
this gives output
Build Successful
started
0 1 4 9 16 25 36 49 64 81 100
finished
What locales is results distributed over? If the results is stuck on the main locale what would be the simplest way to make result use an identical domain and Block distribution as myArray
on the left hand side?