[MBDyn-users] Socket communication overhead

Richard Crozier r.crozier at ed.ac.uk
Thu Apr 27 12:54:48 CEST 2017

On 27/04/17 11:29, Pierangelo Masarati wrote:
> On 04/27/2017 12:23 PM, Richard Crozier wrote:
>> On 27/04/17 10:49, Richard Crozier wrote:
>>> On 27/04/17 07:13, Pierangelo Masarati wrote:
>>>> On 04/25/2017 02:30 PM, Richard Crozier wrote:
>>>>> Hello,
>>>>> I'm using socket communication with local unix sockets with the
>>>>> structural external force type. I'm profiling my code and have found
>>>>> that the calls to the socket communication function take a total of
>>>>> 12.185s, this is calls to the MBCNodal C++ class methods. At the end
>>>>> of simulation, mbdyn reports "The simulation required 3.360 seconds of
>>>>> CPU time". Is it right to infer that the difference in these two
>>>>> numbers is the communication overhead? I did find that if I change to
>>>>> local tcp sockets it gets very slow indeed.
>>>>> If it is, is this expected, and is there anything I can do to improve
>>>>> it?
>>>> Well, it's communication plus peer solver overhead, not just
>>>> communication.  If both MBDyn and the peer solver run on the same
>>>> machine, you should be able to use either a tcp or a unix socket. Do
>>>> you
>>>> notice any difference in execution time?
>>>> p.
>>> Yes, a huge difference. If I switch from unix sockets to inet for the
>>> otherwise exact same simulation, the solution time goes from from ~35s
>>> to ~1644s (yes, about 50x slower).
>>> The 35s is the total simulation time in the unix sockets case. My matlab
>>> code profiler tells me that 12.185s of this is spent on the calls to the
>>> libmbc library.
>>> Richard
>> Further to this, I profiled the inet version, almost all time (1601s)
>> is spent calling the mbcxx library, and mbdyn reports total CPU time a
>> 4.070s at the end of the sim.
> I'll look at it.  Can you provide me the profiling, please, and all
> related information?  Also a snippet of the "offending" code could be of
> help (offline, if you prefer).  Thanks, p.

I can provide everything, it's all online already, the only problem is 
it's not trivial. I'll try and boil it down to a simple case next week 
and send it to you.


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

More information about the MBDyn-users mailing list