QtCreator 4.0.0 no more mingw parallel compilation



  • About a week ago i was using QtCreator 3.6.1 and it was starting parallel compilation on all targets/kits (mingw, msvc2013....) using 100% of the cpu and doing it's work quickly.
    Now since i got the QtCreator 4.0.0 the mingw target/kit use only 1 compilation thread, actually slowing down the total compilation time by a factor of about 1/n_cpu_cores, i'm not sure if i need to change any particular option with the new creator version, as it was working fine in the previous ones by default.



  • I just updated QtCreator from 4.0.0 to 4.0.1 but the the mingw target still compile using one single core, there is a way to set the mingw kit to spread compilations on all avaiable cores like it was doing in the QtCreator 3.xx version?


  • Lifetime Qt Champion

    Hi,

    You should compare the build output of both version of Qt Creator so see if there's anything changed between the two.



  • Looks like i have to manually override the make setting for every project changing:
    MAKE: C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe
    to
    MAKE: C:\Qt\Tools\QtCreator\bin\jom.exe
    than i can build quickly again taking advantage of all cpu cores.
    I have no idea how i can set this override globally.

    I can't remember what was the compile output when i was using the creator 3.6.1 about 2 weeks ago, but it was distributing the compilations automatically on all cpu cores without the need to change any settings.
    In the "build & run" options the "use jom" checkbox is checked like it was before, so i have no idea why old kits was using multiple compilation threads out of the box and now since the creator 4.0.0 you have to manually force it for mingw.


  • Moderators

    @Keyos make does not use multiple cores by default, you need to pass -j NUMBER_OF_THREADS as parameter to it (in Projects tab).



  • @Keyos

    Hi,

    You can set the system environment variable.
    like this: MAKE_COMMAND=C:\Qt\Tools\QtCreator\bin\jom.exe

    or

    Tools -> Options -> Build & Run -> Kits -> Select kit -> Environment -> Change... -> Add : MAKE_COMMAND=C:\Qt\Tools\QtCreator\bin\jom.exe -> Ok



  • Thank you very much for the informations!
    Than i presume the old creator (3.6.1) was using jom or pasing "-j NUMBER_OF_THREADS" to mingw32-make by default and somehow this feature have been lost in the passage to the new 4.x.x as i can see the variable NUMBER_OF_THREADS is set correctly to 4 on my setup



  • Sorry i meant "NUMBER_OF_PROCESSORS=4" wich is set by default correctly after the installation, but i suppoose the meaning and purpose is the same as "NUMBER_OF_THREADS" when calling mingw32-make with -j option


  • Moderators

    @Keyos You should use number of threads. On CPUs with hyper threading it means: number of cores * 2. Then you can utilize your CPU better.



  • I wonder why they stopped using jom or passing the -j option when using the mingw kit by default since the qtcreator 4.0.0
    There is a reason like for example jom is not reliable or they just forgot to call it?


  • Moderators

    As far as I know -j was never passed by default.
    Not sure about jom.


  • Moderators

    @Keyos said:

    Sorry i meant "NUMBER_OF_PROCESSORS=4" wich is set by default correctly after the installation, but i suppoose the meaning and purpose is the same as "NUMBER_OF_THREADS" when calling mingw32-make with -j option

    I have updated today (unfortunately, I had to) from an old Qt creator version 3.2 to Qt creator version 4.0.2 and assumed that I have encountered the same problem.

    My standard environment has also "NUMBER_OF_PROCESSORS=4" and suddenly the compilation took ages after upgrading. With a couple of trials I have found that also adding this seting to project environment and "NUMBER_OF_THREADS=4" does not influence the compiling.

    Either you need to add "-j4" as make parameter to each of your projects. Otherwise you can set also "MAKEFLAGS=-j4" to your environment (e.g. for a kit as suggested above).

    jom was created as a substitute for nmake ( MS flavor of make). nmake does not support outside of VS multi core compilations. jom does support this when used in combination with ms compilers.

    This blog suggest that jom detects the number of available cores automatically:
    "To install jom, just extract the zip file to a directory which is in your PATH. Now, instead of calling nmake to build Qt, call jom. It automatically detects the number of processor cores in your PC by calling QThread::idealThreadCount().
    You also can use the -j command line argument to set the number of concurrent processes."


  • Moderators

    @koahnig said:

    Either you need to add "-j4" as make parameter to each of your projects. Otherwise you can set also "MAKEFLAGS=-j4" to your environment (e.g. for a kit as suggested above).

    Correction to above post. I have set it to system environment. I did not get it to work in kit environment. Both were set due to my trials, but the latter alone (in kit environment) does not help.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.