Design input for model state

@abhishekingit : Great, glad it was useful!

Just to make sure nothing is missed: in many contexts, when I talk about rank-neutral programming in Chapel, sometimes I'm talking about other features of Chapel, like the fact that this loop:

forall idx in D {
  A[idx] = ...;
}

can work for a 1D, 2D, 3D, 4D, or nD domain D and array A since Chapel supports tuple-based array indexing. Contrast this with languages that require a distinct index per dimension, requiring you to type different symbols for an array access depending on the number of dimensions:

1D: A[i]
2D: A[i][j] or A(i,j)
3D: A[i][j][k] or A(i,j,k)
etc.

Of course, these features can mix with what we've been talking about here, because it means if you have a concrete child class like this:

class Concrete: Abstract {
  param rank: int;
  type eltType;
  var D: domain(rank);
  var A: [D] eltType;
}

you can write methods that don't care what rank and eltType are used:

// Doesn't care what rank A is:
proc Concrete.increment() {
  forall a in A do
    a += 1;
}

Let us know if you have additional questions, of course,
-Brad

PS — (and if you're interested in introducing yourselves and/or your project, I'm sure people would be curious: Introduce Yourself!)

1 Like