Question about multithreading

Drop in here to discuss whatever you want.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
uomogamma
Registered Member
Posts: 1
Joined: Wed Dec 07, 2022 10:10 am

Question about multithreading

Post by uomogamma » Wed Dec 07, 2022 10:13 am

Hello to all,

I'm trying to use dwg2svg script in linux to batch convert some dwg files. I've seen that it uses only one core (thread) and don't expand to multi... is it right?

It is possible to use it in multithread mode?

Thank you so much

A.

CVH
Premier Member
Posts: 3365
Joined: Wed Sep 27, 2017 4:17 pm

Re: Question about multithreading

Post by CVH » Wed Dec 07, 2022 11:57 am

Questions:
Does QCAD in GUI mode uses more than one thread? See Application Preferences.
And does that setting play a role without GUI?

The changelog only sums up multithreading for display purpose and for nesting ...

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Question about multithreading

Post by andrew » Wed Dec 07, 2022 3:30 pm

You can leverage your CPU cores by launching your conversion tasks in parallel in your Linux bash script. For example:

Code: Select all

for f in *.dxf
do
    dwg2svg -f "$f" &
done

wait
The ampersand "&" at the end of the dwg2svg command starts the dwg2svg command as background process and immediately continues with the execution of the script, i.e. the conversion of the next file. The wait at the end waits until all background processes have finished.

Note that the above script is greatly simplified. You will want to make sure that you don't start more than X processes in parallel, depending on the number of CPU cores.

Post Reply

Return to “Chat”