A "stack limit reached" error usually occurs because of one of the following:
- a program actually uses a lot of stack due to deep recursion, and runs out of memory
- a program makes a recursive assignment (similar to A := 'A')
In this case, the fact that the program works with numnodes = 23, indicates that neither of the above should be a factor.
To check whether Grid nodes don't get the same amount of stack, I tried the following:
stack_depth := proc(n)
global N := n;
On my machine I get roughly the same number for N on each of the 23 nodes. This also matches running stack_depth(0) directly on the head node. All of the Maple processes have the same amount of stack available to them.
When I try the same code with Grid:-Setup(numnodes=24), the process terminates. This example will help us track down the problem.