[MBDyn-users] Socket communication overhead

Pierangelo Masarati pierangelo.masarati at polimi.it
Thu Apr 27 11:57:01 CEST 2017


On 04/27/2017 11:49 AM, 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.
Well, this sounds odd, because the C++ code wraps the C code, and the C 
code for inet and local sockets only differs in the socket creation.  So 
it *should* be something very specific to your OS...

Sincerely, p.


-- 
Pierangelo Masarati
Professor
Dipartimento di Scienze e Tecnologie Aerospaziali
Politecnico di Milano



More information about the MBDyn-users mailing list