Parallel processing

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
z imn
Posts: 35
Joined: Sun Sep 17, 2017 7:11 am

Parallel processing

Post by z imn » Thu Sep 05, 2019 1:25 am

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

User avatar
z imn
Posts: 35
Joined: Sun Sep 17, 2017 7:11 am

Re: Parallel processing

Post by z imn » Fri Sep 06, 2019 8:04 am

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

POST REPLY