[petsc-dev] Experimental GNU make build system

Jed Brown jedbrown at mcs.anl.gov
Wed May 22 21:32:52 CDT 2013


Satish Balay <balay at mcs.anl.gov> writes:

> Ok. The 'child_info_fork::abort:' error below is due to gnumake somehow
> trying to parallelize 'CLINKER /home/balay/petsc.clone/arch-gmake/lib/libpetsc.so'?

What do you mean "trying to parallelize"?  It's only running the linker
once.

Web search yields this, but it may not be relevant.

http://stackoverflow.com/questions/9300722/cygwin-error-bash-fork-retry-resource-temporarily-unavailable

> I see the same if I replace it with 'AR'. [here I'm having to use '-j
> 1' for AR part]
>
> I have a successful build with 'make -j 8' - and then 'make -j '1 to
> recover from AR errors. And 'make test' is successful.
>
> my hacky changes to get this working is below.
>
> Satish
>
> ---------
> diff --git a/conf/variables b/conf/variables
> index 79ce8ba..bb7746f 100644
> --- a/conf/variables
> +++ b/conf/variables
> @@ -10,7 +10,7 @@
>  #
>  PETSC_LIB_DIR       = ${PETSC_DIR}/${PETSC_ARCH}/lib
>
> -PETSC_CCPPFLAGS            = ${PETSC_CC_INCLUDES} ${PETSCFLAGS} ${CPP_FLAGS} ${CPPFLAGS} -D__INSDIR__=${LOCDIR}
> +PETSC_CCPPFLAGS            = ${PETSC_CC_INCLUDES} ${PETSCFLAGS} ${CPP_FLAGS} ${CPPFLAGS}
>  PETSC_FCPPFLAGS            = ${PETSC_FC_INCLUDES} ${PETSCFLAGS} ${FPP_FLAGS} ${FPPFLAGS}
>  PETSC_C_SH_LIB_PATH = ${CC_LINKER_SLFLAG}${PETSC_LIB_DIR}
>  PETSC_F_SH_LIB_PATH = ${FC_LINKER_SLFLAG}${PETSC_LIB_DIR}
> diff --git a/gmakefile b/gmakefile
> index 1577acb..e5c4a37 100644
> --- a/gmakefile
> +++ b/gmakefile
> @@ -9,6 +9,7 @@ pkgs := sys vec mat dm ksp snes ts
>
>  libpetsc_shared := $(LIBDIR)/libpetsc.so
>  libpetscpkgs_shared := $(foreach pkg, $(pkgs), $(LIBDIR)/libpetsc$(pkg).so)
> +libpetsc_static := $(LIBDIR)/libpetsc.${AR_LIB_SUFFIX}
>
>  ifeq ($(PETSC_WITH_EXTERNAL_LIB),)
>    libpetscall_shared := $(libpetscpkgs_shared)
> @@ -16,7 +17,7 @@ else
>    libpetscall_shared := $(libpetsc_shared)
>  endif
>
> -all : $(libpetscall_shared)
> +all : $(libpetsc_static)
>
>  .SECONDEXPANSION:              # to expand $$(@D)/.DIR
>
> @@ -40,9 +41,9 @@ else
>    cc_name := CC
>  endif
>
> -PETSC_DEPFLAGS.c := -MMD -MP
> -PETSC_DEPFLAGS.cxx := -MMD -MP
> -PETSC_DEPFLAGS.F := -MMD -MP
> +PETSC_DEPFLAGS.c := #-MMD -MP
> +PETSC_DEPFLAGS.cxx := #-MMD -MP
> +PETSC_DEPFLAGS.F := #-MMD -MP
>
>  PETSC_COMPILE.c = $(call quiet,$(cc_name)) -c $(PCC_FLAGS) $(CFLAGS) $(CCPPFLAGS) $(PETSC_DEPFLAGS.c)
>  PETSC_COMPILE.cxx = $(call quiet,CXX) -c $(PCC_FLAGS) $(CFLAGS) $(CCPPFLAGS) $(PETSC_DEPFLAGS.cxx)
> @@ -57,6 +58,8 @@ allobj := $(foreach pkg, $(pkgs), $(call concatlang,$(pkg)))
>  # with-single-library=1 (default)
>  $(libpetsc_shared) : $(allobj) | $$(@D)/.DIR
>         $(call quiet,CLINKER) -shared -o $@ $^ $(PETSC_EXTERNAL_LIB_BASIC)
> +$(libpetsc_static): $(allobj) | $$(@D)/.DIR
> +       $(call quiet,AR) $(FAST_AR_FLAGS) $@ $^
>
>  # with-single-library=0
>  libpkg = $(foreach pkg, $1, $(LIBDIR)/libpetsc$(pkg).so)
>
>
> On Wed, 22 May 2013, Satish Balay wrote:
>
>> Looks like it can will work on windows.
>> 
>> For one it doesn't like gcc options like -MDD. [gives warnings] - so I removed that.
>> 
>> And  - cl [or win32fe?] is not liking empty LOCDIR for "-D__INSDIR__=${LOCDIR}"
>> so I removed that.
>> 
>> The build with 'make -j 8' goes through quickly until:
>> 
>>   CLINKER /home/balay/petsc.clone/arch-gmake/lib/libpetsc.so
>> 
>> [so a static library target will perhaps fix this issue]
>> 
>> Satish
>> 
>> ---------
>>   CLINKER /home/balay/petsc.clone/arch-gmake/lib/libpetsc.so
>>       0 [main] sh 3108 child_info_fork::abort: can't commit memory for stack 0x2
>> 8A000(90112), Win32 error 487
>> /usr/bin/sh: fork: retry: Resource temporarily unavailable
>>       0 [main] sh 1824 child_info_fork::abort: can't commit memory for stack 0x2
>> 8A000(90112), Win32 error 487
>> /usr/bin/sh: fork: retry: Resource temporarily unavailable
>>       0 [main] sh 3548 child_info_fork::abort: can't commit memory for stack 0x2
>> 8A000(90112), Win32 error 487
>> /usr/bin/sh: fork: retry: Resource temporarily unavailable
>>       0 [main] sh 2908 child_info_fork::abort: can't commit memory for stack 0x2
>> 8A000(90112), Win32 error 487
>> /usr/bin/sh: fork: retry: Resource temporarily unavailable
>>       0 [main] sh 2872 child_info_fork::abort: can't commit memory for stack 0x2
>> 8A000(90112), Win32 error 487
>> /usr/bin/sh: fork: Resource temporarily unavailable
>> gmakefile:59: recipe for target `/home/balay/petsc.clone/arch-gmake/lib/libpetsc
>> .so' failed
>> make: *** [/home/balay/petsc.clone/arch-gmake/lib/libpetsc.so] Error 254
>> 
>> balay at msnehalem2 ~/petsc.clone
>> $
>> 
>> On Mon, 20 May 2013, Barry Smith wrote:
>> 
>> > 
>> >   And does this solve the Windows problem?
>> > 
>> > On May 20, 2013, at 4:46 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>> > 
>> > > I just merged 'jed/gnumake' to 'next'.  I haven't added support for
>> > > static libraries yet, but it should work with pretty much all other
>> > > configurations using compilers that support '-MMD -MP' (tested with gcc,
>> > > clang, and intel; C, C++, and Fortran; single and multiple library).
>> > > 
>> > >  $ make -f gmakefile -j20 PETSC_ARCH=your-choice
>> > > 
>> > > The makefile is 100 lines and the Python for figuring out what to
>> > > include in the build is about the same (conf/gmakegen.py; neglecting
>> > > python-2.4 compatibility stuff).  Simplifying the rules would reduce
>> > > that, naturally.
>> > > 
>> > > Let me know how it works for you.
>> > 
>> > 
>> 
>> 



More information about the petsc-dev mailing list