pool = gcp('nocreate');
if isempty(pool)
pool = parpool;
end
poolsize = pool.NumWorkers;
gases = cell(poolsize,1);
for n = 1:poolsize
gases{n} = air;
end
parfor j = 1:poolsize
gas = gases{j};
% density(gas)
end
This segment provides the following warning messages:
Warning: Element(s) of class 'Solution' do not match the current constructor definition. The element(s) have been converted to structures.
Warning: Element(s) of class 'Kinetics' do not match the current constructor definition. The element(s) have been converted to structures.
Warning: Element(s) of class 'ThermoPhase' do not match the current constructor definition. The element(s) have been converted to structures.
Warning: Element(s) of class 'Transport' do not match the current constructor definition. The element(s) have been converted to structures.
Modifying the class structures a bit allowed me to get the parfor running without warnings and without converting to structures. However if I tried calling, for example density(gas), the correct thermo_id is being passed in the matlab but that item no longer exists in the thermo cabinet on the cpp side. I may have changed the class structure incorrectly though.
Another suggestion I tried was remaking the object each time
parfor j = 1:poolsize
gas = importPhase('example.xml','gas');
density(gas)
end
cleanup
This seems to work. Cleanup needs to be called, otherwise the number of objects begin to build up quickly.
All that considered, is there a recommended way to run parallel in matlab? Or should I stick to recreating the object each iteration?
Thanks, any suggestions are appreciated,
Jamie
If important: I'm on a mac running Cantera 2.2.0
--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/23044275-f71d-4d2d-9d4b-1d3b433b343cn%40googlegroups.com.