Error when running paralle code using Linux computing server

Dear Friends,

I have run a parallel (“parfor” loop in Matlab) CVX dependent code on my laptop and it is OK. However, when I run it on a linux-based computing server, I get the following error:

   Undefined function or variable "tlX".

   Error in cvxprob/solve (line 314)
            tol  = max( tlX );

   Error in cvx_end (line 77)
    solve( prob );

My code does not contain any variable named “tlX”. I have already run some CVX dependent codes on that server and there was no problem. Thank you in advance.

I am not sure why this particular error would appear, but in fact CVX does not support parfor.

EDIT: Also asked an answered here: Matlab parallel toolbox

I do hope to be able to support parfor in a future release but I cannot make promises about it.

Dear Michael,

Thank you for the answer. In fact, the “parfor” loop is not used between “cvx_begin” and “cvx_end”. However, the CVX code is inside a “parfor” loop.

OK, but doesn’t that mean that Matlab will attempt to construct multiple CVX models simultaneously? Unfortunately, CVX cannot handle that, because it uses a single non-reentrant data structure to store model data.

I am not aware how Matlab runs parallel CVX codes, but I have another code in which there is a “parfor” loop and a function is called inside the loop. The CVX is implemented inside the function and this code runs OK and there is no problem. Logically, the current code should run OK.

Or you simply got lucky with your previous code. If you were lucky enough to use it in the past, so be it, but that in no way guarantees you will be able to do so in the future. By all means, do make sure that the version of CVX you’re running on Linux is up to date.

OK. The CVX on the linux machine is the same as on my laptop (V 1.22). I run both codes on the linux machine today. One was run and the other failed. Even, when I change the loop to non-parallel, it again fails.

1.22 is quite old, you know… I do strongly recommend 2.0 at this point. I’m afraid it is unlikely that will solve all problems with parfor, but if there is another bug at work, you’ll certainly want to try the latest version.

Thank you Michael, thank you for the comments. I changed the version to 2 and the problem just solved. However, I would like to mention that previously the CVX V2 produced some error on my laptop, but when I switched to V1.22, it fixed.

Just a new issue, when I use V2, the problem in always “infeasible”. However, when I switch to V1.22, some solutions is found. So, which version should I trust?

What does the other solver produce?

The other one (V1.22) produced mostly numbers and some NANs together. However, when I switched back from V2 to V1.22, I got a error like following:

             Undefined function or variable "tlX".

and the V1.22 does not work anymore. However, both V1.22 and V2 could an other problem.

That’s not what I meant. CVX ships with two solvers, SeDuMi and SDPT3, and they both have different strengths. Have you tried both solvers? And MOSEK and/or Gurobi, if you have a license?

Thank you for supporting us. I think the CVX2 is operating well since I changed some of the parameters and then for some cases the problem became feasible. So, at lease we can make sure that CVX2 is OK.