First page Back Continue Last page Graphics
void Ar1::doWork(int sendersID, int n, double arr[n])
{
//Code on previous slide
…
if (((rightmsg == 1) && (leftmsg == 1)) || ((thisIndex == 0) &&
(rightmsg == 1)) || ((thisIndex ==K-1) && (leftmsg == 1)))
{
// Both messages have been received and we can now
compute the new values of the matrix
…
// Use a reduction to find determine if all of the maximum
errors on each processor had a maximum change that
is below our threshold value.
contribute(sizeof(double), &maxChange, CkReduction::max_double);
}
}