Question: Getting a grip on slippery Array indexing variables in Threads:-Add


Hello Maple wizards,

After reading the mapleprimes post on the hidden complexities of using thread-safe versions of add (Threads:-Add), I have been struggling to correct a problem similar to the "escaped k" problem described by Joel Riel about midway down the post, but no dice. I tried to boil the problem down in the downloadable file. An array reference in that seems to work fine in "add" produces a "bad index into Array" message from "Threads:-Add." That may just expose my misunderstanding of how to properly reference an Array but maybe it's another angle on the race conditions from a global property of Add's indexing variable that I cannot seem to escape.

By changing infolevel[cdfX] from 2 to 3 a large number of diagnostic messages shows how the tasks are being assigned to threads, and makes clear which Thread:-Add is failing -- several preceding calls seem to have worked just fine.

I am running on Maple 14 under Windows Vista on a 4-way AMD-64 system. If additional details are needed I will try to reply promptly -- after I've recovered some of the sleep this problem has caused me.

Your suggestions would be gratefully received.

 - Jimmy

Please Wait...