Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. parallel multi-cpu multi-core build
QtWS25 Last Chance

parallel multi-cpu multi-core build

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 11.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iraytrace79
    wrote on last edited by
    #1

    Has anyone had success getting QtCreator to build with multiple cores on Windows with Microsoft compilers and cmake project files? My project uses cmake 3.4.0 and MS visual studio 12 2013.

    In "Kits" I see that QtCreator is using "CodeBlocks - NMake Makefiles" and nmake does not do parallel compilation.

    I know that if I use the Visual Studio 12 2013 generator in cmake (which our Continuous Integration uses) I can add options on the cmake command line (-- "/m:%NUMBER_OF_PROCESSORS%" "/p:BuildInParallel=true") to get a parallel build. However, in QtCreator if I switch to building with "Visual Studio 12 2013 [arch]" generator I get cmake errors and QtCreator cannot parse the project.

    Any suggestions on how to set this up would be welcome.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      In options->general->build and run check the box "use jom instead of nmake"
      jom is the qt replacement for nmake that allows parallel building. it should come with the qt installation

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      I 1 Reply Last reply
      3
      • VRoninV VRonin

        In options->general->build and run check the box "use jom instead of nmake"
        jom is the qt replacement for nmake that allows parallel building. it should come with the qt installation

        I Offline
        I Offline
        iraytrace79
        wrote on last edited by
        #3

        @VRonin
        Anything else? I have this checked. Builds seem to use about 12% of my Core i7 in QtCreator. Elapsed build time is: 19:43:17. If I run the equivalent build from the command line with:
        cmake --build . --config Release -- "/m:%NUMBER_OF_PROCESSORS%" "/p:BuildInParallel=true"
        utilization is around 95% with occasional dips to 50% and elapsed time is 4:17.72.

        Looking at the output of:
        jom /?
        I see an option for "/j <n>". This makes me think there might be something needed to cause JOM to light all the cores. It is not clear where this option should be set in QtCreator. Under Build Steps it indicates that cmake.exe --build . --target all is the way it is building the project. Adding "/j " to Tool Arguments in the Project settings causes cmake to be invoked as: C:\Program Files (x86)\CMake\bin\cmake.exe" --build . --target all -- /j 4 which I wold have expected to work, however this generates the error

        20:19:43: Starting: "C:\Program Files (x86)\CMake\bin\cmake.exe" --build . --target all -- /j4
        NMAKE : fatal error U1065: invalid option 'j'
        Stop.
        20:19:43: The process "C:\Program Files (x86)\CMake\bin\cmake.exe" exited with code 2.
        
        1 Reply Last reply
        0
        • I Offline
          I Offline
          iraytrace79
          wrote on last edited by
          #4

          OK, after some extended sleuthing, I have determined the following:

          1. in Tools->Options->Build & Run->General: Check Use Jom instead of nmake
          2. in Tools->Options->Build & Run->Kits: Select your "default" kit and change the CMake Generator to be NMake Makefiles JOM instead of CodeBlocks - NMake Makefiles.
          3. You may need to edit your environment to set the PATH variable to include C:\Qt\Tools\QtCreator\bin (or wherever you installed QtCreator) so that the jom executable is readily available.

          Once all that is done, I am getting good utilization during the compilation process.

          1 Reply Last reply
          1
          • I Offline
            I Offline
            iraytrace79
            wrote on last edited by
            #5

            Alas, this does not seem to work on a fresh repository check-out. QtCreator cannot read the project file(s) created in this manner. You have to build your project with one of the CodeBlocks generators first so that you can find and edit your source files. When it is time to build you can switch the kit to using the NMake Makefiles JOM. What we seem to lack is an ability to use JOM with the CodeBlocks - NMake Makefiles.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved