Merge branch 'kim-install' into install-and-docs-reviewed

This commit is contained in:
Axel Kohlmeyer 2017-07-26 19:32:55 -04:00
commit da7a5f55d3
20 changed files with 359 additions and 213 deletions

View File

@ -233,8 +233,8 @@ set any needed options for the package via "-pk" "command-line switch"_Section_s
use accelerated styles in your input via "-sf" "command-line switch"_Section_start.html#start_6 or "suffix"_suffix.html command | lmp_machine -in in.script -sf gpu
:tb(c=2,s=|)
Note that the first 4 steps can be done as a single command, using the
src/Make.py tool. This tool is discussed in "Section
Note that the first 4 steps can be done as a single command with
suitable make command invocations. This is discussed in "Section
4"_Section_packages.html of the manual, and its use is
illustrated in the individual accelerator sections. Typically these
steps only need to be done once, to create an executable that uses one

View File

@ -734,8 +734,8 @@ package"_Section_start.html#start_3.
"smd/wall/surface"_fix_smd_wall_surface.html,
"temp/rescale/eff"_fix_temp_rescale_eff.html,
"ti/spring"_fix_ti_spring.html,
"ttm/mod"_fix_ttm.html
"wall/ees"_fix_wall_ees.html
"ttm/mod"_fix_ttm.html,
"wall/ees"_fix_wall_ees.html,
"wall/region/ees"_fix_wall_ees.html :tb(c=6,ea=c)
:line

View File

@ -49,6 +49,7 @@ Lists of both kinds of directories are given below.
Lowercase directories :h4
accelerate: run with various acceleration options (OpenMP, GPU, Phi)
airebo: polyethylene with AIREBO potential
balance: dynamic load balancing, 2d system
body: body particles, 2d system
cmap: CMAP 5-body contributions to CHARMM force field

View File

@ -492,14 +492,38 @@ Minnesota).
[Install or un-install:]
Using this package requires the KIM library and its models
(interatomic potentials) to be downloaded and installed on your
system. The library can be downloaded and built in lib/kim or
elsewhere on your system. Details of the download, build, and install
process for KIM are given in the lib/kim/README file.
Before building LAMMPS with this package, you must first download and
build the KIM library and include the KIM models that you want to
use. You can do this manually if you prefer; follow the instructions
in lib/kim/README. You can also do it in one step from the lammps/src
dir, using a command like these, which simply invoke the
lib/kim/Install.py script with the specified args.
Once that process is complete, you can then install/un-install the
package and build LAMMPS in the usual manner:
make lib-kim # print help message
make lib-kim args="-b . none" # install KIM API lib with only example models
make lib-kim args="-b . Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model
make lib-kim args="-b . OpenKIM" # install KIM API lib with all models
make lib-kim args="-a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver :pre
Note that in LAMMPS lingo, a KIM model driver is a pair style
(e.g. EAM or Tersoff). A KIM model is a pair style for a particular
element or alloy and set of parameters, e.g. EAM for Cu with a
specific EAM potential file. Also note that installing the KIM API
library with all its models, may take around 30 min to build. Of
course you only need to do that once.
See the list of KIM model drivers here:
https://openkim.org/kim-items/model-drivers/alphabetical
See the list of all KIM models here:
https://openkim.org/kim-items/models/by-model-drivers
See the list of example KIM models included by default here:
https://openkim.org/kim-api
in the "What is in the KIM API source package?" section
You can then install/un-install the package and build LAMMPS in the
usual manner:
make yes-kim
make machine :pre
@ -1414,7 +1438,7 @@ lib/linalg. In the latter case you also need to build the library
in lib/linalg with a command like these:
make lib-linalg # print help message
make lib-atc args="-m gfortran" # build with GNU Fortran compiler
make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
You can then install/un-install the package and build LAMMPS in the
usual manner:
@ -2469,8 +2493,8 @@ step from the lammps/src dir, using a command like these, which simply
invoke the lib/smd/Install.py script with the specified args:
make lib-smd # print help message
make lib-smd args="-g -l" # download in default lib/smd/eigen-eigen-*
make lib-smd args="-h . eigen -g -l" # download in lib/smd/eigen
make lib-smd args="-g -l" # download and build in default lib/smd/eigen-eigen-*
make lib-smd args="-h . eigen -g -l" # download and build in lib/smd/eigen
make lib-smd args="-h ~ eigen -g -l" # download and build in ~/eigen :pre
Note that the final -l switch is to create a symbolic (soft) link

View File

@ -74,13 +74,8 @@ Run lammps/lib/gpu/nvc_get_devices (after building the GPU library, see below) t
This requires two steps (a,b): build the GPU library, then build
LAMMPS with the GPU package.
You can do both these steps in one line, using the src/Make.py script,
described in "Section 4"_Section_packages.html of the manual.
Type "Make.py -h" for help. If run from the src directory, this
command will create src/lmp_gpu using src/MAKE/Makefile.mpi as the
starting Makefile.machine:
Make.py -p gpu -gpu mode=single arch=31 -o gpu -a lib-gpu file mpi :pre
You can do both these steps in one line as described in
"Section 4"_Section_packages.html of the manual.
Or you can follow these two (a,b) steps:

View File

@ -225,11 +225,9 @@ source /opt/intel/parallel_studio_xe_2016.3.067/psxevars.sh
# or psxevars.csh for C-shell
make intel_cpu_intelmpi :pre
Alternatively, the build can be accomplished with the src/Make.py
script, described in "Section 4"_Section_packages.html of the
manual. Type "Make.py -h" for help. For an example:
Make.py -v -p intel omp -intel cpu -a file intel_cpu_intelmpi :pre
Alternatively this can be done as a single command with
suitable make command invocations. This is discussed in "Section
4"_Section_packages.html of the manual.
Note that if you build with support for a Phi coprocessor, the same
binary can be used on nodes with or without coprocessors installed.
@ -244,8 +242,7 @@ highly recommended for CCFLAGS and LINKFLAGS. LIB should include
is required for CCFLAGS and "-qoffload" is required for LINKFLAGS.
Other recommended CCFLAG options for best performance are
"-O2 -fno-alias -ansi-alias -qoverride-limits fp-model fast=2
-no-prec-div". The Make.py command will add all of these
automatically.
-no-prec-div".
NOTE: The vectorization and math capabilities can differ depending on
the CPU. For Intel compilers, the "-x" flag specifies the type of

View File

@ -60,8 +60,7 @@ More details follow.
use a C++11 compatible compiler
make yes-kokkos
make mpi KOKKOS_DEVICES=OpenMP # build with the KOKKOS package
make kokkos_omp # or Makefile.kokkos_omp already has variable set
Make.py -v -p kokkos -kokkos omp -o mpi -a file mpi # or one-line build via Make.py :pre
make kokkos_omp # or Makefile.kokkos_omp already has variable set :pre
mpirun -np 16 lmp_mpi -k on -sf kk -in in.lj # 1 node, 16 MPI tasks/node, no threads
mpirun -np 2 -ppn 1 lmp_mpi -k on t 16 -sf kk -in in.lj # 2 nodes, 1 MPI task/node, 16 threads/task
@ -82,8 +81,7 @@ use a C++11 compatible compiler
KOKKOS_DEVICES = Cuda, OpenMP
KOKKOS_ARCH = Kepler35
make yes-kokkos
make machine
Make.py -p kokkos -kokkos cuda arch=31 -o kokkos_cuda -a file kokkos_cuda :pre
make machine :pre
mpirun -np 1 lmp_cuda -k on t 6 -sf kk -in in.lj # one MPI task, 6 threads on CPU
mpirun -np 4 -ppn 1 lmp_cuda -k on t 6 -sf kk -in in.lj # ditto on 4 nodes :pre
@ -98,8 +96,7 @@ use a C++11 compatible compiler
KOKKOS_DEVICES = OpenMP
KOKKOS_ARCH = KNC
make yes-kokkos
make machine
Make.py -p kokkos -kokkos phi -o kokkos_phi -a file mpi :pre
make machine :pre
host=MIC, Intel Phi with 61 cores (240 threads/phi via 4x hardware threading):
mpirun -np 1 lmp_g++ -k on t 240 -sf kk -in in.lj # 1 MPI task on 1 Phi, 1*240 = 240
@ -135,9 +132,9 @@ mode like the USER-INTEL package supports.
You must choose at build time whether to build for CPUs (OpenMP),
GPUs, or Phi.
You can do any of these in one line, using the src/Make.py script,
described in "Section 4"_Section_packages.html of the manual.
Type "Make.py -h" for help. If run from the src directory, these
You can do any of these in one line, using the suitable make command
line flags as described in "Section 4"_Section_packages.html of the
manual. If run from the src directory, these
commands will create src/lmp_kokkos_omp, lmp_kokkos_cuda, and
lmp_kokkos_phi. Note that the OMP and PHI options use
src/MAKE/Makefile.mpi as the starting Makefile.machine. The CUDA

View File

@ -23,8 +23,7 @@ one or more 16-core nodes. More details follow.
use -fopenmp with CCFLAGS and LINKFLAGS in Makefile.machine
make yes-user-omp
make mpi # build with USER-OMP package, if settings added to Makefile.mpi
make omp # or Makefile.omp already has settings
Make.py -v -p omp -o mpi -a file mpi # or one-line build via Make.py :pre
make omp # or Makefile.omp already has settings :pre
lmp_mpi -sf omp -pk omp 16 < in.script # 1 MPI task, 16 threads
mpirun -np 4 lmp_mpi -sf omp -pk omp 4 -in in.script # 4 MPI tasks, 4 threads/task
@ -40,14 +39,11 @@ each MPI task running on a CPU.
The lines above illustrate how to include/build with the USER-OMP
package in two steps, using the "make" command. Or how to do it with
one command via the src/Make.py script, described in "Section
4"_Section_packages.html of the manual. Type "Make.py -h" for
help.
one command as described in "Section 4"_Section_packages.html of the manual.
Note that the CCFLAGS and LINKFLAGS settings in Makefile.machine must
include "-fopenmp". Likewise, if you use an Intel compiler, the
CCFLAGS setting must include "-restrict". The Make.py command will
add these automatically.
CCFLAGS setting must include "-restrict".
[Run with the USER-OMP package from the command line:]

View File

@ -21,8 +21,7 @@ Here is a quick overview of how to use the OPT package. More details
follow.
make yes-opt
make mpi # build with the OPT package
Make.py -v -p opt -o mpi -a file mpi # or one-line build via Make.py :pre
make mpi # build with the OPT package :pre
lmp_mpi -sf opt -in in.script # run in serial
mpirun -np 4 lmp_mpi -sf opt -in in.script # run in parallel :pre
@ -35,13 +34,10 @@ None.
The lines above illustrate how to build LAMMPS with the OPT package in
two steps, using the "make" command. Or how to do it with one command
via the src/Make.py script, described in "Section
4"_Section_packages.html of the manual. Type "Make.py -h" for
help.
as described in "Section 4"_Section_packages.html of the manual.
Note that if you use an Intel compiler to build with the OPT package,
the CCFLAGS setting in your Makefile.machine must include "-restrict".
The Make.py command will add this automatically.
[Run with the OPT package from the command line:]

View File

@ -109,7 +109,8 @@ atoms in the specified group. This can be useful for models where a
large portion of the simulation is particles that do not interact with
other particles or with each other via pairwise interactions. The
group specified with this option must also be specified via the
"atom_modify first"_atom_modify.html command.
"atom_modify first"_atom_modify.html command. Note that specifying
"all" as the group-ID effectively turns off the {include} option.
The {exclude} option turns off pairwise interactions between certain
pairs of atoms, by not including them in the neighbor list. These are
@ -213,5 +214,5 @@ space.
[Default:]
The option defaults are delay = 10, every = 1, check = yes, once = no,
cluster = no, include = all, exclude = none, page = 100000, one =
2000, and binsize = 0.0.
cluster = no, include = all (same as no include option defined),
exclude = none, page = 100000, one = 2000, and binsize = 0.0.

View File

@ -58,7 +58,7 @@ These are the sample problems and their output in the various
sub-directories:
accelerate: use of all the various accelerator packages
airebo: example for using AIREBO and AIREBO-M
airebo: polyethylene with AIREBO potential
balance: dynamic load balancing, 2d system
body: body particles, 2d system
cmap: CMAP 5-body contributions to CHARMM force field

View File

@ -9,12 +9,21 @@ import sys,commands,os
# help message
help = """
Syntax: python Install.py -m machine -e suffix
specify -m and optionally -e, order does not matter
Syntax from src dir: make lib-libname args="-m machine -e suffix"
Syntax from lib dir: python Install.py -m machine -e suffix
libname = name of lib dir (e.g. atc, colvars, h5md, meam, poems, etc)
specify -m and optionally -e, order does not matter
-m = peform a clean followed by "make -f Makefile.machine"
machine = suffix of a lib/Makefile.* file
-e = set EXTRAMAKE variable in Makefile.machine to Makefile.lammps.suffix
does not alter existing Makefile.machine
Examplesx:
make lib-colvars args="-m g++" # build COLVARS lib with GNU g++ compiler
make lib-meam args="-m ifort" # build MEAM lib with Intel ifort compiler
"""
# print error message or help

View File

@ -8,14 +8,17 @@ import sys,os,re,commands
# help message
help = """
Syntax: python Install.py -i isuffix -h hdir -a arch -p precision -e esuffix -m -o osuffix
specify one or more options, order does not matter
copies an existing Makefile.isuffix in lib/gpu to Makefile.auto
optionally edits these variables in Makefile.auto:
CUDA_HOME, CUDA_ARCH, CUDA_PRECISION, EXTRAMAKE
optionally uses Makefile.auto to build the GPU library -> libgpu.a
and to copy a Makefile.lammps.esuffix -> Makefile.lammps
optionally copies Makefile.auto to a new Makefile.osuffix
Syntax from src dir: make lib-gpu args="-i isuffix -h hdir -a arch -p precision -e esuffix -m -o osuffix"
Syntax from lib dir: python Install.py -i isuffix -h hdir -a arch -p precision -e esuffix -m -o osuffix
specify one or more options, order does not matter
copies an existing Makefile.isuffix in lib/gpu to Makefile.auto
optionally edits these variables in Makefile.auto:
CUDA_HOME, CUDA_ARCH, CUDA_PRECISION, EXTRAMAKE
optionally uses Makefile.auto to build the GPU library -> libgpu.a
and to copy a Makefile.lammps.esuffix -> Makefile.lammps
optionally copies Makefile.auto to a new Makefile.osuffix
-i = use Makefile.isuffix as starting point, copy to Makefile.auto
default isuffix = linux
@ -34,6 +37,12 @@ Syntax: python Install.py -i isuffix -h hdir -a arch -p precision -e esuffix -m
also copies EXTRAMAKE file -> Makefile.lammps
-e can set which Makefile.lammps.esuffix file is copied
-o = copy final Makefile.auto to Makefile.osuffix
Examples:
make lib-gpu args="-m" # build GPU lib with default Makefile.linux
make lib-gpu args="-i xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision
make lib-gpu args="-i xk7 -p single -o xk7.single -m" # ditto, also build GPU lib
"""
# print error message or help

View File

@ -1,150 +1,232 @@
#!/usr/bin/env python
# install.py tool to setup the kim-api library
# install.pa tool to setup the kim-api library
# used to automate the steps described in the README file in this dir
import sys,os,re,urllib,commands
from __future__ import print_function
import sys,os,re,subprocess
try: from urllib.request import urlretrieve as geturl
except: from urllib import urlretrieve as geturl
help = """
Syntax: install.py -v version -c kim-dir -b kim-model-name -a kim-name
specify one or more options, order does not matter
-v = version of kim-api to download and work with
default = kim-api-v1.8.2 (current as of June 2017)
-c = create Makefile.KIM_DIR within lammps lib/kim to configure lammps
for use with the kim-api library installed at "kim-dir" (absolute
path). default = this dir
-b = build kim-api and kim model where kim-model-name can be a specific
openkim.org model name (such as
"EAM_Dynamo_Ackland_W__MO_141627196590_002") or the keyword
"OpenKIM" to install all compatible models from the openkim.org
site.
-a = add kim-name openkim.org item (model driver or model) to existing
kim-api instalation.
Syntax from src dir: make lib-kim args="-v version -b kim-install-dir kim-name -a kim-name"
Syntax from lib dir: python Install.py -v version -b kim-install-dir kim-name -a kim-name
specify one or more options, order does not matter
-v = version of KIM API library to use
default = kim-api-v1.8.2 (current as of June 2017)
-b = download and build KIM API library with KIM models
kim-dir = where to install/build the KIM API library
use "." to install in lib/kim
kim-name = none to install only the example KIM models
kim-name = KIM model name (see example below) + examples
kim-name = OpenKIM to install all models
from the openkim.org site (this can take 30 minutes or more)
-a = add single KIM model or model driver with kim-name
to existing KIM API lib (see example below)
Examples:
make lib-kim args="-b . none" # install KIM API lib with only example models
make lib-kim args="-b . Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model
make lib-kim args="-b . OpenKIM" # install KIM API lib with all models
make lib-kim args="-a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver
See the list of KIM model drivers here:
https://openkim.org/kim-items/model-drivers/alphabetical
See the list of all KIM models here:
https://openkim.org/kim-items/models/by-model-drivers
See the list of example KIM models included by default here:
https://openkim.org/kim-api
in the "What is in the KIM API source package?" section
"""
def error():
print help
print(help)
sys.exit()
# parse args
args = sys.argv
args = sys.argv[1:]
nargs = len(args)
if nargs == 0: error()
thisdir = os.environ['PWD']
dir = thisdir
version = "kim-api-v1.8.2"
dirflag = 0
buildflag = 0
addflag = 0
buildflag = False
addflag = False
iarg = 1
iarg = 0
while iarg < len(args):
if args[iarg] == "-v":
if iarg+2 > len(args): error()
version = args[iarg+1]
iarg += 2
elif args[iarg] == "-c":
dirflag = 1
if iarg+2 > len(args): error()
dir = args[iarg+1]
iarg += 2
elif args[iarg] == "-b":
buildflag = 1
if iarg+2 > len(args): error()
modelname = args[iarg+1]
iarg += 2
buildflag = True
if iarg+3 > len(args): error()
dir = args[iarg+1]
modelname = args[iarg+2]
iarg += 3
elif args[iarg] == "-a":
addflag = 1
addflag = True
if iarg+2 > len(args): error()
addmodelname = args[iarg+1]
iarg += 2
else: error()
thisdir = os.path.abspath(thisdir)
dir = os.path.abspath(dir)
url = "https://s3.openkim.org/kim-api/%s.tgz" % version
# download and unpack tarball
# download KIM tarball, unpack, build KIM
# either in lib/kim or user-requested location
if buildflag:
if not os.path.isfile("%s/Makefile.KIM_DIR" % thisdir):
open("%s/Makefile.KIM_DIR" % thisdir, 'w').write("KIM_INSTALL_DIR=%s" % dir)
open("%s/Makefile.KIM_Config" % thisdir, 'w').write("include %s/lib/kim-api/Makefile.KIM_Config" % dir)
print "Created %s/Makefile.KIM_DIR : using %s" % (thisdir,dir)
else:
if dirflag == 1:
open("%s/Makefile.KIM_DIR" % thisdir, 'w').write("KIM_INSTALL_DIR=%s" % dir)
open("%s/Makefile.KIM_Config" % thisdir, 'w').write("include %s/lib/kim-api/Makefile.KIM_Config" % dir)
print "Updated %s/Makefile.KIM_DIR : using %s" % (thisdir,dir)
# set install directory
dir = os.path.join(os.path.abspath(dir), "installed-" + version)
if buildflag == 1:
# download kim-api
print "Downloading kim-api tarball ..."
urllib.urlretrieve(url,"%s/%s.tgz" % (thisdir,version))
print "Unpacking kim-api tarball ..."
# check to see if an installed kim-api already exists and wipe it out.
if os.path.isdir(dir):
print("kim-api is already installed at %s.\nRemoving it for re-install" % dir)
cmd = "rm -rf %s" % dir
subprocess.check_output(cmd,shell=True)
# configure LAMMPS to use kim-api to be installed
with open("%s/Makefile.KIM_DIR" % thisdir, 'w') as mkfile:
mkfile.write("KIM_INSTALL_DIR=%s\n\n" % dir)
mkfile.write(".DUMMY: print_dir\n\n")
mkfile.write("print_dir:\n")
mkfile.write(" @printf $(KIM_INSTALL_DIR)\n")
with open("%s/Makefile.KIM_Config" % thisdir, 'w') as cfgfile:
cfgfile.write("include %s/lib/kim-api/Makefile.KIM_Config" % dir)
print("Created %s/Makefile.KIM_DIR : using %s" % (thisdir,dir))
# download entire kim-api tarball
print("Downloading kim-api tarball ...")
geturl(url,"%s/%s.tgz" % (thisdir,version))
print("Unpacking kim-api tarball ...")
cmd = "cd %s; rm -rf %s; tar zxvf %s.tgz" % (thisdir,version,version)
txt = commands.getstatusoutput(cmd)
if txt[0] != 0: error()
subprocess.check_output(cmd,shell=True)
# configure kim-api
print "Configuring kim-api ..."
print("Configuring kim-api ...")
cmd = "cd %s/%s; ./configure --prefix='%s'" % (thisdir,version,dir)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
subprocess.check_output(cmd,shell=True)
# build kim-api
print "Configuring model : %s" % modelname
cmd = "cd %s/%s; make add-%s" % (thisdir,version,modelname)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
#
print "Building kim-api ..."
print("Configuring model : %s" % modelname)
if modelname == "none":
cmd = "cd %s/%s; make add-examples" % (thisdir,version)
else:
if modelname == "OpenKIM":
print("configuring all OpenKIM models, this will take a while ...")
cmd = "cd %s/%s; make add-examples; make add-%s" % \
(thisdir,version,modelname)
subprocess.check_output(cmd,shell=True)
print("Building kim-api ...")
cmd = "cd %s/%s; make" % (thisdir,version)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
subprocess.check_output(cmd,shell=True)
# install kim-api
print "Installing kim-api ..."
print("Installing kim-api ...")
cmd = "cd %s/%s; make install" % (thisdir,version)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
#
subprocess.check_output(cmd,shell=True)
cmd = "cd %s/%s; make install-set-default-to-v1" %(thisdir,version)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
subprocess.check_output(cmd,shell=True)
# remove source files
print "Removing kim-api source and build files ..."
cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" % (thisdir,version,version)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
if addflag == 1:
# download model
print("Removing kim-api source and build files ...")
cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" % (thisdir,version,version)
subprocess.check_output(cmd,shell=True)
# add a single model (and possibly its driver) to existing KIM installation
if addflag:
# get location of installed kim-api
if not os.path.isfile("%s/Makefile.KIM_DIR" % thisdir):
print("kim-api is not installed")
error()
else:
cmd = "cd %s; make -f Makefile.KIM_DIR print_dir" % thisdir
dir = subprocess.check_output(cmd,shell=True)[1]
# download single model
# try first via urllib
# if fails (probably due to no SSL support), use wget
print("Downloading item tarball ...")
url = "https://openkim.org/download/%s.tgz" % addmodelname
print "Downloading item tarball ..."
urllib.urlretrieve(url,"%s/%s.tgz" % (thisdir,addmodelname))
print "Unpacking item tarball ..."
geturl(url,"%s/%s.tgz" % (thisdir,addmodelname))
print("Unpacking item tarball ...")
cmd = "cd %s; tar zxvf %s.tgz" % (thisdir,addmodelname)
txt = commands.getstatusoutput(cmd)
if txt[0] != 0: error()
#
print "Building item ..."
subprocess.check_output(cmd,shell=True)
print("Building item ...")
cmd = "cd %s/%s; make; make install" %(thisdir,addmodelname)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
#
print "Removing kim item source and build files ..."
try:
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
except subprocess.CalledProcessError as e:
# Error: but first, check to see if it needs a driver
firstRunOutput = e.output.decode()
cmd = "cd %s/%s; make kim-item-type" % (thisdir,addmodelname)
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
txt = txt.decode().strip()
if txt == "ParameterizedModel":
# Get and install driver
cmd = "cd %s/%s; make model-driver-name" % (thisdir,addmodelname)
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
adddrivername = txt.decode().strip()
print("First installing model driver: %s" % adddrivername)
cmd = "cd %s; python Install.py -a %s" % (thisdir,adddrivername)
try:
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
except subprocess.CalledProcessError as e:
print(e.output)
sys.exit()
# now install the model that needed the driver
print("Now installing model : %s" % addmodelname)
cmd = "cd %s; python Install.py -a %s" % (thisdir,addmodelname)
try:
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
except subprocess.CalledProcessError as e:
print(e.output)
sys.exit()
print(txt.decode())
sys.exit()
else:
print(firstRunOutput)
print("Error, unable to build and install OpenKIM item: %s" \
% addmodelname)
sys.exit()
# success the first time
print(txt)
print("Removing kim item source and build files ...")
cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" %(thisdir,addmodelname,addmodelname)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
subprocess.check_output(cmd,shell=True)

View File

@ -8,14 +8,16 @@ James Sethna (Cornell U). Ryan Elliott is the main developer for the
KIM API and he also maintains the code that implements the pair_style
kim command.
To download, build, and install the KIM API on your system, follow
these steps. You can use the install.py script to automate these steps.
You can type "make lib-kim" from the src directory to see help on
how to download and build this library via make commands, or you can
do the same thing by typing "python Install.py" from within this
directory, or you can do it manually by following the instructions
below.
-----------------
Instructions:
1. Configure lammps for use with the kim-api library installed in this directory
$ printf "KIM_INSTALL_DIR=${PWD}\n" > ./Makefile.KIM_DIR
@ -65,7 +67,7 @@ $ rm -rf EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001.tgz
When these steps are complete you can build LAMMPS with the KIM
package installed:
$ cd ../../src
$ cd lammpos/src
$ make yes-kim
$ make g++ (or whatever target you wish)

View File

@ -8,9 +8,15 @@ import sys,commands,os
# help message
help = """
Syntax: python Install.py -m machine
Syntax from src dir: make lib-linalg args="-m machine"
Syntax from lib dir: python Install.py -m machine
-m = peform a clean followed by "make -f Makefile.machine"
machine = suffix of a lib/Makefile.* file
Example:
make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
"""
# print error message or help

View File

@ -8,8 +8,11 @@ import sys,os,re,commands
# help message
help = """
Syntax: python Install.py -h hpath hdir -g -b [suffix] -l
specify one or more options, order does not matter
Syntax from src dir: make lib-mscg args="-h hpath hdir -g -b [suffix] -l"
Syntax from lib dir: python Install.py -h hpath hdir -g -b [suffix] -l
specify one or more options, order does not matter
-h = set home dir of MS-CG to be hpath/hdir
hpath can be full path, contain '~' or '.' chars
default hpath = . = lib/mscg
@ -22,6 +25,10 @@ Syntax: python Install.py -h hpath hdir -g -b [suffix] -l
optional suffix specifies which src/Make/Makefile.suffix to use
default suffix = g++_simple
-l = create 2 softlinks (includelink,liblink) in lib/mscg to MS-CG src dir
Example:
make lib-mscg args="-g -b -l" # download/build in lib/mscg/MSCG-release-master
"""
# settings

View File

@ -3,13 +3,19 @@
# Install.py tool to download, unpack, and point to the Eigen library
# used to automate the steps described in the README file in this dir
import sys,os,re,glob,commands
from __future__ import print_function
import sys,os,re,glob,subprocess
try: from urllib.request import urlretrieve as geturl
except: from urllib import urlretrieve as geturl
# help message
help = """
Syntax: python Install.py -h hpath hdir -g -l
specify one or more options, order does not matter
Syntax from src dir: make lib-smd args="-h hpath hdir -g -l"
Syntax from lib dir: python Install.py -h hpath hdir -g -l
specify one or more options, order does not matter
-h = set home dir of Eigen to be hpath/hdir
hpath can be full path, contain '~' or '.' chars
default hpath = . = lib/smd
@ -19,18 +25,23 @@ Syntax: python Install.py -h hpath hdir -g -l
hpath must already exist
if hdir already exists, it will be deleted before unpack
-l = create softlink (includelink) in lib/smd to Eigen src dir
Example:
make lib-smd args="-g -l" # download/build in default lib/smd/eigen-eigen-*
"""
# settings
url = "http://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz"
version = '3.3.4'
url = "http://bitbucket.org/eigen/eigen/get/%s.tar.gz" % version
tarball = "eigen.tar.gz"
# print error message or help
def error(str=None):
if not str: print help
else: print "ERROR",str
if not str: print(help)
else: print("ERROR",str)
sys.exit()
# expand to full path name
@ -73,26 +84,26 @@ if not os.path.isdir(homepath): error("Eigen path does not exist")
# glob to find name of dir it unpacks to
if grabflag:
print "Downloading Eigen ..."
cmd = "curl -L %s > %s/%s" % (url,homepath,tarball)
print cmd
print commands.getoutput(cmd)
print("Downloading Eigen ...")
geturl(url,"%s/%s" % (homepath,tarball))
print "Unpacking Eigen tarball ..."
print("Unpacking Eigen tarball ...")
edir = glob.glob("%s/eigen-eigen-*" % homepath)
for one in edir:
if os.path.isdir(one): commands.getoutput("rm -rf %s" % one)
cmd = "cd %s; tar zxvf %s" % (homepath,tarball)
commands.getoutput(cmd)
if os.path.isdir(one):
subprocess.check_output("rm -rf %s" % one,shell=True)
cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarball)
subprocess.check_output(cmd,shell=True)
if homedir != "ee":
if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir)
if os.path.exists(homedir):
subprocess.check_output("rm -rf %s" % homedir,shell=True)
edir = glob.glob("%s/eigen-eigen-*" % homepath)
os.rename(edir[0],"%s/%s" % (homepath,homedir))
# create link in lib/smd to Eigen src dir
if linkflag:
print "Creating link to Eigen files"
print("Creating link to Eigen files")
if os.path.isfile("includelink") or os.path.islink("includelink"):
os.remove("includelink")
if homedir == "ee":
@ -100,4 +111,4 @@ if linkflag:
linkdir = edir[0]
else: linkdir = "%s/%s" % (homepath,homedir)
cmd = "ln -s %s includelink" % linkdir
commands.getoutput(cmd)
subprocess.check_output(cmd,shell=True)

View File

@ -2,14 +2,19 @@
# Install.py tool to download, unpack, build, and link to the Voro++ library
# used to automate the steps described in the README file in this dir
import sys,os,re,urllib,commands
from __future__ import print_function
import sys,os,re,subprocess
try: from urllib.request import urlretrieve as geturl
except: from urllib import urlretrieve as geturl
# help message
help = """
Syntax: python Install.py -v version -h hpath hdir -g -b -l
specify one or more options, order does not matter
Syntax from src dir: make lib-voronoi args="-v version -h hpath hdir -g -b -l"
Syntax from lib dir: python Install.py -v version -h hpath hdir -g -b -l
specify one or more options, order does not matter
-v = version of Voro++ to download and build
default version = voro++-0.4.6 (current as of Jan 2015)
-h = set home dir of Voro++ to be hpath/hdir
@ -22,6 +27,10 @@ Syntax: python Install.py -v version -h hpath hdir -g -b -l
if hdir already exists, it will be deleted before unpack
-b = build Voro++ library in its src dir
-l = create 2 softlinks (includelink,liblink) in lib/voronoi to Voro++ src dir
Example:
make lib-voronoi args="-g -b -l" # download/build in lib/voronoi/voro++-0.4.6
"""
# settings
@ -32,8 +41,8 @@ url = "http://math.lbl.gov/voro++/download/dir/%s.tar.gz" % version
# print error message or help
def error(str=None):
if not str: print help
else: print "ERROR",str
if not str: print(help)
else: print("ERROR",str)
sys.exit()
# expand to full path name
@ -51,9 +60,9 @@ if nargs == 0: error()
homepath = "."
homedir = version
grabflag = 0
buildflag = 0
linkflag = 0
grabflag = False
buildflag = False
linkflag = False
iarg = 0
while iarg < nargs:
@ -67,13 +76,13 @@ while iarg < nargs:
homedir = args[iarg+2]
iarg += 3
elif args[iarg] == "-g":
grabflag = 1
grabflag = True
iarg += 1
elif args[iarg] == "-b":
buildflag = 1
buildflag = True
iarg += 1
elif args[iarg] == "-l":
linkflag = 1
linkflag = True
iarg += 1
else: error()
@ -84,35 +93,38 @@ homedir = "%s/%s" % (homepath,homedir)
# download and unpack Voro++ tarball
if grabflag:
print "Downloading Voro++ ..."
urllib.urlretrieve(url,"%s/%s.tar.gz" % (homepath,version))
print("Downloading Voro++ ...")
geturl(url,"%s/%s.tar.gz" % (homepath,version))
print "Unpacking Voro++ tarball ..."
print("Unpacking Voro++ tarball ...")
if os.path.exists("%s/%s" % (homepath,version)):
commands.getoutput("rm -rf %s/%s" % (homepath,version))
cmd = "cd %s; tar zxvf %s.tar.gz" % (homepath,version)
commands.getoutput(cmd)
cmd = 'rm -rf "%s/%s"' % (homepath,version)
subprocess.check_output(cmd,shell=True)
cmd = 'cd "%s"; tar -xzvf %s.tar.gz' % (homepath,version)
subprocess.check_output(cmd,shell=True)
if os.path.basename(homedir) != version:
if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir)
if os.path.exists(homedir):
cmd = 'rm -rf "%s"' % homedir
subprocess.check_output(cmd,shell=True)
os.rename("%s/%s" % (homepath,version),homedir)
# build Voro++
if buildflag:
print "Building Voro++ ..."
cmd = "cd %s; make" % homedir
txt = commands.getoutput(cmd)
print txt
print("Building Voro++ ...")
cmd = 'cd "%s"; make' % homedir
txt = subprocess.check_output(cmd,shell=True)
print(txt)
# create 2 links in lib/voronoi to Voro++ src dir
if linkflag:
print "Creating links to Voro++ include and lib files"
print("Creating links to Voro++ include and lib files")
if os.path.isfile("includelink") or os.path.islink("includelink"):
os.remove("includelink")
if os.path.isfile("liblink") or os.path.islink("liblink"):
os.remove("liblink")
cmd = "ln -s %s/src includelink" % homedir
commands.getoutput(cmd)
cmd = "ln -s %s/src liblink" % homedir
commands.getoutput(cmd)
cmd = ['ln -s "%s/src" includelink' % homedir, 'includelink']
subprocess.check_output(cmd,shell=True)
cmd = ['ln -s "%s/src" liblink' % homedir]
subprocess.check_output(cmd,shell=True)

View File

@ -116,7 +116,8 @@ help:
@echo 'make package-overwrite replace package files with src files'
@echo 'make package-diff (pd) diff src files against package files'
@echo ''
@echo 'make lib-package download/build/install a package library'
@echo 'make lib-package help for download/build/install a package library'
@echo 'make lib-package args="..." download/build/install a package library'
@echo 'make purge purge obsolete copies of source files'
@echo ''
@echo 'make machine build LAMMPS for machine'