Re: [AMBER-Developers] Help with Makefiles for pmemd.cuda

From: Jason Swails <jason.swails.gmail.com>
Date: Thu, 4 Feb 2016 16:21:40 -0500

On Thu, Feb 4, 2016 at 3:33 PM, Ross Walker <ross.rosswalker.co.uk> wrote:

> > Changing compiler flags doesn't do anything to indicate to make that .o
> > files are out-of-date. You need to make sure that after each pmemd.cuda
> > precision model binary is built, the .o files from src/pmemd/src/cuda are
> > removed. That should trigger them to get rebuilt with the "next"
> precision
> > model and so on.
> >
>
> That's what I am trying to do with this line:
>
> >> cuda: configured_cuda cuda_lib_clean pmemd.cuda_SPFP$(SFX)
> cuda_lib_clean pmemd.cuda_DPFP$(SFX)
>
> but it doesn't run the cuda_lib_clean command between building
> pmemd.cuda_SPFP and pmemd.cuda_DPFP so thinks the .a file is up to date.
> Not sure why it doesn't do this. Is that it does not linearly execute the
> targets in that line under cuda - as in it runs the cuda_lib_clean and then
> assumes it already did it so doesn't do it again?
>
> > Also note that this is begging for race conditions when doing parallel
> > make. So you'll need an appropriate .NOTPARALLEL designation for each of
> > the main pmemd.cuda_PRECISION rules so you don't wind up with the builds
> > competing with (and killing) each other.
> >
> Ah so in parallel here the pmemd.cuda_SPFP and DPFP targets in the line
> above can be built at the same time?


​Yes, and you've observed this before. That's why running parallel make on
pmemd.cuda builds both the Fortran and CUDA objects at the same time with
different threads despite them both being in different rules.​

Ugh. :-( What is the syntax for adding the .NOTPARALLEL?


​.NOTPARALLEL: dep1 dep2 dep3 dep4

Where dep# is a build rule (be it object files or top-level build
targets). It's used in the sander Makefile. In most cases, you actually
*want* simultaneous builds if the rules are independent of each other
(which they would be if you had separate builds for each target rather than
reusing the same object file names).



> Note I still want pmemd.cuda_SPFP to be built in parallel and DPFP as
> well, just not overlapping with each other.
>

​If you put

.NOTPARALLEL: $(AMBERHOME)/bin/pmemd.cuda_SPFP​

​$(AMBERHOME)/bin/pmemd.cuda_DPFP

Then it will make sure that those two targets are not built in parallel,
but the targets themselves will be. .NOTPARALLEL simply lists targets that
will not be built at the same time, as far as I understand it.

​If serial make works for you but parallel make doesn't, then you've
clearly introduced race conditions into your Makefile.

-- 
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher
_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Thu Feb 04 2016 - 13:30:02 PST
Custom Search