TechDraw Multithread Testing

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Multithread Testing

Post by wandererfan »

user1234 wrote: Mon Jul 25, 2022 9:39 am One major issue i found. After recalculating a view (does not matter how), one CPU/thread is still always full loaded, even there is nothing to do. FreeCAD uses permanent >6% CPU load (this is 100% from 16 cores (the CPU have 8 64bit cores, but can split it to 16 virtual cores). When i close the file (not close FreeCAD), it load is normal.
There is lots of stuff going on in the background - Qt event loop stuff mostly, but also garbage collection and dependency propagation. If that core stays busy, then we have to look into this.
user1234
Veteran
Posts: 3338
Joined: Mon Jul 11, 2016 5:08 pm

Re: Multithread Testing

Post by user1234 »

wandererfan wrote: Mon Jul 25, 2022 2:30 pm There is lots of stuff going on in the background - Qt event loop stuff mostly, but also garbage collection and dependency propagation. If that core stays busy, then we have to look into this.
I have forgot to mention how long i waited. The load (1 CPU for FreeCAD 100%) goes really permanent, the current test is now 25min (edit: now >1h:05min), when i correct remember, the test before was >1/2h. I still can do something in FreeCAD, but noticed at the beginning of handling anything lag.


wandererfan wrote: Mon Jul 25, 2022 2:07 pm Who is issuing the message - git or Qt Creator?
No, git itself (per terminal input). This occur since the first time i used git with qt creator (and i do not use it anymore), since that i have the behavior.


wandererfan wrote: Mon Jul 25, 2022 2:07 pm Did you do "git config [--global] user.name" and git config [--global] user.email"? If not, that might be why it is asking who you are.
Not yet, but what makes me wonder is, that i can not pull a branch, even i did not change anything. That works before flawless (and still all repositories cloned before i used qt creator the first time). This git is sometimes weird.




Greetings
user1234

edit: blue
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Multithread Testing

Post by wandererfan »

A quick progress report...

- found a (the?) memory leak
- investigating the high idle speed (high cpu with no activity). The QGraphicsView is repainting even when there is no activity. Could be a bad boundingRect according to google.
user1234
Veteran
Posts: 3338
Joined: Mon Jul 11, 2016 5:08 pm

Re: Multithread Testing

Post by user1234 »

wandererfan wrote: Tue Jul 26, 2022 1:28 pm A quick progress report...
Thanks for the update!


Greetings
user1234
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Multithread Testing

Post by wandererfan »

I've just pushed a new version with the memory leak and the high cpu at idle fixed. Same branch.

Still digging into updating dimensions on TechDraw_RedrawPage.

I can't duplicate reliably the issue with getting only 7 of 8 sections painted when loading test46_multithreading_section.FCStd. Seems to work most of the time.

Still to look into is the File functions not working while restoring.
user1234
Veteran
Posts: 3338
Joined: Mon Jul 11, 2016 5:08 pm

Re: Multithread Testing

Post by user1234 »

wandererfan wrote: Tue Jul 26, 2022 7:55 pm I've just pushed a new version with the memory leak and the high cpu at idle fixed. Same branch.
Many thanks!

I can confirm, that

- high cpu at idle
- the blocking of dialogs like the filedialog

are fixed. With the test, i saw that the memory still increses every loop, but estimated lesser as before (5 loops: 461.7MByte vs. 387.8MByte, when you ignore the normal RAM of FreeCAD, the increase is around 11.9MByte now vs. 25.4MByte before per loop).

wandererfan wrote: Tue Jul 26, 2022 7:55 pm I can't duplicate reliably the issue with getting only 7 of 8 sections painted when loading test46_multithreading_section.FCStd. Seems to work most of the time.

From 10 times i recalculated the views/sections (behavior was on both), i got one view/section, which did not work. On the actual tests, i never had the issue again. So when the CPU/thread was in an infinite loop, maybe this was the issue. I would not investigate it further, till the behavior will occur again, if it ever occur again.

wandererfan wrote: Tue Jul 26, 2022 7:55 pm Still to look into is the File functions not working while restoring.
See above, you already fixed it.

The only issue compared to the master is, the missing dimensions whenKeepUpdated is false (geometries like lines works).


Man thanks on working on this, this is indeed a lifetime saver! Even when you only generate new views, it now works really fluent.


Greetings
user1234
user1234
Veteran
Posts: 3338
Joined: Mon Jul 11, 2016 5:08 pm

Re: Multithread Testing

Post by user1234 »

I found a small issue. The recalculating of an section detail fails the first time, when you open a file. When you recalculate it per hand (Redraw Page), then it works. When the detail is in a normal view, it works flawless.

1.webm
(300.73 KiB) Downloaded 35 times


Zip file, because it is a linked part.

DisassemblingFlangeFront.zip
(73.73 KiB) Downloaded 33 times


Greetings
user1234
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Multithread Testing

Post by wandererfan »

user1234 wrote: Thu Jul 28, 2022 9:15 pm I found a small issue. The recalculating of an section detail fails the first time, when you open a file. When you recalculate it per hand (Redraw Page), then it works. When the detail is in a normal view, it works flawless.
New version available that fixes this. Other changes: fix dimensions on redraw when keepUpdated = false, preference on Advanced tab for progress reporting.
user1234
Veteran
Posts: 3338
Joined: Mon Jul 11, 2016 5:08 pm

Re: Multithread Testing

Post by user1234 »

wandererfan wrote: Fri Jul 29, 2022 6:31 pm New version available that fixes this. Other changes: fix dimensions on redraw when keepUpdated = false, preference on Advanced tab for progress reporting.
Thanks, will test it!

Greetings
user1234
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Multithread Testing

Post by wandererfan »

instructions on how to use the snap of the multithread branch (thanks to @ppd)

Code: Select all

  # brand new snap install
  $ sudo snap install --channel=edge/pr-44 freecad

  # If you already have the freecad snap installed
  $ sudo snap refresh --channel=edge/pr-44 freecad 

  # Experimental: Parallel install (see https://snapcraft.io/docs/parallel-installs)
  $ sudo snap set system experimental.parallel-instances=true
  $ sudo snap install --channel=edge/pr-44 freecad_pr44
  $ freecad_pr44 # Run it
Post Reply