Number of cores used by OpenSim

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Samuele Gould
Posts: 16
Joined: Tue Nov 19, 2019 5:53 am

Number of cores used by OpenSim

Post by Samuele Gould » Wed Sep 14, 2022 2:38 am

Dear All,

I am hoping to run OpenSim forward dynamic simulations on a HPC (Linux), to do so I have to specify the number of hours and cores I will use. I have been running the simulations on my local PC (windows), but I've not been able to figure out how to find the number of cores OpenSim is using.
Is there any way to monitor the number of cores OpenSim is using?
And also specify how many cores it is allowed to use?

Thanks,
Samuele

Tags:

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: Number of cores used by OpenSim

Post by Thomas Uchida » Thu Sep 15, 2022 4:38 am

Is there any way to monitor the number of cores OpenSim is using?
The Windows Task Manager shows graphs of CPU utilization. This site provides instructions: https://www.technipages.com/how-to-see- ... sk-manager.
And also specify how many cores it is allowed to use?
I think each forward dynamic simulation will run on a single core if you use the official release (you can check by monitoring the Task Manager). The simplest strategy might be to run several simulations in parallel rather than trying to distribute the computation on multiple cores and run one simulation at a time---assuming, of course, this would be sufficient for what you are trying to do.

User avatar
Samuele Gould
Posts: 16
Joined: Tue Nov 19, 2019 5:53 am

Re: Number of cores used by OpenSim

Post by Samuele Gould » Thu Sep 15, 2022 5:56 am

Thank you for the reply Thomas,

Sorry I wasn't clear, I should have specified, programatically throught the MatLab API, but I take it from your reply that the answer to that is no. I think this will be sufficient though :D

I will test running the simulations in parallel as this at least partially solves one problem - that I have a lot of simulations to run (as I am applying a monte carlo method for a sensitivity study). However the main problem is the simulation time.

Applogies, if you have the time, this will need a slightly lengthier explaination. Thank you already for all the help.

I am simulating an experiment. The aim is to find a lumped parameter model of the intervertebral joint represented by bushing forces. I have a simple model (7 bodies representing vertebrae, connected with 6DoF joints, which the bushing forces are coincident with, there are no muscles). With the MatLab API I am runing forward dynamic simulations and passing the results to a custom cost function to inform a matlab optimisation function (fmincon), which optimises the bushing forces. A single simulation lasts approximately an hour for this model however typically (base on a smaller model and shorter experiment) several hundred simulations are needed to reach an optimised value. I don't think I can run these simulations in parallel as the output of one informs the inputs of the next. So any way to reduce the simulation time would be hugely helpful, which is why I was thinking of distributing the computation. Any alternative possible solutions reducing the computation time would be gladly recieved.

Thanks again,
Samuele

User avatar
Pavlos Silvestros
Posts: 13
Joined: Tue Apr 12, 2022 9:57 am

Re: Number of cores used by OpenSim

Post by Pavlos Silvestros » Fri Sep 16, 2022 3:24 pm

Hi Samuele,

Nice to see someone else tackling spine models... they're always fun! Sounds similar to a study I did a few years ago.

As for your simulation timings. There has been a lengthy discussion on this topic in the Moco forum - might be worth checking that out. Something I found to work recently using Moco, which might work in pure FD sims for you, you can test how many threads produce adequate speed for your sims and then set up workers on your local Matlab to split your CPU with parfor.

For example I use a workstation that has 1 CPU with 36 threads. I conducted a test on simulation timings by sequentially increasing the number of threads my CPU was using for a sim and recorded the timings. After including 12-18 threads simulation time improvement plateaued. So I set up a pool of two workers (2 x 18 threads) on my single CPU to run my optimisations in parallel. Depending on what machine you are using this could help you out a bit and make for a more efficient use of your recourses.

I am also going to be in the process of scaling this up to a CPU cluster so I can share more information when I know more.

Cheers,
Pavlos

User avatar
Samuele Gould
Posts: 16
Joined: Tue Nov 19, 2019 5:53 am

Re: Number of cores used by OpenSim

Post by Samuele Gould » Mon Sep 19, 2022 1:42 am

Hi Pavlos,

Thanks for the reply. I hadn't even thought to look on the Moco forum, I will definetly check that out! I like the sound of your idea. I will post here if I find a way to control the number of threads used to run the pure FD simulation.

If you could share what you find when scaling up to a CPU cluster that would be very helpful.

Thanks,
Samuele

POST REPLY