[AMBER-Developers] Possible parallel Makefile bug pertaining to sander.LES target

From: Mark Williamson <mjw.sdsc.edu>
Date: Fri, 23 Jan 2009 16:57:30 -0800

Dear All,

Recently, whilst building the AMBER CVS tree using parallel make
-j{~16}, I've been noticing the build process dying somewhere in the
sander directory. This fail point not always the same. However I think
I've traced this down to make's preprocessing of the sander.LES's
target; since it is now running in parallel (and hence sometimes out of
sequence), it has the ability to overwrite some preprocessed files
needed by the sander target. This is an example of one such file:


        cpp -traditional -P -xassembler-with-cpp -Dsecond=ambsecond remd.f >
        gfortran -c -O3 -fno-second-underscore -ffree-form -o remd.o _remd.f


        cpp -traditional -P -xassembler-with-cpp -Dsecond=ambsecond -DLES
remd.f > _remd.f
        gfortran -c -O3 -fno-second-underscore -ffree-form -o remd.LES.o _remd.f

Both will write to _remd.f and sander may end up with objects that are
designed for sander.LES.

One solution to this is to ensure that any source files preparsed with
-DLES needs to go to a differenly named _*.f file. I've modified the
makedepend script to do this:

[16:48][bunny:0.10][mjw:sander]$ cvs diff makedepend
Index: makedepend
RCS file: /home/amber_cvs/cvsroot/amber11/src/sander/makedepend,v
retrieving revision 10.0
diff -r10.0 makedepend
< printf "\t\$(FPP) -DLES $fileroot.f > _$fileroot.f\n";
 > 		printf "\t\$(FPP) -DLES $fileroot.f > _$fileroot.LES.f\n";
< 			printf "\t\$(FC) -c \$(FOPTFLAGS) -o \$. _$fileroot.f\n\n";
 > 			printf "\t\$(FC) -c \$(FOPTFLAGS) -o \$. _$fileroot.LES.f\n\n";
< 			printf "\t\$(FC) -c \$(FFLAGS) -o \$. _$fileroot.f\n\n";
 > 			printf "\t\$(FC) -c \$(FFLAGS) -o \$. _$fileroot.LES.f\n\n";
What do you think of this approach? Will this break something that I may 
  have overlooked?
AMBER-Developers mailing list
Received on Sun Jan 25 2009 - 01:15:10 PST
Custom Search