Page 1 of 1

Python API - model instance with MCP

Posted: Tue Dec 07, 2021 11:46 am
by nechiforv
Dear GAMS experts,

I am trying to figure out whether the use of the Python API GAMSModelInstance for multithreading would be possible for an MCP GAMS model.
From the API intro I see that only a few solvers take full advantage of solving models through model instances, but could not find anything on MCP/PATH.

I only see a post from 4 years ago viewtopic.php?f=10&t=9904&p=22609&hilit=MCP#p22609 raising some issues while trying to modify GAMS parameters.

Many thanks in advance.

Kind regards,
Victor

Re: Python API - model instance with MCP

Posted: Wed Dec 08, 2021 6:21 am
by bussieck
Victor,

The example in the referenced post works with the current GAMS version. However, the GAMS/PATH solver is not a thread safe (they use lusol for factorization that use global variables, there are some other options for factorization but I don't know if that guarantees you thread safety) so you can't solve concurrently. GAMS' solveLink=6 (https://www.gams.com/latest/docs/UG_Gam ... Osolvelink) is only allowed for thread safe solver (links). The section "Multi-Threading" in chapter "The Grid and Multi-Threading Solve Facility" (https://www.gams.com/latest/docs/UG_Gri ... iThreading) provides a table of thread safe solver (links). Otherwise, I am not aware of issues with the combination of GAMSModelinstance and MCP (and PATH).

-Michael

Re: Python API - model instance with MCP

Posted: Wed Dec 08, 2021 10:47 am
by nechiforv
Hi Michael,

Thank you for the explanations, very useful.

Kind regards,
Victor