I am trying to convert a single threaded application that uses Fico Xpress solver to have it solve several problems concurrently with OpenMP. The licensing method that I am using is limited to 1 process, so a multithreaded program should theorically work.
For each thread, I would need the program to:
- Execute a model
- Extract the problem
- Solve the problem
However, I keep getting segfaults and errors like the following:
Mosel: E-84: File `mem:0x7f5c9a0ca640/2000/0x7f5c9a0ca5c0': model cannot be renamed.
Mosel: E-83: Bim file `mem:0x7f5c9a0ca640/2000/0x7f5c9a0ca5c0' cannot be loaded.
For example, I took this sample code.
- Ran it without any modification and it works.
- Add a
for(int i = 0; i < 100; i++)
, and it works, single threaded. - Paralelize using
#pragma omp parallel for
and the "model cannot be renamed" error comes up. - Add a
#pragma omp critical
inside theparallel for
(for testing purposes) like the following, and it works.
int main(){
#pragma omp parallel for
for (int i = 0; i < 100; i++){
#pragma omp critical
{
... variables and code ...
} // end critical
} // end for
}
I could not get any samples to work after making them multithreaded, so it appears to be either a limitation of the solver, license or the way that I am using it. I am using a dongle license.
I am aware that Xpress has a certain support for multithreaded MIP search for a single problem, but I am interested in concurrent single threaded searches.