git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12591 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2014-10-07 14:13:43 +00:00
parent 7c748bb17f
commit fcad656d92
2 changed files with 29 additions and 10 deletions

View File

@ -156,21 +156,23 @@ Actions:
use -m switch for Makefile.machine to start from use -m switch for Makefile.machine to start from
else use existing Makefile.auto else use existing Makefile.auto
adds settings needed for installed accelerator packages adds settings needed for installed accelerator packages
Makefile.auto is NOT edited unless "file" action is specified
clean = invoke "make clean-auto", insures full build clean = invoke "make clean-auto", insures full build
useful if compiler flags have changed useful if compiler flags have changed
exe or machine = build LAMMPS exe or machine = build LAMMPS
machine can be any existing Makefile.machine suffix machine can be any existing Makefile.machine suffix
machine is simply converted to exe, as well as: machine is simply changed to "exe" action, as well as:
"-m machine" added if -m switch not specified "-m machine" added if -m switch not specified
"-o machine" added if -o switch not specified "-o machine" added if -o switch not specified
if either "-m" or "-o" are specified, they are not overridden if either "-m" or "-o" are specified, they are not overridden
exe builds using Makefile.auto exe always builds using Makefile.auto
if no file action, first generates a src/MAKE/MINE/Makefile.auto if no file action, first generates a src/MAKE/MINE/Makefile.auto
use -m switch to make copy of existing Makefile.machine use -m switch to make copy of existing Makefile.machine
or Makefile.auto must already exist or Makefile.auto must already exist
unlike file action, this does not change Makefile.auto unlike file action, this does NOT change Makefile.auto
does not invoke and lib actions, since libs could be previously built does not invoke and lib actions, since libs could be previously built
produces src/lmp_auto or error message if unsuccessful produces src/lmp_auto or error message if unsuccessful
use -o switch to copy src/lmp_auto to new filename
""" """
def check(self): def check(self):
@ -211,7 +213,7 @@ Actions:
def lib(self,suffix): def lib(self,suffix):
if suffix != "all": if suffix != "all":
print "building library",suffix,"..." print "building",suffix,"library ..."
str = "%s.build()" % suffix str = "%s.build()" % suffix
exec(str) exec(str)
else: else:
@ -220,7 +222,7 @@ Actions:
if final[one]: if final[one]:
if "user" in one: pkg = one[5:] if "user" in one: pkg = one[5:]
else: pkg = one else: pkg = one
print "building library",pkg,"..." print "building",pkg,"library ..."
str = "%s.build()" % pkg str = "%s.build()" % pkg
exec(str) exec(str)
@ -475,6 +477,11 @@ Actions:
if png.incdir: make.addvar("JPG_INC","-I%s" % png.incdir) if png.incdir: make.addvar("JPG_INC","-I%s" % png.incdir)
if png.libdir: make.addvar("JPG_PATH","-L%s" % png.libdir) if png.libdir: make.addvar("JPG_PATH","-L%s" % png.libdir)
# set self.stubs if Makefile.auto uses STUBS lib in MPI settings
if "-lmpi_stubs" in make.getvar("MPI_LIB"): self.stubs = 1
else: self.stubs = 0
# write out Makefile.auto # write out Makefile.auto
# unless caller = "exe" and "file" action already invoked # unless caller = "exe" and "file" action already invoked
@ -482,6 +489,7 @@ Actions:
make.write("%s/MAKE/MINE/Makefile.auto" % dir.src,1) make.write("%s/MAKE/MINE/Makefile.auto" % dir.src,1)
print "Created src/MAKE/MINE/Makefile.auto" print "Created src/MAKE/MINE/Makefile.auto"
# test full compile and link # test full compile and link
# unless caller = "file" and "exe" action will be invoked later # unless caller = "file" and "exe" action will be invoked later
@ -504,10 +512,19 @@ Actions:
# build LAMMPS using Makefile.auto and -j setting # build LAMMPS using Makefile.auto and -j setting
# invoke self.file() first, to test makefile compile/link # invoke self.file() first, to test makefile compile/link
# delete existing lmp_auto, so can detect if build fails # delete existing lmp_auto, so can detect if build fails
# build STUBS lib (if unbuilt) if Makefile.auto MPI settings need it
def exe(self): def exe(self):
self.file("exe") self.file("exe")
commands.getoutput("cd %s; rm -f lmp_auto" % dir.src) commands.getoutput("cd %s; rm -f lmp_auto" % dir.src)
if self.stubs and not os.path.isfile("%s/STUBS/libmpi_stubs.a" % dir.src):
print "building serial STUBS library ..."
str = "cd %s/STUBS; make clean; make" % dir.src
txt = commands.getoutput(str)
if not os.path.isfile("%s/STUBS/libmpi_stubs.a" % dir.src):
print txt
error('Unsuccessful "make stubs"')
print "Created src/STUBS/libmpi_stubs.a"
if jmake: str = "cd %s; make -j %d auto" % (dir.src,jmake.n) if jmake: str = "cd %s; make -j %d auto" % (dir.src,jmake.n)
else: str = "cd %s; make auto" % dir.src else: str = "cd %s; make auto" % dir.src
txt = commands.getoutput(str) txt = commands.getoutput(str)
@ -1081,10 +1098,10 @@ class CUDA:
if self.mode == "double": n = 2 if self.mode == "double": n = 2
elif self.mode == "mixed": n = 3 elif self.mode == "mixed": n = 3
elif self.mode == "single": n = 1 elif self.mode == "single": n = 1
str = "cd %s; make prec=%d arch=%s" % (libdir,n,self.arch) if jmake: str = "cd %s; make -j %d precision=%d arch=%s" % \
commands.getoutput(str) (libdir,jmake.n,n,self.arch)
if jmake: str = "cd %s; make -j %d" % (libdir,jmake.n) else: str = str = "cd %s; make precision=%d arch=%s" % \
else: str = "cd %s; make" % libdir (libdir,n,self.arch)
txt = commands.getoutput(str) txt = commands.getoutput(str)
if verbose: print txt if verbose: print txt
if not os.path.isfile("%s/liblammpscuda.a" % libdir) or \ if not os.path.isfile("%s/liblammpscuda.a" % libdir) or \

View File

@ -91,6 +91,8 @@ help:
# Build LAMMPS # Build LAMMPS
.DEFAULT: .DEFAULT:
@if [ $@ = "serial" -a ! -f STUBS/libmpi_stubs.a ]; \
then $(MAKE) stubs; fi
@test -f MAKE/Makefile.$@ -o -f MAKE/OPTIONS/Makefile.$@ -o \ @test -f MAKE/Makefile.$@ -o -f MAKE/OPTIONS/Makefile.$@ -o \
-f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@ -f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@
@if [ ! -d Obj_$@ ]; then mkdir Obj_$@; fi @if [ ! -d Obj_$@ ]; then mkdir Obj_$@; fi