Page 1 of 1

Parallel processing

Posted: Thu Sep 05, 2019 1:25 am
by zohreh
Hello everyone
i am going to run an opensim simulation using parfor loop in matalb. i know that i should run from different working directories at each thread, but i dont know how to change the current working directory at each trial.
on the other hand the .log files are not printed in the path that i saved my .m file (matlab code). i woluld appreciate if u could guide me about these issues.

this is a part of code

parfor i=1:2
mkdir(['P:\...\a' int2str(i) ]);
cd (['P:\...\a' int2str(i) ]);
import org.opensim.modeling.*
osimModel = Model();
osimState = osimModel.initSystem();
% Rest of your code
end


error message

Error using excercise (line 26)
An UndefinedFunction error was thrown on the workers for 'InverseKinematicsTool'. This might be because the file containing
'InverseKinematicsTool' is not accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files to be attached.
See the documentation for 'parallel.Pool/addAttachedFiles' for more details.

Caused by:
Undefined function 'InverseKinematicsTool' for input arguments of type 'cell'.



Thanks
Zohreh

Re: Parallel processing

Posted: Fri Sep 06, 2019 8:04 am
by zohreh
Hello
Just to inform any other person that may face the same problem in future.....
it is necessary to call opensim main classes (Model, InverseKinematicsTool, ...) inside the parfor loop as below :

osimModel = org.opensim.modeling.Model();

Thanks
Zohreh