MantisBT - CMake | ||||||||||
| View Issue Details | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||
| 0015555 | CMake | CMake | public | 2015-05-05 17:49 | 2016-06-10 14:31 | |||||
| Reporter | Todd Lipcon | |||||||||
| Assigned To | Kitware Robot | |||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||||
| Status | closed | Resolution | moved | |||||||
| Platform | OS | OS Version | ||||||||
| Product Version | CMake 2.8.12.2 | |||||||||
| Target Version | Fixed in Version | |||||||||
| Summary | 0015555: Ninja: C compilation targets unnecessarily depend on libraries | |||||||||
| Description | When the Ninja generator generates targets for .cc files, it adds dependencies on any libraries that their target depend on. This means that in a parallel build, ninja won't start building any .cc files from one library until all depended-upon libraries have been built -- an unnecessary restriction. The only requirement should be that a target cannot be _linked_ until its required libraries are built. This severely limits build parallelism in large projects. I manually post-processed a build.ninja file from a medium-size C++ project to remove these dependencies, and a parallel build using icecc on a small cluster was reduced from 1m30s to 1m0s. Looking at a Gantt chart of the build, I could see that all of the cluster cores were kept occupied much better after the fix, especially at the start of the build. | |||||||||
| Steps To Reproduce | todd@todd-ThinkPad-T540p:/tmp/test$ cat foo.cc extern int bar(); int main() { return bar(); } todd@todd-ThinkPad-T540p:/tmp/test$ cat bar.cc int bar() { return 1; } todd@todd-ThinkPad-T540p:/tmp/test$ cat CMakeLists.txt add_library(bar bar.cc) add_executable(foo foo.cc) target_link_libraries(foo bar) todd@todd-ThinkPad-T540p:/tmp/test$ cmake -GNinja . -- Configuring done -- Generating done -- Build files have been written to: /tmp/test todd@todd-ThinkPad-T540p:/tmp/test$ grep 'build.*foo.cc.o:' build.ninja build CMakeFiles/foo.dir/foo.cc.o: CXX_COMPILER foo.cc || libbar.a I attached the above directory to this bug report. | |||||||||
| Additional Information | ||||||||||
| Tags | No tags attached. | |||||||||
| Relationships |
| |||||||||
| Attached Files | https://public.kitware.com/Bug/file/5449/test.tar.gz | |||||||||
| Issue History | ||||||||||
| Date Modified | Username | Field | Change | |||||||
| 2015-05-05 17:49 | Todd Lipcon | New Issue | ||||||||
| 2015-05-05 17:49 | Todd Lipcon | File Added: test.tar.gz | ||||||||
| 2015-05-05 18:03 | Ben Boeckel | Note Added: 0038717 | ||||||||
| 2015-05-05 18:06 | Ben Boeckel | Relationship added | related to 0013799 | |||||||
| 2015-05-05 18:13 | Todd Lipcon | Note Added: 0038718 | ||||||||
| 2016-06-10 14:29 | Kitware Robot | Note Added: 0042772 | ||||||||
| 2016-06-10 14:29 | Kitware Robot | Status | new => resolved | |||||||
| 2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | |||||||
| 2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | |||||||
| 2016-06-10 14:31 | Kitware Robot | Status | resolved => closed | |||||||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||