|
My code won't work - searching |
Top Previous Next |
|
Sometimes code leads to fatal computer errors which stops the job so you can't get any profile output (i.e. GAMS runs out of memory and dumps). But a memory overrun error causes the operating system buffer handing procedures to generally lose the last few lines of profile information when the job malfunctioned. So how do I find the problem? The answer is use
The problem reduction strategies in the small to large chapter or Search using code deactivation and isolation
The former involves the modeling simplification strategies discussed in the small to large chapter along with the profile and memory dump techniques discussed above and will not be elaborated on here. The latter merits discussion. When one has code that just won't work one can engage in a quest for the last good statement. This can be done by using code deactivation by commenting out statements using
$Ontext/$Offtext to temporarily make comments of active statements Making individual lines into comments using *
In turn, one would successively deactivate more and more statements until the performance changes with the job terminating appropriately. The searcher would then slowly activate members of the last code statements deactivated until the code performance got worse again. Then by iteratively activating and deactivating one can isolate the exact problematic terms. One may also use save restart to speed this up by saving the results up until a known good spot and just executing the suspect statements. |