matlabpool disabled in new Matlab versions

3,021 views
Skip to first unread message

Ulf Liebal

unread,
Apr 20, 2015, 10:44:54 AM4/20/15
to cobra-...@googlegroups.com
Hi everyone,

I got the Cobra toolbox (extension 0fa509e) and installed it with Matlab R2015a. The fluxVariability function produces the following error:
>> [minflux,maxflux] = fluxVariability(mdl,100);
Error using matlabpool (line 27)
matlabpool has been removed.
To query the size of an already started parallel pool, query the 'NumWorkers' property
of the pool.
To check if a pool is already started use 'isempty(gcp('nocreate'))'.

Error in fluxVariability (line 151)
% if ~exist('matlabpool') || (matlabpool('size') == 0) %aka nothing is active


The reason is that in Matlab R2015a the matlabpool function is disabled and replaced by parpool. I bypassed the error by replacing matlabpool with parpool in line 151 and removing the matlabpool('size') argument.

I still have more errors in the fluxVariability function.
testFVA

*** Flux variability analysis ***

Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers.
Error using solveCobraLP (line 102)
No solver found.  call changeCobraSolver(solverName)

Error in fluxVariability>(parfor body) (line 244)
            LPsolution = solveCobraLP(struct(...

Error in fluxVariability (line 238)
    parfor i = 1:length(rxnNameList)

Error in testFVA (line 20)
[minFluxT, maxFluxT] = fluxVariability(model,90);


However, fluxVaribility works if the parfor loop starting from line 236 in fluxVariability.m is disabled. Is there a problem for R2015a in the parfor-loop?

best wishes,
ulf

Nathan Lewis

unread,
Apr 21, 2015, 11:39:18 AM4/21/15
to cobra-...@googlegroups.com
I could be wrong on this, but the new parpool starts a specificed number of new instances of MATLAB... I believe each of these are essentially like starting another copy of matlab in the background. Thus, you will need to modify your startup.m file to load the solvers (much like done in initcobratoolbox.m) by default when each worker starts.

Nathan E. Lewis
 
Assistant Professor
Department of Pediatrics
University of California, San Diego

--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jan Schellenberger

unread,
Apr 22, 2015, 4:10:24 PM4/22/15
to cobra-...@googlegroups.com
Oh yeah, I was reading about this.  'matlabpool' the function was removed in the newest version of Matlab.  I'm not sure what the workaround is and I don't have time for a fix.  You should be able to just delete the line with 'matlabpool' in it and the code should still run but without multithreading.

-Jan

Longfei Mao

unread,
Apr 29, 2015, 1:32:12 PM4/29/15
to cobra-...@googlegroups.com
Hi all

This problem is fixed by newer versions of "solveCobraLP" and "fluxVariability" files. The new files are to be incorporated into the COBRA toolbox's master repository at https://github.com/opencobra/cobratoolbox.

In the original body of PARFOR loop in the old  "fluxVariability" file, "solveCobraLP" function is called involving a global variable "CBTLPSOLVER" that passes the solver's name to the function. However, such GLOBAL variables are not supported by the PARFOR loop, leading to the errors.



Best wishes 

 

Longfei Mao, Ph.D.

-----------------------------------------------------------------------------------

Research Associate (Collaborateur Scientifique)

Systems Biochemistry Group,

Luxembourg Centre for Systems Biomedicine 


UNIVERSITY OF LUXEMBOURG

CAMPUS BELVAL

7, avenue des Hauts-Fourneaux

L-4362 Esch-Belval

T +352 46 66 44 5514

F +352 46 66 44 35514

-----------------------------------------------------------------------------------

 

http://wwwen.uni.lu/lcsb/research/systems_biochemistry

 

longfe...@gmail.com

longf...@uni.lu

www.lcsb.lu

----------------------------


Chris Gowen

unread,
May 8, 2015, 10:50:53 AM5/8/15
to cobra-...@googlegroups.com
Hi Longfei, 

Thanks for the fix. Unfortunately it looks to me like the function gcp, used at line 153, is only available with the parallel computing toolbox, to which many users (including me) may not have access. Is there a workaround? Even making that feature optional through some flag argument or a global setting would work. Sorry I can't be more help.

Chris

--

Longfei Mao

unread,
May 16, 2015, 3:29:18 PM5/16/15
to cobra-...@googlegroups.com
Hi Chris

Thank you for pointing out this issue. I have corrected the problem in a newer version of "fluxVariability" function.  During the implementation, the new function first checks if the parallel computing toolbox is installed in Matlab; if the toolbox exists, the function then checks if there is a valid license for the toolbox. Only when both the toolbox and a valid license are set up correctly,  "fluxVariability" function calls "gcp" function to get the current parallel pool and then performs the parallel computations.

Best wishes 
 
Longfei Mao, Ph.D.
-----------------------------------------------------------------------------------
Research Associate (Collaborateur Scientifique)
Systems Biochemistry Group,
Luxembourg Centre for Systems Biomedicine 

UNIVERSITY OF LUXEMBOURG
CAMPUS BELVAL
7, avenue des Hauts-Fourneaux
L-4362 Esch-Belval
-----------------------------------------------------------------------------------
 
 
----------------------------

Laura Lopez Pineda

unread,
Aug 15, 2015, 3:58:49 AM8/15/15
to COBRA Toolbox

Hi Longfei,

I am currently doing my master thesis and I would like to use cobra. I also have the latest version of Matlab, so after reading this post I changed the fluxVariability  and  SolveCobraLP functions ( for the latest version that is in github). fluxVariability works all right! but when I try to compile dynamicFBA or pFBA and error message appear about SolveCobraLP only being able to work with cplex solver. 

Can you maybe help me with this problem? should I change something in the Matlab code from this funciones?

thank you!! :)

Laura Lopez

anag

unread,
Nov 23, 2015, 6:39:45 PM11/23/15
to COBRA Toolbox
Dear Dr. Ma,
 has this change been implemented already ? I checked out the cobratoolbox from the git repo on github about two weeks back and it still seems to use the global variable "CBTLPSOLVER" to pass the solver's name to the function.
Thanks
Ambarish Nag

Longfei Mao

unread,
Nov 24, 2015, 3:04:20 AM11/24/15
to COBRA Toolbox
Hi Ambarish

Yes, the change was made in May. Please have a closer look at the "fluxVariability.m" and especially "solveCobraLP.m" files. It seems that you may not have understood the relevant code snippets responsible for the parallel computation :)



Best wishes

Longfei Mao
Reply all
Reply to author
Forward
0 new messages