Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] MSVC (was Build Again) (OT)

Am Freitag, 30. April 2010 10:24:55 schrieb Jesper Eskilson:
> On 2010-04-29 21:33, Axel Müller wrote:
> > Am Donnerstag, 29. April 2010 10:25:20 schrieb Jesper Eskilson:
> >> On 2010-04-28 15:25, Doug Schaefer wrote:
> >>> It wouldn't be that complicated. You'd probably do it the same way you
> >>> pass the list of object files to the linker.
> >>
> >> No, because the linker ALWAYS receives ALL the objects files. The rule
> >> typically looks like this
> >>
> >> foo.exe: $(OBJS)
> >>            $(LINK) $^ -o $@
> >>
> >> If you would do the same with the compiler, you would *always* compile
> >> *all* source files. Instead, compiler rules typically look something
> >> like this:
> >>
> >> .c.h:
> >> 	$(CC) -c $<  -o $@
> >>
> >> This will invoke "cl -c foo.c -o foo.o", once for each source file which
> >> is out of date. I cannot see how the /MP option allows cl to
> >> parallellize over all the source files it should compile.
> >>
> >> This is getting too off-topic for CDT, so I'll stop here. Sorry if I'm
> >> not able to make myself clear.
> >
> > I just had a look at our Makefiles. The structure is indeed like you
> > said. .c.h:
> >   	$(CC) -c $<  -o $@
> > The compiler is invoked for every source file. When I add /MP3 to the
> > compiler flags three cl instances will run. I think one instance acts
> > like a kind of manager and two instances do actually compile. The compile
> > time benefit is measurable.
> > More info here:
> > http://msdn.microsoft.com/en-us/library/bb385193.aspx
> 
> (Yes, I know I said I would stop, but since Doug said this was on topic,
> I'll reply anyway. :-))
> 
>  From that page: "The /MP option can reduce the total time to compile
> the source files on the command line." I cannot see anything about
> cl.exe being able to parallellize over multiple *independently* launched
> cl.exe instances. Maybe that's an undocumented feature. Or maybe NMAKE
> is able to automatically "merge" independent compiler invocations into a
> single one.
> 
> How does the process tree look like? Are all cl.exe processes owned by
> NMAKE or is there a main cl.exe process which creates the others?
I am not sure about this. But I guess one cl.exe process is started at usual. 
If the /MP option is given then this process will start some more cl.exe 
instances. The main cl.exe process acts like a manager. nmake does not know 
anything about this.

  Axel




Back to the top