Opened 14 years ago

Closed 11 years ago

#250 closed bug (fixed)

Parallel build fails in rare case

Reported by: dreyer Owned by: dreyer
Priority: minor Milestone: 3-1-2 and higher
Component: factory Version: 3-1-1
Keywords: Cc:

Description

The parallel build of Singular fails in rare cause, because the dependence of factory components on factor.h is missing, see http://trac.sagemath.org/sage_trac/ticket/8059#comment:112

It seems to occur only on machines with a high number or CPU cores, but slow hard disks.

Change History (8)

comment:1 Changed 14 years ago by dreyer

All files depending on factory.h are listed in $(basefactorysrc). So I suggest the following patch, I checked it in as revision 13111 into svn.

Index: GNUmakefile.in
===================================================================
--- GNUmakefile.in      (revision 13110)
+++ GNUmakefile.in      (working copy)
@@ -492,6 +492,7 @@
 #
 # - explicit targets.
 #
+$(basefactorysrc:.cc=.o):      factory.h
 $(libfactory): $(factoryobj)
                $(AR) $(ARFLAGS) $@ $^
                $(RANLIB) $@

comment:2 Changed 14 years ago by dreyer

Also, the temporary executables gentable1 and gentable2 use object files, which are not declared as explicit dependencies of target, where they are used. So, I also suggest the following (svn revision 13112):

Index: Singular/Makefile.in
===================================================================
--- Singular/Makefile.in        (revision 13109)
+++ Singular/Makefile.in        (working copy)
@@ -377,7 +377,7 @@
 claptmpl.o: claptmpl.cc mod2.h
        ${CXX} ${CXXFLAGS}  ${CPPFLAGS} ${DEFS} -c $<

-iparith.inc: claptmpl.o iparith.cc \
+iparith.inc: ${OBJS} claptmpl.o iparith.cc \
                           ipconv.cc tok.h mpsr_Tok.cc grammar.h mod2.h
        ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXTEMPLFLAGS} ${DEFS} -DGENTABLE \
             -o gentable1 claptmpl.o iparith.cc tesths.cc mpsr_Tok.cc \
@@ -385,7 +385,7 @@
        ./gentable1
        /bin/rm -f gentable1 gentable1.exe

-mpsr_Tok.inc: claptmpl.o iparith.cc \
+mpsr_Tok.inc: ${OBJS} claptmpl.o iparith.cc \
                           ipconv.cc tok.h mpsr_Tok.cc grammar.h mod2.h
        ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXTEMPLFLAGS} ${DEFS} -DGENTABLE \
             -o gentable2 claptmpl.o iparith.cc tesths.cc mpsr_Tok.cc \

comment:3 Changed 14 years ago by hannes

The proposed solution is a Very Bad Thing (TM) as iparith.inc and mpsr_Tok.inc now depend on all OBJ, i.e. will always be rebuild. The contents of these files really only depends on iparith.cc.

comment:4 Changed 14 years ago by dreyer

But the build of iparith.inc and mpsr_Tok.inc actually does depend on all ${OBJS}. It is generated by gentable1 and gentable2, resp., which need all of ${OBJS} to be compiled, see for instance:

iparith.inc: ${OBJS} claptmpl.o iparith.cc \
                          ipconv.cc tok.h mpsr_Tok.cc grammar.h mod2.h
	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXTEMPLFLAGS} ${DEFS} -DGENTABLE \
	     -o gentable1 claptmpl.o iparith.cc tesths.cc mpsr_Tok.cc \
	     ${OBJS} ${LDFLAGS} ${LIBS} ../kernel/mmalloc.o
	./gentable1
	/bin/rm -f gentable1 gentable1.exe

(analogously mpsr_Tok.inc).

Of course, one could hack the Makefile in such a way, that this dependency is only added in the case that the .inc-files are not there. But then these files will not be rebuilded if the sources of ${OBJS} changed. (BTW: So it is by now.)

comment:5 Changed 14 years ago by dreyer

It was also proposed to replace "make" by "${MAKE}$ in The toplevel-Makefile: http://trac.sagemath.org/sage_trac/attachment/ticket/9733/singular-3.1.1.4-MAKE.patch

This would be the standard approach. I'm not sure, whether that's ok for Singular.

comment:6 Changed 14 years ago by dreyer

There another missing dependency:

Index: kernel/Makefile.in
===================================================================
--- kernel/Makefile.in  (revision 13162)
+++ kernel/Makefile.in  (working copy)
@@ -290,7 +290,7 @@
 endif


-installbin: ${DL_LIBS} ${DL_LIBSG}
+installbin: ${DL_LIBS} ${DL_LIBSG} libkernel.a libkernel_g.a
        ${MKINSTALLDIRS} ${bindir}
        - ranlib libkernel.a
        - ranlib libkernel_g.a

It's revision 13163 in trunk now.

comment:7 Changed 14 years ago by dreyer

Finally, Singular's parallel build is stable enough to be activated in Sage: http://trac.sagemath.org/sage_trac/ticket/9733#comment:29

comment:8 Changed 11 years ago by dreyer

Resolution: fixed
Status: newclosed

This specific issue is fixed. If new problems with the build system arise a new ticket is needed.

Note: See TracTickets for help on using tickets.