Note that there are some explanatory texts on larger screens.

plurals
  1. POParallel jobs using a CMake generated makefile (no speed improvement)
    primarykey
    data
    text
    <p>I have been doing some testing on a project that I recently started building with CMake. Before moving to CMake I noticed significant improvements in build time when using the <code>-j</code> option for <code>make</code> with my handwritten Makefile.</p> <p>Now with CMake I do the same thing and there isn't any noticeable increase in speed. Whether I run with <code>-j</code> or not, I get four processes for <code>make.exe</code>, though only one of them is clocking CPU time and never uses more the 25% of the CPU.</p> <p>In general, The CMake generated Makefile is much slower than my handwritten Makefile. A quick test shows build times for both CMake and handwritten makefiles with and without the <code>-j</code> flag:</p> <pre><code>CMake: "make -j all" = 7min CMake: "make all" = 7min Handwritten: "make -j all" = 2min Handwritten: "make all" = 4min </code></pre> <p>In general, CMake is much slower and doesn't seem to utilize parallel jobs.</p> <p>Can anyone explain why I'm not seeing any improvements?</p> <p>(Building a Fortran program with gfortran and using CMake's auto-detect dependency feature...though I don't know if that's relevant to what I'm seeing).</p> <p>Here's my CMakeLists.txt file:</p> <pre><code>## CMake Version cmake_minimum_required(VERSION 2.8) ## Project Name project(PROJECT) ## Use FORTRAN enable_language(Fortran) ## Release compiler options set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -cpp -ffree-line-length-none -fimplicit-none") ## Debug compiler options set (CMAKE_Fortran_FLAGS_DEBUG "-g -cpp -ffree-line-length-none -fimplicit-none") ## Set directory for FORTRAN modules set (CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/modules") ## Build Executable add_executable(EXE Source1.f90 Source2.f90 . . . Source219.f90 Source220.f90) </code></pre> <p>And here's my original Makefile:</p> <pre><code>PROG = PROGRAM.exe SRCS = Source1.f90 Source2.f90 ... Source219.o Source220.o OBJS = Source1.o Source2.o ... Source219.o Source220.o LIBS = VPATH = src BUILDDIR = debug F90 = gfortran F90FLAGS = -g -cpp -ffree-line-length-none -fimplicit-none all: $(PROG) $(PROG): $(OBJS) $(F90) -o $@ $(OBJS) $(LIBS) clean: erase -f $(BUILDDIR)$(PROG) $(BUILDDIR)\$(OBJS) $(BUILDDIR)\*.mod .SUFFIXES: $(SUFFIXES) .f90 .f90.o: $(F90) $(F90FLAGS) -c $&lt; Source1.o: Dependency1.o Dependency2.o ... DependencyN.o Source2.o: Dependency1.o Dependency2.o ... DependencyN.o . . . Source219.o: Dependency1.o Dependency2.o ... DependencyN.o Source220.o: Dependency1.o Dependency2.o ... DependencyN.o </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload