Multi-thread computation

Problems with syntax of GAMS
Post Reply
zhj0735
User
User
Posts: 16
Joined: 4 years ago

Multi-thread computation

Post by zhj0735 »

Hi all,

I would like to apply the multi-thread facilities of GAMS to my model to speed up my scenarios analysis. I checked the Grid facility available ( https://www.gams.com/latest/docs/UG_GridComputing.html) and applied it to my model. However, the collection loop with just 2 iclone instances never ends and had a problem to collect the output correctly. It aborted after hours with the error message below :

“*** Unexpected EInOutError
*** Msg=I/O error on write of file = 'C:\Users\jzhong11.UOFI\Desktop\042419UpdatedToCluster\BAU051719_parallel.lst': No space left on device”
I attached the log file in this post as well.

The structure of the model is simplified as below. I tested the set iteration with only 1 instance of iteration.
Parameter h(iclone) 'model handles';
Model.solveLink = 3;
Loop(iteration,
Loop(h(iclone), //submission loop
***Parameter setup***
Solve Model maximizing z using lp,
);
repeat
loop(iclone$handlecollect(h(iclone)), //collection loop
***Collections***
display$handleDelete(h(iclone)) 'trouble deleting handles' ;
h(iclone) = 0;
);
display$readyCollect(h, 500) 'Problem waiting for next instance to complete';
until card(iclone) = 0 ;
***Model update other parameter for each iteration***
);
Plus, I tried several other scenarios:
1. without repeat and until loop, the model did not collect any output and finished the running.
2. I turned off the grid option, the model did simple loops of those senarios, this toy model finished within 7 min.

I was wondering what causes the collection problem and how to collect the instance correctly with the grid facility?

Thank you in advance for your help!
Attachments
BAU051719_parallel.log
(12.05 KiB) Downloaded 241 times
zhj0735
User
User
Posts: 16
Joined: 4 years ago

Re: Multi-thread computation

Post by zhj0735 »

Update:

Fred had helped me to troubleshoot the problem.
Two options are mistakenly coded:

1. The infinite loop introduced by an until condition that will never be fulfilled ( until card(iclone) = 0 ; ). I should use the handle h not the set iclone.
2. The readycollect function without wait time will create infinite loops: display$readyCollect(h) 'Problem waiting for next instance to complete'; That way you can easily create an lst file with hundreds of GBs and aborted the model with not enough harddrive space.

Thank you very much Fred!
Fred
Posts: 372
Joined: 7 years ago

Re: Multi-thread computation

Post by Fred »

Hi,

Your last post might be confusing to readers because point 2. obviously does not apply to the example from this forum post where the readycollect function has a wait time (in contrast to the actual code you sent to support@gams.com).

However, the absence of a wait time is not part of the problem (Sorry if my answer was misleading).

To finally clarify: readycollect(HANDLES[,maxWait]) (https://www.gams.com/latest/docs/UG_Gri ... adyCollect) waits until a model solution is ready to be collected or maxWait is reached. I your case the problem was that the handle was empty (after the two models have been solved and the handle has been collected) and in that case readyCollect immediately gives a non-zero return code which results in the display statement to be executed. Since this happens in an infinite loop, it creates an infinite amount of output in the lst file.

Fred
Post Reply