From 135b1650f11ce982577086135580d4b5ed32c4b9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 7 Aug 2017 17:13:01 -0400 Subject: [PATCH 1/9] revamp of library builds - remove cross compiler stuff - make use of Install.py consistent - provide options for Makefile.serial and Makefile.mpi that match those in src --- lib/.gitignore | 1 + lib/Install.py | 24 ++++++--- lib/awpmd/Makefile.mpi | 71 ++++++++++++++++++++++++++ lib/awpmd/Makefile.mpicc | 8 +-- lib/awpmd/Makefile.serial | 71 ++++++++++++++++++++++++++ lib/colvars/Install.py | 10 ++-- lib/colvars/Makefile.lammps | 5 -- lib/colvars/Makefile.mingw32-cross | 31 ----------- lib/colvars/Makefile.mingw32-cross-mpi | 13 ----- lib/colvars/Makefile.mingw64-cross | 31 ----------- lib/colvars/Makefile.mingw64-cross-mpi | 13 ----- lib/colvars/Makefile.mpi | 25 +++++++++ lib/colvars/Makefile.serial | 25 +++++++++ lib/h5md/Makefile.h5cc | 11 ++-- lib/linalg/Install.py | 58 --------------------- lib/linalg/Makefile.gfortran | 8 ++- lib/linalg/Makefile.mingw32-cross | 67 ------------------------ lib/linalg/Makefile.mingw32-cross-mpi | 13 ----- lib/linalg/Makefile.mingw64-cross | 67 ------------------------ lib/linalg/Makefile.mingw64-cross-mpi | 13 ----- lib/linalg/Makefile.serial | 1 + 21 files changed, 231 insertions(+), 335 deletions(-) create mode 100644 lib/awpmd/Makefile.mpi create mode 100644 lib/awpmd/Makefile.serial delete mode 100644 lib/colvars/Makefile.lammps delete mode 100644 lib/colvars/Makefile.mingw32-cross delete mode 100644 lib/colvars/Makefile.mingw32-cross-mpi delete mode 100644 lib/colvars/Makefile.mingw64-cross delete mode 100644 lib/colvars/Makefile.mingw64-cross-mpi create mode 100644 lib/colvars/Makefile.mpi create mode 100644 lib/colvars/Makefile.serial delete mode 100644 lib/linalg/Install.py delete mode 100644 lib/linalg/Makefile.mingw32-cross delete mode 100644 lib/linalg/Makefile.mingw32-cross-mpi delete mode 100644 lib/linalg/Makefile.mingw64-cross delete mode 100644 lib/linalg/Makefile.mingw64-cross-mpi create mode 120000 lib/linalg/Makefile.serial diff --git a/lib/.gitignore b/lib/.gitignore index cbeae7705e..4f9ebba6a5 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,2 +1,3 @@ Makefile.lammps .depend +Makefile.auto diff --git a/lib/Install.py b/lib/Install.py index 6b90254336..416a2319c6 100644 --- a/lib/Install.py +++ b/lib/Install.py @@ -70,23 +70,31 @@ if not os.path.exists("Makefile.%s" % machine): lines = open("Makefile.%s" % machine,'r').readlines() fp = open("Makefile.auto",'w') +has_extramake = False for line in lines: words = line.split() - if len(words) == 3 and extraflag and \ - words[0] == "EXTRAMAKE" and words[1] == '=': - line = line.replace(words[2],"Makefile.lammps.%s" % suffix) - print >>fp,line, + if len(words) == 3 and words[0] == "EXTRAMAKE" and words[1] == '=': + has_extramake = True + if extraflag: + line = line.replace(words[2],"Makefile.lammps.%s" % suffix) + fp.write(line) fp.close() -# make the library via Makefile.auto +# make the library via Makefile.auto optionally with parallel make + +try: + import multiprocessing + n_cpus = multiprocessing.cpu_count() +except: + n_cpus = 1 print("Building lib%s.a ..." % lib) -cmd = "make -f Makefile.auto clean; make -f Makefile.auto" +cmd = "make -f Makefile.auto clean; make -f Makefile.auto -j%d" % n_cpus txt = subprocess.check_output(cmd,shell=True,stderr=subprocess.STDOUT) -print(txt) +print(txt.decode('UTF-8')) if os.path.exists("lib%s.a" % lib): print("Build was successful") else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib)) -if not os.path.exists("Makefile.lammps"): +if has_extramake and not os.path.exists("Makefile.lammps"): print("lib/%s/Makefile.lammps was NOT created" % lib) diff --git a/lib/awpmd/Makefile.mpi b/lib/awpmd/Makefile.mpi new file mode 100644 index 0000000000..e4b424e776 --- /dev/null +++ b/lib/awpmd/Makefile.mpi @@ -0,0 +1,71 @@ +SHELL = /bin/sh + +# which file will be copied to Makefile.lammps + +EXTRAMAKE = Makefile.lammps.linalg + +# ------ FILES ------ + +SRC = \ + ivutils/src/logexc.cpp \ + systems/interact/TCP/wpmd.cpp \ + systems/interact/TCP/wpmd_split.cpp + +INC = \ + cerf.h \ + cerf2.h \ + cerf_octave.h \ + cvector_3.h \ + lapack_inter.h \ + logexc.h \ + pairhash.h \ + refobj.h \ + tcpdefs.h \ + vector_3.h \ + wavepacket.h \ + wpmd.h \ + wpmd_split.h + +# ------ DEFINITIONS ------ + +LIB = libawpmd.a +OBJ = $(SRC:.cpp=.o) + +# ------ SETTINGS ------ + +# include any MPI settings needed for the ATC library to build with +# the same MPI library that LAMMPS is built with + +CC = mpicxx +CCFLAGS = -O3 -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include \ + -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1 + +ARCHIVE = ar +ARCHFLAG = -rc +DEPFLAGS = -M +#LINK = +#LINKFLAGS = +USRLIB = +SYSLIB = + +# ------ MAKE PROCEDURE ------ + +lib: $(OBJ) + $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) + @cp $(EXTRAMAKE) Makefile.lammps + +# ------ COMPILE RULES ------ + +%.o:%.cpp + $(CC) $(CCFLAGS) -c $< -o $@ +%.d:%.cpp + $(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@ + +# ------ DEPENDENCIES ------ + +DEPENDS = $(OBJ:.o=.d) + +# ------ CLEAN ------ + +clean: + -rm -f *.d *~ $(OBJ) $(LIB) diff --git a/lib/awpmd/Makefile.mpicc b/lib/awpmd/Makefile.mpicc index 4c289ad88a..5cf6a75bd7 100644 --- a/lib/awpmd/Makefile.mpicc +++ b/lib/awpmd/Makefile.mpicc @@ -36,8 +36,10 @@ OBJ = $(SRC:.cpp=.o) # include any MPI settings needed for the ATC library to build with # the same MPI library that LAMMPS is built with -CC = mpic++ -CCFLAGS = -O -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include +CC = mpicxx +CCFLAGS = -O3 -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include \ + -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1 + ARCHIVE = ar ARCHFLAG = -rc DEPFLAGS = -M @@ -66,4 +68,4 @@ DEPENDS = $(OBJ:.o=.d) # ------ CLEAN ------ clean: - -rm *.d *~ $(OBJ) $(LIB) + -rm -f *.d *~ $(OBJ) $(LIB) diff --git a/lib/awpmd/Makefile.serial b/lib/awpmd/Makefile.serial new file mode 100644 index 0000000000..f51714fc9a --- /dev/null +++ b/lib/awpmd/Makefile.serial @@ -0,0 +1,71 @@ +SHELL = /bin/sh + +# which file will be copied to Makefile.lammps + +EXTRAMAKE = Makefile.lammps.linalg + +# ------ FILES ------ + +SRC = \ + ivutils/src/logexc.cpp \ + systems/interact/TCP/wpmd.cpp \ + systems/interact/TCP/wpmd_split.cpp + +INC = \ + cerf.h \ + cerf2.h \ + cerf_octave.h \ + cvector_3.h \ + lapack_inter.h \ + logexc.h \ + pairhash.h \ + refobj.h \ + tcpdefs.h \ + vector_3.h \ + wavepacket.h \ + wpmd.h \ + wpmd_split.h + +# ------ DEFINITIONS ------ + +LIB = libawpmd.a +OBJ = $(SRC:.cpp=.o) + +# ------ SETTINGS ------ + +# include any MPI settings needed for the ATC library to build with +# the same MPI library that LAMMPS is built with + +CC = g++ +CCFLAGS = -O3 -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include \ + -I../../src/STUBS + +ARCHIVE = ar +ARCHFLAG = -rc +DEPFLAGS = -M +#LINK = +#LINKFLAGS = +USRLIB = +SYSLIB = + +# ------ MAKE PROCEDURE ------ + +lib: $(OBJ) + $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) + @cp $(EXTRAMAKE) Makefile.lammps + +# ------ COMPILE RULES ------ + +%.o:%.cpp + $(CC) $(CCFLAGS) -c $< -o $@ +%.d:%.cpp + $(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@ + +# ------ DEPENDENCIES ------ + +DEPENDS = $(OBJ:.o=.d) + +# ------ CLEAN ------ + +clean: + -rm -f *.d *~ $(OBJ) $(LIB) diff --git a/lib/colvars/Install.py b/lib/colvars/Install.py index 2fc207710c..01e70543f2 100644 --- a/lib/colvars/Install.py +++ b/lib/colvars/Install.py @@ -13,7 +13,7 @@ Syntax from lib/colvars dir: python Install.py -m machine -e suffix specify -m and optionally -e, order does not matter - -m = peform a clean followed by "make -f Makefile.machine" + -m = delete all existing objects, followed by "make -f Makefile.machine" machine = suffix of a lib/colvars/Makefile.* or of a src/MAKE/MACHINES/Makefile.* file -e = set EXTRAMAKE variable in Makefile.machine to Makefile.lammps.suffix @@ -21,7 +21,7 @@ specify -m and optionally -e, order does not matter Examples: -make lib-colvars args="-m g++" # build COLVARS lib with GNU g++ compiler +make lib-colvars args="-m mpi" # build COLVARS lib with default mpi compiler wrapper """ # print error message or help @@ -122,7 +122,7 @@ for line in lines: fp.write(line) fp.close() -# make the library via Makefile.auto +# make the library via Makefile.auto optionally with parallel make try: import multiprocessing @@ -132,9 +132,9 @@ except: print("Building lib%s.a ..." % lib) cmd = ["make -f Makefile.auto clean"] -print(subprocess.check_output(cmd, shell=True).decode()) +print(subprocess.check_output(cmd, shell=True).decode('UTF-8')) cmd = ["make -f Makefile.auto -j%d" % n_cpus] -print(subprocess.check_output(cmd, shell=True).decode()) +print(subprocess.check_output(cmd, shell=True).decode('UTF-8')) if os.path.exists("lib%s.a" % lib): print("Build was successful") else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib)) diff --git a/lib/colvars/Makefile.lammps b/lib/colvars/Makefile.lammps deleted file mode 100644 index 99f57b050b..0000000000 --- a/lib/colvars/Makefile.lammps +++ /dev/null @@ -1,5 +0,0 @@ -# Settings that the LAMMPS build will import when this package library is used - -colvars_SYSINC = -colvars_SYSLIB = -colvars_SYSPATH = diff --git a/lib/colvars/Makefile.mingw32-cross b/lib/colvars/Makefile.mingw32-cross deleted file mode 100644 index 29c64b26a2..0000000000 --- a/lib/colvars/Makefile.mingw32-cross +++ /dev/null @@ -1,31 +0,0 @@ -# -*- makefile -*- to build Colvars module with MinGW 32-bit - -EXTRAMAKE = Makefile.lammps.empty - -COLVARS_LIB = libcolvars.a -COLVARS_OBJ_DIR = Obj_mingw64/ - -CXX = i686-w64-mingw32-g++ -CXXFLAGS = -O2 -march=i686 -mtune=generic -mfpmath=387 -mpc64 \ - -fno-rtti -fno-exceptions -finline-functions \ - -ffast-math -funroll-loops -fstrict-aliasing \ - -Wall -W -Wno-uninitialized -AR = i686-w64-mingw32-ar -ARFLAGS = -rscv -SHELL = /bin/sh - -.PHONY: default clean - -default: $(COLVARS_OBJ_DIR) $(COLVARS_LIB) Makefile.lammps - -include Makefile.common - -$(COLVARS_OBJ_DIR): - mkdir $(COLVARS_OBJ_DIR) - -clean: - -rm -f $(COLVARS_OBJS) $(COLVARS_LIB) - -rmdir $(COLVARS_OBJ_DIR) - -Makefile.lammps: - -cp $(EXTRAMAKE) Makefile.lammps diff --git a/lib/colvars/Makefile.mingw32-cross-mpi b/lib/colvars/Makefile.mingw32-cross-mpi deleted file mode 100644 index 1e35c5b461..0000000000 --- a/lib/colvars/Makefile.mingw32-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw32-cross - -rm -f Obj_mingw32-mpi - ln -s Obj_mingw32 Obj_mingw32-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw32-cross - -rm -f Obj_mingw32-mpi - diff --git a/lib/colvars/Makefile.mingw64-cross b/lib/colvars/Makefile.mingw64-cross deleted file mode 100644 index 2fd1c6fc67..0000000000 --- a/lib/colvars/Makefile.mingw64-cross +++ /dev/null @@ -1,31 +0,0 @@ -# -*- makefile -*- to build Colvars module with MinGW 32-bit - -EXTRAMAKE = Makefile.lammps.empty - -COLVARS_LIB = libcolvars.a -COLVARS_OBJ_DIR = Obj_mingw32/ - -CXX = x86_64-w64-mingw32-g++ -CXXFLAGS = -O2 -march=core2 -mtune=core2 -mpc64 -msse2 \ - -fno-rtti -fno-exceptions -finline-functions \ - -ffast-math -funroll-loops -fstrict-aliasing \ - -Wall -W -Wno-uninitialized -AR = x86_64-w64-mingw32-ar -ARFLAGS = -rscv -SHELL = /bin/sh - -.PHONY: default clean - -default: $(COLVARS_OBJ_DIR) $(COLVARS_LIB) Makefile.lammps - -include Makefile.common - -$(COLVARS_OBJ_DIR): - mkdir $(COLVARS_OBJ_DIR) - -clean: - -rm -f $(COLVARS_OBJS) $(COLVARS_LIB) - -rmdir $(COLVARS_OBJ_DIR) - -Makefile.lammps: - -cp $(EXTRAMAKE) Makefile.lammps diff --git a/lib/colvars/Makefile.mingw64-cross-mpi b/lib/colvars/Makefile.mingw64-cross-mpi deleted file mode 100644 index ca6f4a6d43..0000000000 --- a/lib/colvars/Makefile.mingw64-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw64-cross - -rm -f Obj_mingw64-mpi - ln -s Obj_mingw64 Obj_mingw64-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw64-cross - -rm -f Obj_mingw64-mpi - diff --git a/lib/colvars/Makefile.mpi b/lib/colvars/Makefile.mpi new file mode 100644 index 0000000000..6343ed7c06 --- /dev/null +++ b/lib/colvars/Makefile.mpi @@ -0,0 +1,25 @@ +# -*- makefile -*- to build Colvars module with default MPI compiler wrapper + +EXTRAMAKE = Makefile.lammps.empty + +COLVARS_LIB = libcolvars.a +COLVARS_OBJ_DIR = + +CXX = mpicxx +CXXFLAGS = -O2 -g -Wall -fPIC -funroll-loops +AR = ar +ARFLAGS = -rscv +SHELL = /bin/sh + +.PHONY: default clean + +default: $(COLVARS_LIB) Makefile.lammps + +include Makefile.common + +clean: + -rm -f $(COLVARS_OBJS) $(COLVARS_LIB) + +Makefile.lammps: + -cp $(EXTRAMAKE) Makefile.lammps + diff --git a/lib/colvars/Makefile.serial b/lib/colvars/Makefile.serial new file mode 100644 index 0000000000..556e39d070 --- /dev/null +++ b/lib/colvars/Makefile.serial @@ -0,0 +1,25 @@ +# -*- makefile -*- to build Colvars module with GNU compiler + +EXTRAMAKE = Makefile.lammps.empty + +COLVARS_LIB = libcolvars.a +COLVARS_OBJ_DIR = + +CXX = g++ +CXXFLAGS = -O2 -g -Wall -fPIC -funroll-loops +AR = ar +ARFLAGS = -rscv +SHELL = /bin/sh + +.PHONY: default clean + +default: $(COLVARS_LIB) Makefile.lammps + +include Makefile.common + +clean: + -rm -f $(COLVARS_OBJS) $(COLVARS_LIB) + +Makefile.lammps: + -cp $(EXTRAMAKE) Makefile.lammps + diff --git a/lib/h5md/Makefile.h5cc b/lib/h5md/Makefile.h5cc index bd3e8a9784..9feed2d74e 100644 --- a/lib/h5md/Makefile.h5cc +++ b/lib/h5md/Makefile.h5cc @@ -9,12 +9,14 @@ HDF5_PATH=/usr INC=-I include AR=ar ARFLAGS=rc -LIB=libch5md.a +# need to build two libraries to not break compatibility and to support Install.py +LIB=libh5md.a libch5md.a all: lib Makefile.lammps build: mkdir -p build + build/ch5md.o: src/ch5md.c | build $(CC) $(INC) $(CFLAGS) -c $< -o $@ @@ -23,8 +25,11 @@ Makefile.lammps: .PHONY: all lib clean -$(LIB): build/ch5md.o - $(AR) $(ARFLAGS) $(LIB) build/ch5md.o +libch5md.a : build/ch5md.o + $(AR) $(ARFLAGS) $@ build/ch5md.o + +libh5md.a : build/ch5md.o + $(AR) $(ARFLAGS) $@ build/ch5md.o lib: $(LIB) diff --git a/lib/linalg/Install.py b/lib/linalg/Install.py deleted file mode 100644 index 560afecec4..0000000000 --- a/lib/linalg/Install.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# install.py tool to do build of the linear algebra library -# used to automate the steps described in the README file in this dir - -import sys,commands,os - -# help message - -help = """ -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 - -def error(str=None): - if not str: print help - else: print "ERROR",str - sys.exit() - -# parse args - -args = sys.argv[1:] -nargs = len(args) -if nargs == 0: error() - -machine = None - -iarg = 0 -while iarg < nargs: - if args[iarg] == "-m": - if iarg+2 > nargs: error() - machine = args[iarg+1] - iarg += 2 - else: error() - -# set lib from working dir - -cwd = os.getcwd() -lib = os.path.basename(cwd) - -# make the library - -print "Building lib%s.a ..." % lib -cmd = "make -f Makefile.%s clean; make -f Makefile.%s" % (machine,machine) -txt = commands.getoutput(cmd) -print txt - -if os.path.exists("lib%s.a" % lib): print "Build was successful" -else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib)) diff --git a/lib/linalg/Makefile.gfortran b/lib/linalg/Makefile.gfortran index 89b7f2d7a0..7e1d97a5bc 100644 --- a/lib/linalg/Makefile.gfortran +++ b/lib/linalg/Makefile.gfortran @@ -18,10 +18,8 @@ OBJ = $(SRC:.f=.o) # ------ SETTINGS ------ FC = gfortran -FFLAGS = -O3 -fPIC -march=native -mpc64 \ - -ffast-math -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -fno-second-underscore -FFLAGS0 = -O0 -fPIC -march=native -mpc64 \ - -Wall -W -Wno-uninitialized -fno-second-underscore +FFLAGS = -O3 -fPIC -ffast-math -fstrict-aliasing -fno-second-underscore +FFLAGS0 = -O0 -fPIC -fno-second-underscore ARCHIVE = ar AR = ar ARCHFLAG = -rcs @@ -47,7 +45,7 @@ dlamch.o: dlamch.f # ------ CLEAN ------ clean: - -rm *.o *.mod *~ $(LIB) + -rm -f *.o *.mod *~ $(LIB) tar: -tar -czvf ../linalg.tar.gz $(FILES) diff --git a/lib/linalg/Makefile.mingw32-cross b/lib/linalg/Makefile.mingw32-cross deleted file mode 100644 index 02aa3f71a3..0000000000 --- a/lib/linalg/Makefile.mingw32-cross +++ /dev/null @@ -1,67 +0,0 @@ -# -*- makefile -*- -# *_________________________________________________________________________* -# * Minimal BLAS/LAPACK Library for use by other LAMMPS packages - -SHELL = /bin/sh - -# ------ FILES ------ - -SRC = $(wildcard *.f) - -FILES = $(SRC) Makefile.* README - -# ------ DEFINITIONS ------ - -DIR = Obj_mingw32/ -LIB = $(DIR)liblinalg.a -OBJ = $(SRC:%.f=$(DIR)%.o) - -# ------ SETTINGS ------ - -FC = i686-w64-mingw32-gfortran -FFLAGS = -O3 -march=i686 -mtune=generic -mfpmath=387 -mpc64 \ - -ffast-math -funroll-loops -fstrict-aliasing -Wall -W \ - -Wno-uninitialized -fno-second-underscore -FFLAGS0 = -O0 -march=i686 -mtune=generic -mfpmath=387 -mpc64 \ - -Wall -W -Wno-uninitialized -fno-second-underscore -ARCHIVE = i686-w64-mingw32-ar -AR = i686-w64-mingw32-ar -ARCHFLAG = -rcs -USRLIB = -SYSLIB = - -.PHONY: default clean tar - -.SUFFIXES: -.SUFFIXES: .F .f .o - -# ------ MAKE PROCEDURE ------ - -default: $(DIR) $(LIB) - -$(LIB): $(OBJ) - $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) - -$(DIR): - mkdir $(DIR) - -# ------ COMPILE RULES ------ - -$(DIR)%.o:%.F - $(F90) $(F90FLAGS) -c $< -o $@ - -$(DIR)%.o:%.f - $(FC) $(FFLAGS) -c $< -o $@ - -$(DIR)dlamch.o: dlamch.f - $(FC) $(FFLAGS0) -c $< -o $@ - -# ------ CLEAN ------ - -clean: - -rm $(DIR)*.o $(DIR)*.mod *~ $(LIB) - -rmdir $(DIR) - -tar: - -tar -czvf ../linalg.tar.gz $(FILES) - diff --git a/lib/linalg/Makefile.mingw32-cross-mpi b/lib/linalg/Makefile.mingw32-cross-mpi deleted file mode 100644 index 1e35c5b461..0000000000 --- a/lib/linalg/Makefile.mingw32-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw32-cross - -rm -f Obj_mingw32-mpi - ln -s Obj_mingw32 Obj_mingw32-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw32-cross - -rm -f Obj_mingw32-mpi - diff --git a/lib/linalg/Makefile.mingw64-cross b/lib/linalg/Makefile.mingw64-cross deleted file mode 100644 index ee6eef819b..0000000000 --- a/lib/linalg/Makefile.mingw64-cross +++ /dev/null @@ -1,67 +0,0 @@ -# -*- makefile -*- -# *_________________________________________________________________________* -# * Minimal BLAS/LAPACK Library for use by other LAMMPS packages - -SHELL = /bin/sh - -# ------ FILES ------ - -SRC = $(wildcard *.f) - -FILES = $(SRC) Makefile.* README - -# ------ DEFINITIONS ------ - -DIR = Obj_mingw64/ -LIB = $(DIR)liblinalg.a -OBJ = $(SRC:%.f=$(DIR)%.o) - -# ------ SETTINGS ------ - -FC = x86_64-w64-mingw32-gfortran -FFLAGS = -O3 -march=core2 -mtune=generic -msse2 -mpc64 \ - -ffast-math -funroll-loops -fstrict-aliasing -Wall -W \ - -Wno-uninitialized -fno-second-underscore -FFLAGS0 = -O0 -march=core2 -mtune=generic -msse2 -mpc64 \ - -Wall -W -Wno-uninitialized -fno-second-underscore -ARCHIVE = x86_64-w64-mingw32-ar -AR = x86_64-w64-mingw32-ar -ARCHFLAG = -rcs -USRLIB = -SYSLIB = - -.PHONY: default clean tar - -.SUFFIXES: -.SUFFIXES: .F .f .o - -# ------ MAKE PROCEDURE ------ - -default: $(DIR) $(LIB) - -$(LIB): $(OBJ) - $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) - -$(DIR): - mkdir $(DIR) - -# ------ COMPILE RULES ------ - -$(DIR)%.o:%.F - $(F90) $(F90FLAGS) -c $< -o $@ - -$(DIR)%.o:%.f - $(FC) $(FFLAGS) -c $< -o $@ - -$(DIR)dlamch.o: dlamch.f - $(FC) $(FFLAGS0) -c $< -o $@ - -# ------ CLEAN ------ - -clean: - -rm $(DIR)*.o $(DIR)*.mod *~ $(LIB) - -rmdir $(DIR) - -tar: - -tar -czvf ../linalg.tar.gz $(FILES) - diff --git a/lib/linalg/Makefile.mingw64-cross-mpi b/lib/linalg/Makefile.mingw64-cross-mpi deleted file mode 100644 index ca6f4a6d43..0000000000 --- a/lib/linalg/Makefile.mingw64-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw64-cross - -rm -f Obj_mingw64-mpi - ln -s Obj_mingw64 Obj_mingw64-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw64-cross - -rm -f Obj_mingw64-mpi - diff --git a/lib/linalg/Makefile.serial b/lib/linalg/Makefile.serial new file mode 120000 index 0000000000..c52fbcb986 --- /dev/null +++ b/lib/linalg/Makefile.serial @@ -0,0 +1 @@ +Makefile.gfortran \ No newline at end of file From 8bba29d91e1187572197ad67742d610a292222af Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 7 Aug 2017 17:21:45 -0400 Subject: [PATCH 2/9] more lib installation cleanup --- lib/linalg/Install.py | 1 + lib/linalg/Makefile.mpi | 52 ++++++++++++++ lib/meam/Makefile.lammps.empty | 5 ++ lib/meam/Makefile.mingw32-cross | 69 ------------------- lib/meam/Makefile.mingw32-cross-mpi | 13 ---- lib/meam/Makefile.mingw64-cross-mpi | 13 ---- .../{Makefile.mingw64-cross => Makefile.mpi} | 40 +++++------ lib/meam/Makefile.serial | 1 + 8 files changed, 75 insertions(+), 119 deletions(-) create mode 120000 lib/linalg/Install.py create mode 100644 lib/linalg/Makefile.mpi create mode 100644 lib/meam/Makefile.lammps.empty delete mode 100644 lib/meam/Makefile.mingw32-cross delete mode 100644 lib/meam/Makefile.mingw32-cross-mpi delete mode 100644 lib/meam/Makefile.mingw64-cross-mpi rename lib/meam/{Makefile.mingw64-cross => Makefile.mpi} (63%) create mode 120000 lib/meam/Makefile.serial diff --git a/lib/linalg/Install.py b/lib/linalg/Install.py new file mode 120000 index 0000000000..ffe709d44c --- /dev/null +++ b/lib/linalg/Install.py @@ -0,0 +1 @@ +../Install.py \ No newline at end of file diff --git a/lib/linalg/Makefile.mpi b/lib/linalg/Makefile.mpi new file mode 100644 index 0000000000..dd22ff134c --- /dev/null +++ b/lib/linalg/Makefile.mpi @@ -0,0 +1,52 @@ +# -*- makefile -*- +# *_________________________________________________________________________* +# * Minimal BLAS/LAPACK Library for use by other LAMMPS packages + +SHELL = /bin/sh + +# ------ FILES ------ + +SRC = $(wildcard *.f) + +FILES = $(SRC) Makefile.* README + +# ------ DEFINITIONS ------ + +LIB = liblinalg.a +OBJ = $(SRC:.f=.o) + +# ------ SETTINGS ------ + +FC = mpifort +FFLAGS = -O3 -fPIC +FFLAGS0 = -O0 -fPIC +ARCHIVE = ar +AR = ar +ARCHFLAG = -rcs +USRLIB = +SYSLIB = + +# ------ MAKE PROCEDURE ------ + +lib: $(OBJ) + $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) + +# ------ COMPILE RULES ------ + +%.o:%.F + $(F90) $(F90FLAGS) -c $< + +%.o:%.f + $(FC) $(FFLAGS) -c $< + +dlamch.o: dlamch.f + $(FC) $(FFLAGS0) -c $< + +# ------ CLEAN ------ + +clean: + -rm -f *.o *.mod *~ $(LIB) + +tar: + -tar -czvf ../linalg.tar.gz $(FILES) + diff --git a/lib/meam/Makefile.lammps.empty b/lib/meam/Makefile.lammps.empty new file mode 100644 index 0000000000..10394b68ad --- /dev/null +++ b/lib/meam/Makefile.lammps.empty @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +meam_SYSINC = +meam_SYSLIB = +meam_SYSPATH = diff --git a/lib/meam/Makefile.mingw32-cross b/lib/meam/Makefile.mingw32-cross deleted file mode 100644 index d4d2dad093..0000000000 --- a/lib/meam/Makefile.mingw32-cross +++ /dev/null @@ -1,69 +0,0 @@ -# * -*- makefile -*- -# *_________________________________________________________________________* -# * MEAM: MODEFIED EMBEDDED ATOM METHOD * -# * DESCRIPTION: SEE READ-ME * -# * FILE NAME: Makefile * -# * AUTHORS: Greg Wagner, Sandia National Laboratories * -# * CONTACT: gjwagne@sandia.gov * -# *_________________________________________________________________________*/ - -SHELL = /bin/sh - -# which file will be copied to Makefile.lammps - -EXTRAMAKE = Makefile.lammps.gfortran - -# ------ FILES ------ - -SRC = meam_data.F meam_setup_done.F meam_setup_global.F meam_setup_param.F meam_dens_init.F meam_dens_final.F meam_force.F meam_cleanup.F - -FILES = $(SRC) Makefile - -# ------ DEFINITIONS ------ - -DIR = Obj_mingw32/ -LIB = $(DIR)libmeam.a -OBJ = $(SRC:%.F=$(DIR)%.o) $(DIR)fm_exp.o - -# ------ SETTINGS ------ - -F90 = i686-w64-mingw32-gfortran -F90FLAGS = -O3 -march=i686 -mtune=generic -mfpmath=387 -mpc64 \ - -ffast-math -funroll-loops -fstrict-aliasing -J$(DIR) \ - -Wall -W -Wno-uninitialized -fno-second-underscore -#F90FLAGS = -O -ARCHIVE = i686-w64-mingw32-ar -ARCHFLAG = -rcs -LINK = i686-w64-mingw32-g++ -LINKFLAGS = -O -USRLIB = -SYSLIB = - -# ------ MAKE PROCEDURE ------ - -default: $(DIR) $(LIB) - -$(DIR): - -mkdir $(DIR) - -$(LIB): $(OBJ) - $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) - @cp $(EXTRAMAKE) Makefile.lammps - -# ------ COMPILE RULES ------ - -$(DIR)%.o:%.F - $(F90) $(F90FLAGS) -c $< -o $@ - -$(DIR)%.o:%.c - $(F90) $(F90FLAGS) -c $< -o $@ - -include .depend -# ------ CLEAN ------ - -clean: - -rm $(DIR)*.o $(DIR)*.mod *~ $(LIB) - -rmdir $(DIR) - -tar: - -tar -cvf ../MEAM.tar $(FILES) diff --git a/lib/meam/Makefile.mingw32-cross-mpi b/lib/meam/Makefile.mingw32-cross-mpi deleted file mode 100644 index 1e35c5b461..0000000000 --- a/lib/meam/Makefile.mingw32-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw32-cross - -rm -f Obj_mingw32-mpi - ln -s Obj_mingw32 Obj_mingw32-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw32-cross - -rm -f Obj_mingw32-mpi - diff --git a/lib/meam/Makefile.mingw64-cross-mpi b/lib/meam/Makefile.mingw64-cross-mpi deleted file mode 100644 index ca6f4a6d43..0000000000 --- a/lib/meam/Makefile.mingw64-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw64-cross - -rm -f Obj_mingw64-mpi - ln -s Obj_mingw64 Obj_mingw64-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw64-cross - -rm -f Obj_mingw64-mpi - diff --git a/lib/meam/Makefile.mingw64-cross b/lib/meam/Makefile.mpi similarity index 63% rename from lib/meam/Makefile.mingw64-cross rename to lib/meam/Makefile.mpi index 1a8e97febe..fd3dbde555 100644 --- a/lib/meam/Makefile.mingw64-cross +++ b/lib/meam/Makefile.mpi @@ -1,4 +1,4 @@ -# * -*- makefile -*- +# * # *_________________________________________________________________________* # * MEAM: MODEFIED EMBEDDED ATOM METHOD * # * DESCRIPTION: SEE READ-ME * @@ -11,7 +11,7 @@ SHELL = /bin/sh # which file will be copied to Makefile.lammps -EXTRAMAKE = Makefile.lammps.gfortran +EXTRAMAKE = Makefile.lammps.empty # ------ FILES ------ @@ -21,49 +21,41 @@ FILES = $(SRC) Makefile # ------ DEFINITIONS ------ -DIR = Obj_mingw64/ -LIB = $(DIR)libmeam.a -OBJ = $(SRC:%.F=$(DIR)%.o) $(DIR)fm_exp.o +LIB = libmeam.a +OBJ = $(SRC:.F=.o) fm_exp.o # ------ SETTINGS ------ -F90 = x86_64-w64-mingw32-gfortran -F90FLAGS = -O3 -march=core2 -mtune=core2 -msse2 -mpc64 \ - -ffast-math -funroll-loops -fstrict-aliasing -J$(DIR) \ - -Wall -W -Wno-uninitialized -fno-second-underscore +F90 = mpifort +CC = mpicc +F90FLAGS = -O3 -fPIC #F90FLAGS = -O -ARCHIVE = x86_64-w64-mingw32-ar -ARCHFLAG = -rcs -LINK = x86_64-w64-mingw32-g++ +ARCHIVE = ar +ARCHFLAG = -rc +LINK = mpicxx LINKFLAGS = -O USRLIB = SYSLIB = # ------ MAKE PROCEDURE ------ -default: $(DIR) $(LIB) - -$(DIR): - -mkdir $(DIR) - -$(LIB): $(OBJ) +lib: $(OBJ) $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) @cp $(EXTRAMAKE) Makefile.lammps # ------ COMPILE RULES ------ -$(DIR)%.o:%.F - $(F90) $(F90FLAGS) -c $< -o $@ +%.o:%.F + $(F90) $(F90FLAGS) -c $< -$(DIR)%.o:%.c - $(F90) $(F90FLAGS) -c $< -o $@ +%.o:%.c + $(CC) $(F90FLAGS) -c $< include .depend # ------ CLEAN ------ clean: - -rm $(DIR)*.o $(DIR)*.mod *~ $(LIB) - -rmdir $(DIR) + -rm *.o *.mod *~ $(LIB) tar: -tar -cvf ../MEAM.tar $(FILES) diff --git a/lib/meam/Makefile.serial b/lib/meam/Makefile.serial new file mode 120000 index 0000000000..c52fbcb986 --- /dev/null +++ b/lib/meam/Makefile.serial @@ -0,0 +1 @@ +Makefile.gfortran \ No newline at end of file From b3244f9c98070fef77106b47df7bfc4f257e848a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Aug 2017 07:20:33 -0400 Subject: [PATCH 3/9] more lib compilation updates --- lib/kim/Install.py | 34 ++--- lib/mscg/.gitignore | 4 + lib/mscg/Install.py | 138 +++++++++--------- lib/poems/Makefile.g++ | 2 +- lib/poems/Makefile.mingw32-cross | 110 -------------- lib/poems/Makefile.mingw32-cross-mpi | 13 -- lib/poems/Makefile.mingw64-cross-mpi | 13 -- .../{Makefile.mingw64-cross => Makefile.mpi} | 31 ++-- lib/poems/Makefile.serial | 1 + lib/qmmm/Makefile.mpi | 66 +++++++++ lib/qmmm/Makefile.serial | 66 +++++++++ lib/reax/Makefile.gfortran | 2 +- lib/reax/Makefile.lammps.empty | 5 + lib/reax/Makefile.mpi | 51 +++++++ lib/reax/Makefile.serial | 1 + lib/smd/Install.py | 4 +- lib/smd/Makefile.lammps | 2 +- lib/voronoi/Install.py | 19 ++- 18 files changed, 312 insertions(+), 250 deletions(-) create mode 100644 lib/mscg/.gitignore delete mode 100644 lib/poems/Makefile.mingw32-cross delete mode 100644 lib/poems/Makefile.mingw32-cross-mpi delete mode 100644 lib/poems/Makefile.mingw64-cross-mpi rename lib/poems/{Makefile.mingw64-cross => Makefile.mpi} (86%) create mode 120000 lib/poems/Makefile.serial create mode 100644 lib/qmmm/Makefile.mpi create mode 100644 lib/qmmm/Makefile.serial create mode 100644 lib/reax/Makefile.lammps.empty create mode 100644 lib/reax/Makefile.mpi create mode 120000 lib/reax/Makefile.serial diff --git a/lib/kim/Install.py b/lib/kim/Install.py index 315bb4e11c..f7ddcfda96 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -12,7 +12,7 @@ try: except: from urllib import urlretrieve as geturl except: def geturl(url,fname): - cmd = "curl -o %s %s" % (fname,url) + cmd = 'curl -L -o "%s" %s' % (fname,url) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) return txt @@ -139,7 +139,7 @@ if buildflag: if os.path.isdir(kimdir): print("kim-api is already installed at %s.\nRemoving it for re-install" % kimdir) - cmd = "rm -rf %s" % kimdir + cmd = 'rm -rf "%s"' % kimdir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # configure LAMMPS to use kim-api to be installed @@ -160,48 +160,48 @@ if buildflag: 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) + cmd = 'cd "%s"; rm -rf "%s"; tar -xzvf %s.tgz' % (thisdir,version,version) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # configure kim-api print("Configuring kim-api ...") - cmd = "cd %s/%s; ./configure --prefix='%s'" % (thisdir,version,kimdir) + cmd = 'cd "%s/%s"; ./configure --prefix="%s"' % (thisdir,version,kimdir) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # build kim-api print("Configuring example Models") - cmd = "cd %s/%s; make add-examples" % (thisdir,version) + cmd = 'cd "%s/%s"; make add-examples' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print (txt.decode("UTF-8")) if everythingflag: print("Configuring all OpenKIM models, this will take a while ...") - cmd = "cd %s/%s; make add-OpenKIM" % (thisdir,version) + cmd = 'cd "%s/%s"; make add-OpenKIM' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) print("Building kim-api ...") - cmd = "cd %s/%s; make" % (thisdir,version) + cmd = 'cd "%s/%s"; make' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) # install kim-api print("Installing kim-api ...") - cmd = "cd %s/%s; make install" % (thisdir,version) + cmd = 'cd "%s/%s"; make install' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) - cmd = "cd %s/%s; make install-set-default-to-v1" %(thisdir,version) + cmd = 'cd "%s/%s"; make install-set-default-to-v1' %(thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) # remove source files print("Removing kim-api source and build files ...") - cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" % (thisdir,version,version) + cmd = 'cd "%s"; rm -rf %s; rm -rf %s.tgz' % (thisdir,version,version) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # add a single model (and possibly its driver) to existing KIM installation @@ -219,11 +219,11 @@ if addflag: geturl(url,"%s/%s.tgz" % (thisdir,addmodelname)) print("Unpacking item tarball ...") - cmd = "cd %s; tar zxvf %s.tgz" % (thisdir,addmodelname) + cmd = 'cd "%s"; tar -xzvf %s.tgz' % (thisdir,addmodelname) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) print("Building item ...") - cmd = "cd %s/%s; make; make install" %(thisdir,addmodelname) + cmd = 'cd "%s/%s"; make; make install' %(thisdir,addmodelname) try: txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) except subprocess.CalledProcessError as e: @@ -231,18 +231,18 @@ if addflag: # Error: but first, check to see if it needs a driver firstRunOutput = e.output.decode("UTF-8") - cmd = "cd %s/%s; make kim-item-type" % (thisdir,addmodelname) + cmd = 'cd "%s/%s"; make kim-item-type' % (thisdir,addmodelname) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) txt = txt.decode("UTF-8") if txt == "ParameterizedModel": # Get and install driver - cmd = "cd %s/%s; make model-driver-name" % (thisdir,addmodelname) + cmd = 'cd "%s/%s"; make model-driver-name' % (thisdir,addmodelname) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) adddrivername = txt.decode("UTF-8").strip() print("First installing model driver: %s..." % adddrivername) - cmd = "cd %s; python Install.py -n -a %s" % (thisdir,adddrivername) + cmd = 'cd "%s"; python Install.py -n -a %s' % (thisdir,adddrivername) try: txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) except subprocess.CalledProcessError as e: @@ -254,7 +254,7 @@ if addflag: # now install the model that needed the driver print("Now installing model : %s" % addmodelname) - cmd = "cd %s; python Install.py -n -a %s" % (thisdir,addmodelname) + cmd = 'cd "%s"; python Install.py -n -a %s' % (thisdir,addmodelname) try: txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) except subprocess.CalledProcessError as e: @@ -272,5 +272,5 @@ if addflag: if verboseflag: print(txt.decode("UTF-8")) print("Removing kim item source and build files ...") - cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" %(thisdir,addmodelname,addmodelname) + cmd = 'cd "%s"; rm -rf %s; rm -rf %s.tgz' %(thisdir,addmodelname,addmodelname) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) diff --git a/lib/mscg/.gitignore b/lib/mscg/.gitignore new file mode 100644 index 0000000000..7d45bcb60a --- /dev/null +++ b/lib/mscg/.gitignore @@ -0,0 +1,4 @@ +# files to ignore +/liblink +/includelink +/MSCG-release-master diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index 7b10be189f..db86b0a7a6 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -3,127 +3,133 @@ # Install.py tool to download, unpack, build, and link to the MS-CG library # used to automate the steps described in the README file in this dir -import sys,os,re,commands +from __future__ import print_function +import sys,os,re,subprocess + +try: + import ssl + try: from urllib.request import urlretrieve as geturl + except: from urllib import urlretrieve as geturl +except: + def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt # help message help = """ -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 +Syntax from src dir: make lib-mscg args="-p [path] -m [suffix]" +Syntax from lib dir: python Install.py -p [path] -m [suffix] 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 - default hdir = MSCG-release-master = what GitHub zipfile unpacks to - -g = grab (download) zipfile from MS-CG GitHub website - unpack it to hpath/hdir - hpath must already exist - if hdir already exists, it will be deleted before unpack - -b = build MS-CG library in its src dir - optional suffix specifies which src/Make/Makefile.suffix to use + -b = download and build MS-CG library (default) + -p = specify folder of existing MS-CG installation + -m = machine 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 +make lib-mscg args="-b " # download/build in lib/mscg/MSCG-release-master """ # settings -url = "https://github.com/uchicago-voth/MSCG-release/archive/master.zip" -zipfile = "MS-CG-master.zip" -zipdir = "MSCG-release-master" +url = "http://github.com/uchicago-voth/MSCG-release/archive/master.tar.gz" +tarfile = "MS-CG-master.tar.gz" +tardir = "MSCG-release-master" # 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 # process leading '~' or relative path - + def fullpath(path): return os.path.abspath(os.path.expanduser(path)) - + # parse args args = sys.argv[1:] nargs = len(args) -if nargs == 0: error() homepath = "." -homedir = zipdir +homedir = tardir -grabflag = 0 -buildflag = 0 +buildflag = True +pathflag = False +linkflag = True msuffix = "g++_simple" -linkflag = 0 iarg = 0 while iarg < nargs: - if args[iarg] == "-h": - if iarg+3 > nargs: error() - homepath = args[iarg+1] - homedir = args[iarg+2] - iarg += 3 - elif args[iarg] == "-g": - grabflag = 1 - iarg += 1 + if args[iarg] == "-p": + if iarg+2 > nargs: error() + mscgpath = fullpath(args[iarg+1]) + pathflag = True + buildflag = False + iarg += 2 + elif args[iarg] == "-m": + if iarg+2 > nargs: error() + msuffix = args[iarg+1] + iarg += 2 elif args[iarg] == "-b": - buildflag = 1 - if iarg+1 < nargs and args[iarg+1][0] != '-': - msuffix = args[iarg+1] - iarg += 1 - iarg += 1 - elif args[iarg] == "-l": - linkflag = 1 + buildflag = True iarg += 1 else: error() homepath = fullpath(homepath) -if not os.path.isdir(homepath): error("MS-CG path does not exist") homedir = "%s/%s" % (homepath,homedir) -# download and unpack MS-CG zipfile +if (pathflag): + if not os.path.isdir(mscgpath): error("MS-CG path does not exist") + homedir = mscgpath -if grabflag: - print "Downloading MS-CG ..." - cmd = "curl -L %s > %s/%s" % (url,homepath,zipfile) - print cmd - print commands.getoutput(cmd) +if (buildflag and pathflag): + error("Cannot use -b and -p flag at the same time") - print "Unpacking MS-CG zipfile ..." - if os.path.exists("%s/%s" % (homepath,zipdir)): - commands.getoutput("rm -rf %s/%s" % (homepath,zipdir)) - cmd = "cd %s; unzip %s" % (homepath,zipfile) - commands.getoutput(cmd) - if os.path.basename(homedir) != zipdir: - if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir) - os.rename("%s/%s" % (homepath,zipdir),homedir) +# download and unpack MS-CG tarfile + +if buildflag: + print("Downloading MS-CG ...") + geturl(url,"%s/%s" % (homepath,tarfile)) + + print("Unpacking MS-CG tarfile ...") + if os.path.exists("%s/%s" % (homepath,tardir)): + cmd = 'rm -rf "%s/%s"' % (homepath,tardir) + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarfile) + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + os.remove("%s/%s" % (homepath,tarfile)) + if os.path.basename(homedir) != tardir: + if os.path.exists(homedir): + cmd = 'rm -rf "%s"' % homedir + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + os.rename("%s/%s" % (homepath,tardir),homedir) # build MS-CG if buildflag: - print "Building MS-CG ..." - cmd = "cd %s/src; cp Make/Makefile.%s .; make -f Makefile.%s" % \ + print("Building MS-CG ...") + cmd = 'cd "%s/src"; cp Make/Makefile.%s .; make -f Makefile.%s' % \ (homedir,msuffix,msuffix) - txt = commands.getoutput(cmd) - print txt + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + print(txt.decode('UTF-8')) # create 2 links in lib/mscg to MS-CG src dir if linkflag: - print "Creating links to MS-CG include and lib files" + print("Creating links to MS-CG 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 + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + cmd = 'ln -s "%s/src" liblink' % homedir + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) diff --git a/lib/poems/Makefile.g++ b/lib/poems/Makefile.g++ index 54c897a22c..afcbc4a01d 100644 --- a/lib/poems/Makefile.g++ +++ b/lib/poems/Makefile.g++ @@ -68,7 +68,7 @@ OBJ = $(SRC:.cpp=.o) # ------ SETTINGS ------ CC = g++ -CCFLAGS = -O -g -fPIC -Wall #-Wno-deprecated +CCFLAGS = -O3 -g -fPIC -Wall #-Wno-deprecated ARCHIVE = ar ARCHFLAG = -rc DEPFLAGS = -M diff --git a/lib/poems/Makefile.mingw32-cross b/lib/poems/Makefile.mingw32-cross deleted file mode 100644 index 17e81b51f0..0000000000 --- a/lib/poems/Makefile.mingw32-cross +++ /dev/null @@ -1,110 +0,0 @@ -# * -# *_________________________________________________________________________* -# * POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE * -# * DESCRIPTION: SEE READ-ME * -# * FILE NAME: Makefile * -# * AUTHORS: See Author List * -# * GRANTS: See Grants List * -# * COPYRIGHT: (C) 2005 by Authors as listed in Author's List * -# * LICENSE: Please see License Agreement * -# * DOWNLOAD: Free at www.rpi.edu/~anderk5 * -# * ADMINISTRATOR: Prof. Kurt Anderson * -# * Computational Dynamics Lab * -# * Rensselaer Polytechnic Institute * -# * 110 8th St. Troy NY 12180 * -# * CONTACT: anderk5@rpi.edu * -# *_________________________________________________________________________*/ - -SHELL = /bin/sh - -# which file will be copied to Makefile.lammps - -EXTRAMAKE = Makefile.lammps.empty - -# ------ FILES ------ - -SRC_MAIN = workspace.cpp system.cpp poemsobject.cpp -INC_MAIN = workspace.h system.h poemsobject.h - -SRC_BODY = body.cpp rigidbody.cpp particle.cpp inertialframe.cpp -INC_BODY = bodies.h body.h rigidbody.h particle.h inertialframe.h - - -SRC_JOINT = joint.cpp revolutejoint.cpp prismaticjoint.cpp sphericaljoint.cpp \ - freebodyjoint.cpp body23joint.cpp mixedjoint.cpp -INC_JOINT = joints.h joint.h revolutejoint.h prismaticjoint.h sphericaljoint.h \ - freebodyjoint.h body23joint.h mixedjoint.h - -SRC_POINT = point.cpp fixedpoint.cpp -INC_POINT = points.h point.h fixedpoint.h - -SRC_SOLVE = solver.cpp -INC_SOLVE = solver.h - -SRC_ORDERN = onsolver.cpp onfunctions.cpp onbody.cpp -INC_ORDERN = onsolver.h onfunctions.h onbody.h - -SRC_MAT = virtualmatrix.cpp matrix.cpp matrixfun.cpp mat3x3.cpp virtualcolmatrix.cpp \ - colmatrix.cpp vect3.cpp virtualrowmatrix.cpp rowmatrix.cpp mat6x6.cpp vect6.cpp \ - fastmatrixops.cpp colmatmap.cpp eulerparameters.cpp vect4.cpp norm.cpp mat4x4.cpp \ - -INC_MAT = matrices.h virtualmatrix.h matrix.h matrixfun.h mat3x3.h virtualcolmatrix.h \ - colmatrix.h vect3.h virtualrowmatrix.h rowmatrix.h mat6x6.h vect6.h \ - fastmatrixops.h colmatmap.h eulerparameters.h vect4.h norm.h mat4x4.h - -SRC_MISC = poemstreenode.cpp -INC_MISC = poemslist.h poemstreenode.h poemstree.h poemsnodelib.h SystemProcessor.h defines.h POEMSChain.h - -SRC = $(SRC_MAIN) $(SRC_BODY) $(SRC_JOINT) $(SRC_POINT) $(SRC_SOLVE) $(SRC_ORDERN) $(SRC_MAT) $(SRC_MISC) -INC = $(INC_MAIN) $(INC_BODY) $(INC_JOINT) $(INC_POINT) $(INC_SOLVE) $(INC_ORDERN) $(INC_MAT) $(INC_MISC) - -FILES = $(SRC) $(INC) Makefile Authors_List.txt Grants_List.txt POEMS_License.txt README Copyright_Notice - -# ------ DEFINITIONS ------ - -DIR = Obj_mingw32/ -LIB = $(DIR)libpoems.a -OBJ = $(SRC:%.cpp=$(DIR)%.o) - -# ------ SETTINGS ------ - -CC = i686-w64-mingw32-g++ -CCFLAGS = -O2 -march=i686 -mtune=generic -mfpmath=387 -mpc64 \ - -ffast-math -funroll-loops -finline-functions -fno-rtti \ - -fno-exceptions -fstrict-aliasing \ - -Wall -W -Wno-uninitialized -ARCHIVE = i686-w64-mingw32-ar -ARCHFLAG = -rcs -DEPFLAGS = -M -LINK = i686-w64-mingw32-g++ -LINKFLAGS = -O -USRLIB = -SYSLIB = - -# ------ MAKE PROCEDURE ------ - -default: $(DIR) $(LIB) - -$(DIR): - -mkdir $(DIR) - -$(LIB): $(OBJ) - $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) - @cp $(EXTRAMAKE) Makefile.lammps - -# ------ COMPILE RULES ------ - -$(DIR)%.o:%.cpp - $(CC) $(CCFLAGS) -c $< -o $@ - -# ------ DEPENDENCIES ------ - -include .depend - -# ------ CLEAN ------ - -clean: - -rm $(DIR)*.o $(DIR)*.d *~ $(LIB) - -tar: - -tar -cvf ../POEMS.tar $(FILES) diff --git a/lib/poems/Makefile.mingw32-cross-mpi b/lib/poems/Makefile.mingw32-cross-mpi deleted file mode 100644 index 1e35c5b461..0000000000 --- a/lib/poems/Makefile.mingw32-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw32-cross - -rm -f Obj_mingw32-mpi - ln -s Obj_mingw32 Obj_mingw32-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw32-cross - -rm -f Obj_mingw32-mpi - diff --git a/lib/poems/Makefile.mingw64-cross-mpi b/lib/poems/Makefile.mingw64-cross-mpi deleted file mode 100644 index ca6f4a6d43..0000000000 --- a/lib/poems/Makefile.mingw64-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw64-cross - -rm -f Obj_mingw64-mpi - ln -s Obj_mingw64 Obj_mingw64-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw64-cross - -rm -f Obj_mingw64-mpi - diff --git a/lib/poems/Makefile.mingw64-cross b/lib/poems/Makefile.mpi similarity index 86% rename from lib/poems/Makefile.mingw64-cross rename to lib/poems/Makefile.mpi index 2df43dea94..0f0546419c 100644 --- a/lib/poems/Makefile.mingw64-cross +++ b/lib/poems/Makefile.mpi @@ -62,40 +62,31 @@ FILES = $(SRC) $(INC) Makefile Authors_List.txt Grants_List.txt POEMS_License.tx # ------ DEFINITIONS ------ -DIR = Obj_mingw64/ -LIB = $(DIR)libpoems.a -OBJ = $(SRC:%.cpp=$(DIR)%.o) +LIB = libpoems.a +OBJ = $(SRC:.cpp=.o) # ------ SETTINGS ------ -CC = x86_64-w64-mingw32-g++ -CCFLAGS = -O2 -march=core2 -mtune=core2 -msse2 -mpc64 \ - -ffast-math -funroll-loops -finline-functions -fno-rtti \ - -fno-exceptions -fstrict-aliasing \ - -Wall -W -Wno-uninitialized -ARCHIVE = x86_64-w64-mingw32-ar -ARCHFLAG = -rcs +CC = mpicxx +CCFLAGS = -O3 -g -fPIC -Wall #-Wno-deprecated +ARCHIVE = ar +ARCHFLAG = -rc DEPFLAGS = -M -LINK = x86_64-w64-mingw32-g++ +LINK = mpicxx LINKFLAGS = -O USRLIB = SYSLIB = # ------ MAKE PROCEDURE ------ -default: $(DIR) $(LIB) - -$(DIR): - -mkdir $(DIR) - -$(LIB): $(OBJ) +lib: $(OBJ) $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) @cp $(EXTRAMAKE) Makefile.lammps # ------ COMPILE RULES ------ -$(DIR)%.o:%.cpp - $(CC) $(CCFLAGS) -c $< -o $@ +%.o:%.cpp + $(CC) $(CCFLAGS) -c $< # ------ DEPENDENCIES ------ @@ -104,7 +95,7 @@ include .depend # ------ CLEAN ------ clean: - -rm $(DIR)*.o $(DIR)*.d *~ $(LIB) + -rm *.o *.d *~ $(LIB) tar: -tar -cvf ../POEMS.tar $(FILES) diff --git a/lib/poems/Makefile.serial b/lib/poems/Makefile.serial new file mode 120000 index 0000000000..9d7bb000f9 --- /dev/null +++ b/lib/poems/Makefile.serial @@ -0,0 +1 @@ +Makefile.g++ \ No newline at end of file diff --git a/lib/qmmm/Makefile.mpi b/lib/qmmm/Makefile.mpi new file mode 100644 index 0000000000..590b1047f8 --- /dev/null +++ b/lib/qmmm/Makefile.mpi @@ -0,0 +1,66 @@ +# -*- Makefile -*- for coupling LAMMPS to PWscf for QM/MM molecular dynamics + +# this file will be copied to Makefile.lammps +EXTRAMAKE = Makefile.lammps.empty + +# top level directory of Quantum ESPRESSO 5.4.1 or later +QETOPDIR=$(HOME)/compile/espresso + +# import compiler settings from Quantum ESPRESSO +sinclude $(QETOPDIR)/make.sys + +# FLAGS for c++ OpenMPI 1.8.8 or later when QE was compiled with GNU Fortran 4.x +MPICXX=mpicxx +MPICXXFLAGS= -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -O2 -g -fPIC\ + -I../../src -I$(QETOPDIR)/COUPLE/include +MPILIBS=-fopenmp -lgfortran -ldl -ljpeg -lpng -lz -lmpi_mpifh -lmpi + +# location of required libraries +# part 1: hi-level libraries for building pw.x +PWOBJS = \ +$(QETOPDIR)/COUPLE/src/libqecouple.a \ +$(QETOPDIR)/PW/src/libpw.a \ +$(QETOPDIR)/Modules/libqemod.a +# part 2: lo-level libraries for all of Q-E +LIBOBJS = \ +$(QETOPDIR)/FFTXlib/libqefft.a \ +$(QETOPDIR)/LAXlib/libqela.a \ +$(QETOPDIR)/clib/clib.a \ +$(QETOPDIR)/iotk/src/libiotk.a + +# part 3: add-on libraries and main library for LAMMPS +sinclude ../../src/Makefile.package +LAMMPSCFG = mpi +LAMMPSLIB = ../../src/liblammps_$(LAMMPSCFG).a + +# part 4: local QM/MM library and progams +SRC=pwqmmm.c libqmmm.c +OBJ=$(SRC:%.c=%.o) + + +default: libqmmm.a + +all : tldeps libqmmm.a pwqmmm.x + +pwqmmm.x : pwqmmm.o $(OBJ) $(PWOBJS) $(LIBOBJS) $(LAMMPSLIB) + $(MPICXX) $(LDFLAGS) -o $@ $^ $(PKG_PATH) $(PKG_LIB) $(MPILIBS) $(LIBS) + +libqmmm.a: libqmmm.o + $(AR) $(ARFLAGS) $@ $^ + @cp $(EXTRAMAKE) Makefile.lammps + +%.o: %.c + $(MPICXX) -c $(LAMMPSFLAGS) $(MPICXXFLAGS) $< -o $@ + +tldeps: + ( cd $(QETOPDIR) ; $(MAKE) $(MFLAGS) couple || exit 1) + $(MAKE) -C ../../src $(MFLAGS) $(LAMMPSCFG) + $(MAKE) -C ../../src $(MFLAGS) mode=lib $(LAMMPSCFG) + +clean : + -rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L + +# explicit dependencies + +pwqmmm.o: pwqmmm.c libqmmm.h +libqmmm.o: libqmmm.c libqmmm.h diff --git a/lib/qmmm/Makefile.serial b/lib/qmmm/Makefile.serial new file mode 100644 index 0000000000..f091482792 --- /dev/null +++ b/lib/qmmm/Makefile.serial @@ -0,0 +1,66 @@ +# -*- Makefile -*- for coupling LAMMPS to PWscf for QM/MM molecular dynamics + +# this file will be copied to Makefile.lammps +EXTRAMAKE = Makefile.lammps.empty + +# top level directory of Quantum ESPRESSO 5.4.1 or later +QETOPDIR=$(HOME)/compile/espresso + +# import compiler settings from Quantum ESPRESSO +sinclude $(QETOPDIR)/make.sys + +# FLAGS for GNU c++ with STUBS. non-functional for real coupling +MPICXX=g++ +MPICXXFLAGS= -I../../src/STUBS -O2 -g -fPIC\ + -I../../src -I$(QETOPDIR)/COUPLE/include +MPILIBS=-fopenmp -lgfortran -ldl -ljpeg -lpng -lz -lmpi_mpifh -lmpi + +# location of required libraries +# part 1: hi-level libraries for building pw.x +PWOBJS = \ +$(QETOPDIR)/COUPLE/src/libqecouple.a \ +$(QETOPDIR)/PW/src/libpw.a \ +$(QETOPDIR)/Modules/libqemod.a +# part 2: lo-level libraries for all of Q-E +LIBOBJS = \ +$(QETOPDIR)/FFTXlib/libqefft.a \ +$(QETOPDIR)/LAXlib/libqela.a \ +$(QETOPDIR)/clib/clib.a \ +$(QETOPDIR)/iotk/src/libiotk.a + +# part 3: add-on libraries and main library for LAMMPS +sinclude ../../src/Makefile.package +LAMMPSCFG = mpi +LAMMPSLIB = ../../src/liblammps_$(LAMMPSCFG).a + +# part 4: local QM/MM library and progams +SRC=pwqmmm.c libqmmm.c +OBJ=$(SRC:%.c=%.o) + + +default: libqmmm.a + +all : tldeps libqmmm.a pwqmmm.x + +pwqmmm.x : pwqmmm.o $(OBJ) $(PWOBJS) $(LIBOBJS) $(LAMMPSLIB) + $(MPICXX) $(LDFLAGS) -o $@ $^ $(PKG_PATH) $(PKG_LIB) $(MPILIBS) $(LIBS) + +libqmmm.a: libqmmm.o + $(AR) $(ARFLAGS) $@ $^ + @cp $(EXTRAMAKE) Makefile.lammps + +%.o: %.c + $(MPICXX) -c $(LAMMPSFLAGS) $(MPICXXFLAGS) $< -o $@ + +tldeps: + ( cd $(QETOPDIR) ; $(MAKE) $(MFLAGS) couple || exit 1) + $(MAKE) -C ../../src $(MFLAGS) $(LAMMPSCFG) + $(MAKE) -C ../../src $(MFLAGS) mode=lib $(LAMMPSCFG) + +clean : + -rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L + +# explicit dependencies + +pwqmmm.o: pwqmmm.c libqmmm.h +libqmmm.o: libqmmm.c libqmmm.h diff --git a/lib/reax/Makefile.gfortran b/lib/reax/Makefile.gfortran index b2b16fcc57..ab42301688 100644 --- a/lib/reax/Makefile.gfortran +++ b/lib/reax/Makefile.gfortran @@ -28,7 +28,7 @@ OBJ = $(SRC:.F=.o) # ------ SETTINGS ------ F90 = gfortran -F90FLAGS = -O -fPIC -fno-second-underscore +F90FLAGS = -O3 -fPIC -fno-second-underscore ARCHIVE = ar ARCHFLAG = -rc USRLIB = diff --git a/lib/reax/Makefile.lammps.empty b/lib/reax/Makefile.lammps.empty new file mode 100644 index 0000000000..758755f3c8 --- /dev/null +++ b/lib/reax/Makefile.lammps.empty @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +reax_SYSINC = +reax_SYSLIB = +reax_SYSPATH = diff --git a/lib/reax/Makefile.mpi b/lib/reax/Makefile.mpi new file mode 100644 index 0000000000..142f7e9bc6 --- /dev/null +++ b/lib/reax/Makefile.mpi @@ -0,0 +1,51 @@ +# * +# *_________________________________________________________________________* +# * Fortran Library for Reactive Force Field * +# * DESCRIPTION: SEE READ-ME * +# * FILE NAME: Makefile * +# * CONTRIBUTING AUTHORS: Hansohl Cho(MIT), Aidan Thompson(SNL) * +# * and Greg Wagner(SNL) * +# * CONTACT: hansohl@mit.edu, athompson@sandia.gov, gjwagne@sandia.gov * +# *_________________________________________________________________________*/ + +SHELL = /bin/sh + +# which file will be copied to Makefile.lammps + +EXTRAMAKE = Makefile.lammps.empty + +# ------ FILES ------ + +SRC = reax_connect.F reax_inout.F reax_lammps.F reax_poten.F reax_reac.F reax_charges.F + +HEADERFILES = reax_defs.h *.blk + +# ------ DEFINITIONS ------ + +LIB = libreax.a +OBJ = $(SRC:.F=.o) + +# ------ SETTINGS ------ + +F90 = mpifort +F90FLAGS = -O3 -fPIC +ARCHIVE = ar +ARCHFLAG = -rc +USRLIB = +SYSLIB = + +# ------ MAKE PROCEDURE ------ + +lib: $(OBJ) + $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) + @cp $(EXTRAMAKE) Makefile.lammps + +# ------ COMPILE RULES ------ + +%.o:%.F $(HEADERFILES) + $(F90) $(F90FLAGS) -c $< + +# ------ CLEAN ------ + +clean: + -rm *.o $(LIB) diff --git a/lib/reax/Makefile.serial b/lib/reax/Makefile.serial new file mode 120000 index 0000000000..c52fbcb986 --- /dev/null +++ b/lib/reax/Makefile.serial @@ -0,0 +1 @@ +Makefile.gfortran \ No newline at end of file diff --git a/lib/smd/Install.py b/lib/smd/Install.py index 337f993be5..fe02835639 100644 --- a/lib/smd/Install.py +++ b/lib/smd/Install.py @@ -98,7 +98,7 @@ if buildflag: edir = glob.glob("%s/eigen-eigen-*" % homepath) for one in edir: if os.path.isdir(one): - subprocess.check_output("rm -rf %s" % one,stderr=subprocess.STDOUT,shell=True) + subprocess.check_output('rm -rf "%s"' % one,stderr=subprocess.STDOUT,shell=True) cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarball) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) edir = glob.glob("%s/eigen-eigen-*" % homepath) @@ -113,5 +113,5 @@ if linkflag: os.remove("includelink") if pathflag: linkdir = eigenpath else: linkdir = "%s/%s" % (homepath,homedir) - cmd = "ln -s %s includelink" % linkdir + cmd = 'ln -s "%s" includelink' % linkdir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) diff --git a/lib/smd/Makefile.lammps b/lib/smd/Makefile.lammps index 7bbf3924ef..6951a1394c 100644 --- a/lib/smd/Makefile.lammps +++ b/lib/smd/Makefile.lammps @@ -1,5 +1,5 @@ # Settings that the LAMMPS build will import when this package library is used -user-smd_SYSINC = +user-smd_SYSINC = -I../../lib/includelink/eigen3 user-smd_SYSLIB = user-smd_SYSPATH = diff --git a/lib/voronoi/Install.py b/lib/voronoi/Install.py index 17bba5e8eb..6db0495a37 100644 --- a/lib/voronoi/Install.py +++ b/lib/voronoi/Install.py @@ -5,8 +5,16 @@ 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 + +try: + import ssl + try: from urllib.request import urlretrieve as geturl + except: from urllib import urlretrieve as geturl +except: + def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt # help message @@ -55,7 +63,6 @@ nargs = len(args) homepath = "." homedir = version -grabflag = True buildflag = True pathflag = False linkflag = True @@ -89,7 +96,7 @@ if (buildflag and pathflag): # download and unpack Voro++ tarball -if grabflag: +if buildflag: print("Downloading Voro++ ...") geturl(url,"%s/%s.tar.gz" % (homepath,version)) @@ -122,7 +129,7 @@ if linkflag: os.remove("includelink") if os.path.isfile("liblink") or os.path.islink("liblink"): os.remove("liblink") - cmd = ['ln -s "%s/src" includelink' % homedir, 'includelink'] + cmd = 'ln -s "%s/src" includelink' % homedir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - cmd = ['ln -s "%s/src" liblink' % homedir] + cmd = 'ln -s "%s/src" liblink' % homedir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) From d2b0c287d26ed910c5737ecb8cb9c972a3fabee8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Aug 2017 13:19:44 -0400 Subject: [PATCH 4/9] add local makefile overrides to be compatible with standard suffixes --- lib/mscg/Install.py | 18 ++- lib/mscg/Makefile.lammps.default | 5 + ...file.lammps => Makefile.lammps.g++_simple} | 0 lib/mscg/Makefile.lammps.mpi | 5 + lib/mscg/Makefile.lammps.serial | 5 + lib/mscg/Makefile.mpi | 104 ++++++++++++++++++ lib/mscg/Makefile.serial | 104 ++++++++++++++++++ 7 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 lib/mscg/Makefile.lammps.default rename lib/mscg/{Makefile.lammps => Makefile.lammps.g++_simple} (100%) create mode 100644 lib/mscg/Makefile.lammps.mpi create mode 100644 lib/mscg/Makefile.lammps.serial create mode 100644 lib/mscg/Makefile.mpi create mode 100644 lib/mscg/Makefile.serial diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index db86b0a7a6..70d2eda241 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -116,10 +116,24 @@ if buildflag: if buildflag: print("Building MS-CG ...") - cmd = 'cd "%s/src"; cp Make/Makefile.%s .; make -f Makefile.%s' % \ - (homedir,msuffix,msuffix) + if os.path.exists("%s/src/Make/Makefile.%s" % (homedir,msuffix)): + cmd = 'cd "%s/src"; cp Make/Makefile.%s .; make -f Makefile.%s' % \ + (homedir,msuffix,msuffix) + elif os.path.exists("Makefile.%s" % msuffix): + cmd = 'cd "%s/src"; cp ../../Makefile.%s .; make -f Makefile.%s' % \ + (homedir,msuffix,msuffix) + else: + error("Cannot find Makefile.%s" % msuffix) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) print(txt.decode('UTF-8')) + if not os.path.exists("Makefile.lammps"): + print("Creating Makefile.lammps") + if os.path.exists("Makefile.lammps.%s" % msuffix): + cmd = 'cp Makefile.lammps.%s Makefile.lammps' % msuffix + else: + cmd = 'cp Makefile.lammps.default Makefile.lammps' + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + else: print("Makefile.lammps exists. Please check its settings") # create 2 links in lib/mscg to MS-CG src dir diff --git a/lib/mscg/Makefile.lammps.default b/lib/mscg/Makefile.lammps.default new file mode 100644 index 0000000000..7f04ff2eac --- /dev/null +++ b/lib/mscg/Makefile.lammps.default @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +mscg_SYSINC = +mscg_SYSLIB = -lgsl -lgslcblas +mscg_SYSPATH = diff --git a/lib/mscg/Makefile.lammps b/lib/mscg/Makefile.lammps.g++_simple similarity index 100% rename from lib/mscg/Makefile.lammps rename to lib/mscg/Makefile.lammps.g++_simple diff --git a/lib/mscg/Makefile.lammps.mpi b/lib/mscg/Makefile.lammps.mpi new file mode 100644 index 0000000000..7f04ff2eac --- /dev/null +++ b/lib/mscg/Makefile.lammps.mpi @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +mscg_SYSINC = +mscg_SYSLIB = -lgsl -lgslcblas +mscg_SYSPATH = diff --git a/lib/mscg/Makefile.lammps.serial b/lib/mscg/Makefile.lammps.serial new file mode 100644 index 0000000000..7f04ff2eac --- /dev/null +++ b/lib/mscg/Makefile.lammps.serial @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +mscg_SYSINC = +mscg_SYSLIB = -lgsl -lgslcblas +mscg_SYSPATH = diff --git a/lib/mscg/Makefile.mpi b/lib/mscg/Makefile.mpi new file mode 100644 index 0000000000..d5088176b4 --- /dev/null +++ b/lib/mscg/Makefile.mpi @@ -0,0 +1,104 @@ +# This Makefile is meant for use after +# module load gsl/2.2.1+gcc-6.1 +# module load gcc/6.1 +# It also requires LAPACK +# Module names refer to those on any of RCC's clusters at UChicago. + +# This makefile does NOT include GROMACS reading or MKL (sparse matrix) +# It uses the gcc/g++ compiler (v4.9+) for C++11 support + +# 1) Try this first (as it is the easiest) +NO_GRO_LIBS = -lgsl -lgslcblas + +# 2) If it does not find your libraries automatically, you can specify them manually +# # A) Set the GSL_LIB to the location of your GSL library's lib directory (must be V2+) +GSL_LIB = /software/gsl-2.2.1-el6-x86_64+gcc-6.1/lib +# # B) Set the LAPACK_DIR to the location of your LAPACK library base directory +LAPACK_LIB = $(HOME)/local/lapack-3.7.0 +# # C) Uncomment this next line and then run again (after cleaning up any object files) +#NO_GRO_LIBS = -L$(GSL_LIB) -L$(LAPACK_LIB) -lgsl -lgslcblas -llapack -lm + +OPT = -O2 +NO_GRO_LDFLAGS = $(OPT) +NO_GRO_CFLAGS = $(OPT) +DIMENSION = 3 +CC = mpicc + +COMMON_SOURCE = control_input.h fm_output.h force_computation.h geometry.h interaction_hashing.h interaction_model.h matrix.h splines.h topology.h trajectory_input.h misc.h mscg.h +NO_GRO_COMMON_OBJECTS = control_input.o fm_output.o force_computation.o geometry.o interaction_hashing.o interaction_model.o matrix.o splines.o topology.o trajectory_input_no_gro.o misc.o + +# Target executables +# The library for LAMMPS is lib_mscg.a +libmscg.a: mscg.o $(NO_GRO_COMMON_OBJECTS) + ar rvs libmscg.a *.o + +newfm_no_gro.x: newfm.o $(NO_GRO_COMMON_OBJECTS) + $(CC) $(NO_GRO_LDFLAGS) -o $@ newfm.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS) + +combinefm_no_gro.x: combinefm.o batch_fm_combination.o $(NO_GRO_COMMON_OBJECTS) + $(CC) $(NO_GRO_LDFLAGS) -o $@ combinefm.o batch_fm_combination.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS) + +rangefinder_no_gro.x: rangefinder.o range_finding.o $(NO_GRO_COMMON_OBJECTS) + $(CC) $(NO_GRO_LDFLAGS) -o $@ rangefinder.o range_finding.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS) + +# Target objects + +mscg.o: mscg.cpp $(COMMON_SOURCE) range_finding.o + $(CC) $(NO_GRO_CFLAGS) -c mscg.cpp -o mscg.o $(NO_GRO_LIBS) + +newfm.o: newfm.cpp $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c newfm.cpp + +combinefm.o: combinefm.cpp batch_fm_combination.h $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c combinefm.cpp + +rangefinder.o: rangefinder.cpp range_finding.h $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c rangefinder.cpp + +scalarfm.o: scalarfm.cpp $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c scalarfm.cpp + +batch_fm_combination.o: batch_fm_combination.cpp batch_fm_combination.h external_matrix_routines.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c batch_fm_combination.cpp + +control_input.o: control_input.cpp control_input.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c control_input.cpp + +geometry.o: geometry.cpp geometry.h + $(CC) $(NO_GRO_CFLAGS) -c geometry.cpp -DDIMENSION=$(DIMENSION) + +fm_output.o: fm_output.cpp fm_output.h force_computation.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c fm_output.cpp + +force_computation.o: force_computation.cpp force_computation.h interaction_model.h matrix.h trajectory_input.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c force_computation.cpp -DDIMENSION=$(DIMENSION) + +interaction_hashing.o: interaction_hashing.cpp interaction_hashing.h + $(CC) $(NO_GRO_CFLAGS) -c interaction_hashing.cpp + +interaction_model.o: interaction_model.cpp interaction_model.h control_input.h interaction_hashing.h topology.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c interaction_model.cpp -DDIMENSION=$(DIMENSION) + +matrix.o: matrix.cpp matrix.h control_input.h external_matrix_routines.h interaction_model.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c matrix.cpp -DDIMENSION=$(DIMENSION) + +misc.o: misc.cpp misc.h + $(CC) $(NO_GRO_CFLAGS) -c misc.cpp + +range_finding.o: range_finding.cpp range_finding.h force_computation.h interaction_model.h matrix.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c range_finding.cpp -DDIMENSION=$(DIMENSION) + +splines.o: splines.cpp splines.h interaction_model.h + $(CC) $(NO_GRO_CFLAGS) -c splines.cpp -DDIMENSION=$(DIMENSION) + +topology.o: topology.cpp topology.h interaction_model.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c topology.cpp -DDIMENSION=$(DIMENSION) + +trajectory_input_no_gro.o: trajectory_input.cpp trajectory_input.h control_input.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c trajectory_input.cpp -D"_exclude_gromacs=1" -o trajectory_input_no_gro.o + +# Other convenient commands +clean: + rm *.[o] + +all: libmscg.a newfm_no_gro.x rangefinder_no_gro.x combinefm_no_gro.x diff --git a/lib/mscg/Makefile.serial b/lib/mscg/Makefile.serial new file mode 100644 index 0000000000..4e34706f01 --- /dev/null +++ b/lib/mscg/Makefile.serial @@ -0,0 +1,104 @@ +# This Makefile is meant for use after +# module load gsl/2.2.1+gcc-6.1 +# module load gcc/6.1 +# It also requires LAPACK +# Module names refer to those on any of RCC's clusters at UChicago. + +# This makefile does NOT include GROMACS reading or MKL (sparse matrix) +# It uses the gcc/g++ compiler (v4.9+) for C++11 support + +# 1) Try this first (as it is the easiest) +NO_GRO_LIBS = -lgsl -lgslcblas + +# 2) If it does not find your libraries automatically, you can specify them manually +# # A) Set the GSL_LIB to the location of your GSL library's lib directory (must be V2+) +GSL_LIB = /software/gsl-2.2.1-el6-x86_64+gcc-6.1/lib +# # B) Set the LAPACK_DIR to the location of your LAPACK library base directory +LAPACK_LIB = $(HOME)/local/lapack-3.7.0 +# # C) Uncomment this next line and then run again (after cleaning up any object files) +#NO_GRO_LIBS = -L$(GSL_LIB) -L$(LAPACK_LIB) -lgsl -lgslcblas -llapack -lm + +OPT = -O2 +NO_GRO_LDFLAGS = $(OPT) +NO_GRO_CFLAGS = $(OPT) +DIMENSION = 3 +CC = g++ + +COMMON_SOURCE = control_input.h fm_output.h force_computation.h geometry.h interaction_hashing.h interaction_model.h matrix.h splines.h topology.h trajectory_input.h misc.h mscg.h +NO_GRO_COMMON_OBJECTS = control_input.o fm_output.o force_computation.o geometry.o interaction_hashing.o interaction_model.o matrix.o splines.o topology.o trajectory_input_no_gro.o misc.o + +# Target executables +# The library for LAMMPS is lib_mscg.a +libmscg.a: mscg.o $(NO_GRO_COMMON_OBJECTS) + ar rvs libmscg.a *.o + +newfm_no_gro.x: newfm.o $(NO_GRO_COMMON_OBJECTS) + $(CC) $(NO_GRO_LDFLAGS) -o $@ newfm.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS) + +combinefm_no_gro.x: combinefm.o batch_fm_combination.o $(NO_GRO_COMMON_OBJECTS) + $(CC) $(NO_GRO_LDFLAGS) -o $@ combinefm.o batch_fm_combination.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS) + +rangefinder_no_gro.x: rangefinder.o range_finding.o $(NO_GRO_COMMON_OBJECTS) + $(CC) $(NO_GRO_LDFLAGS) -o $@ rangefinder.o range_finding.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS) + +# Target objects + +mscg.o: mscg.cpp $(COMMON_SOURCE) range_finding.o + $(CC) $(NO_GRO_CFLAGS) -c mscg.cpp -o mscg.o $(NO_GRO_LIBS) + +newfm.o: newfm.cpp $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c newfm.cpp + +combinefm.o: combinefm.cpp batch_fm_combination.h $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c combinefm.cpp + +rangefinder.o: rangefinder.cpp range_finding.h $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c rangefinder.cpp + +scalarfm.o: scalarfm.cpp $(COMMON_SOURCE) + $(CC) $(NO_GRO_CFLAGS) -c scalarfm.cpp + +batch_fm_combination.o: batch_fm_combination.cpp batch_fm_combination.h external_matrix_routines.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c batch_fm_combination.cpp + +control_input.o: control_input.cpp control_input.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c control_input.cpp + +geometry.o: geometry.cpp geometry.h + $(CC) $(NO_GRO_CFLAGS) -c geometry.cpp -DDIMENSION=$(DIMENSION) + +fm_output.o: fm_output.cpp fm_output.h force_computation.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c fm_output.cpp + +force_computation.o: force_computation.cpp force_computation.h interaction_model.h matrix.h trajectory_input.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c force_computation.cpp -DDIMENSION=$(DIMENSION) + +interaction_hashing.o: interaction_hashing.cpp interaction_hashing.h + $(CC) $(NO_GRO_CFLAGS) -c interaction_hashing.cpp + +interaction_model.o: interaction_model.cpp interaction_model.h control_input.h interaction_hashing.h topology.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c interaction_model.cpp -DDIMENSION=$(DIMENSION) + +matrix.o: matrix.cpp matrix.h control_input.h external_matrix_routines.h interaction_model.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c matrix.cpp -DDIMENSION=$(DIMENSION) + +misc.o: misc.cpp misc.h + $(CC) $(NO_GRO_CFLAGS) -c misc.cpp + +range_finding.o: range_finding.cpp range_finding.h force_computation.h interaction_model.h matrix.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c range_finding.cpp -DDIMENSION=$(DIMENSION) + +splines.o: splines.cpp splines.h interaction_model.h + $(CC) $(NO_GRO_CFLAGS) -c splines.cpp -DDIMENSION=$(DIMENSION) + +topology.o: topology.cpp topology.h interaction_model.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c topology.cpp -DDIMENSION=$(DIMENSION) + +trajectory_input_no_gro.o: trajectory_input.cpp trajectory_input.h control_input.h misc.h + $(CC) $(NO_GRO_CFLAGS) -c trajectory_input.cpp -D"_exclude_gromacs=1" -o trajectory_input_no_gro.o + +# Other convenient commands +clean: + rm *.[o] + +all: libmscg.a newfm_no_gro.x rangefinder_no_gro.x combinefm_no_gro.x From b7b62f6893c25c8cecdfb8a0d56cc5fa35a3ac45 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Aug 2017 13:20:25 -0400 Subject: [PATCH 5/9] do not pollute global namespace by including mscg header in fix header --- src/MSCG/fix_mscg.cpp | 1 + src/MSCG/fix_mscg.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MSCG/fix_mscg.cpp b/src/MSCG/fix_mscg.cpp index b5bfa926a1..fba198c814 100644 --- a/src/MSCG/fix_mscg.cpp +++ b/src/MSCG/fix_mscg.cpp @@ -19,6 +19,7 @@ #include #include #include "fix_mscg.h" +#include "mscg.h" #include "atom.h" #include "domain.h" #include "error.h" diff --git a/src/MSCG/fix_mscg.h b/src/MSCG/fix_mscg.h index f6dcf4f0f6..2c235d436a 100644 --- a/src/MSCG/fix_mscg.h +++ b/src/MSCG/fix_mscg.h @@ -21,7 +21,6 @@ FixStyle(mscg,FixMSCG) #define LMP_FIX_MSCG_H #include "fix.h" -#include "mscg.h" namespace LAMMPS_NS { From c53a84a967c0976dcab2067a134ecaf0fbc93fc6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Aug 2017 13:55:12 -0400 Subject: [PATCH 6/9] update README file for lib/mscg --- lib/mscg/README | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/mscg/README b/lib/mscg/README index b73c8563cd..329eebba96 100755 --- a/lib/mscg/README +++ b/lib/mscg/README @@ -6,12 +6,11 @@ The MS-CG library is available at https://github.com/uchicago-voth/MSCG-release and was developed by Jacob Wagner in Greg Voth's group at the University of Chicago. -This library requires a compiler with C++11 support (e.g., g++ v4.9+), -LAPACK, and the GNU scientific library (GSL v 2.1+). +This library requires a the GNU scientific library (GSL v 2.1+). You can type "make lib-mscg" 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 +the same thing by typing "python Install.py -m " from within this directory, or you can do it manually by following the instructions below. @@ -21,17 +20,17 @@ You must perform the following steps yourself. 1. Download MS-CG at https://github.com/uchicago-voth/MSCG-release either as a tarball or via SVN, and unpack the tarball either in - this /lib/mscg directory or somewhere else on your system. + this lib/mscg directory or somewhere else on your system. + +2. Ensure that you have GSL installed and a compiler with support for C++11. -2. Ensure that you have LAPACK and GSL (or Intel MKL) as well as a compiler - with support for C++11. - 3. Compile MS-CG from within its home directory using your makefile of choice: - % make -f Makefile."name" libmscg.a - It is recommended that you start with Makefile.g++_simple - for most machines + % make -f Makefile. libmscg.a + It is recommended that you start with Makefile.g++_simple for + most machines. There are also two Makefile with settings matching + the "mpi" and "serial" makefiles in the main LAMMPS folder. -4. There is no need to install MS-CG if you only wish +4. There is no need to install MS-CG system-wide if you only wish to use it from LAMMPS. 5. Create two soft links in this dir (lib/mscg) to the MS-CG src @@ -43,6 +42,9 @@ You must perform the following steps yourself. % ln -s /usr/local/include includelink % ln -s /usr/local/lib liblink +6. Copy a suitable Makefile.lammps. to Makefile.lammps or + copy Makefile.lammps.default to Makefile.lammps and edit as needed. + ----------------- When these steps are complete you can build LAMMPS with the MS-CG From 30431d4edb77a52f7c2c46d8dfde95888242c0f8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Aug 2017 16:57:27 -0400 Subject: [PATCH 7/9] rework Install.py for gpu library. make it consistent with other lib folders and support python3 --- lib/gpu/.gitignore | 10 +++--- lib/gpu/Install.py | 58 ++++++++++++++++-------------- lib/gpu/Makefile.linux | 2 +- lib/gpu/Makefile.mingw32-cross | 17 --------- lib/gpu/Makefile.mingw32-cross-mpi | 19 ---------- lib/gpu/Makefile.mingw64-cross | 18 ---------- lib/gpu/Makefile.mingw64-cross-mpi | 20 ----------- lib/gpu/Makefile.mpi | 1 + lib/gpu/Makefile.serial | 33 ++++++++++++----- 9 files changed, 64 insertions(+), 114 deletions(-) delete mode 100644 lib/gpu/Makefile.mingw32-cross delete mode 100644 lib/gpu/Makefile.mingw32-cross-mpi delete mode 100644 lib/gpu/Makefile.mingw64-cross delete mode 100644 lib/gpu/Makefile.mingw64-cross-mpi create mode 120000 lib/gpu/Makefile.mpi diff --git a/lib/gpu/.gitignore b/lib/gpu/.gitignore index 228a9f7731..9ad6046a09 100644 --- a/lib/gpu/.gitignore +++ b/lib/gpu/.gitignore @@ -1,4 +1,6 @@ -obj -obj_ocl -ocl_get_devices -nvc_get_devices +/obj +/obj_ocl +/ocl_get_devices +/nvc_get_devices +/*.cubin +/*_cubin.h diff --git a/lib/gpu/Install.py b/lib/gpu/Install.py index c6cd1f3021..657f1c8fcc 100644 --- a/lib/gpu/Install.py +++ b/lib/gpu/Install.py @@ -3,53 +3,57 @@ # Install.py tool to build the GPU library # used to automate the steps described in the README file in this dir -import sys,os,re,commands +from __future__ import print_function +import sys,os,subprocess # help message help = """ -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 +Syntax from src dir: make lib-gpu args="-m machine -h hdir -a arch -p precision -e esuffix -m -o osuffix" +Syntax from lib dir: python Install.py -m machine -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 +copies an existing Makefile.machine 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 + -m = use Makefile.machine as starting point, copy to Makefile.auto + default machine = linux -h = set CUDA_HOME variable in Makefile.auto to hdir hdir = path to NVIDIA Cuda software, e.g. /usr/local/cuda -a = set CUDA_ARCH variable in Makefile.auto to arch - use arch = ?? for K40 (Tesla) - use arch = 37 for dual K80 (Tesla) - use arch = 60 for P100 (Pascal) + use arch = 20 for Tesla C2050/C2070 (Fermi) (deprecated as of CUDA 8.0) + or GeForce GTX 580 or similar + use arch = 30 for Tesla K10 (Kepler) + use arch = 35 for Tesla K40 (Kepler) or GeForce GTX Titan or similar + use arch = 37 for Tesla dual K80 (Kepler) + use arch = 60 for Tesla P100 (Pascal) -p = set CUDA_PRECISION variable in Makefile.auto to precision use precision = double or mixed or single -e = set EXTRAMAKE variable in Makefile.auto to Makefile.lammps.esuffix - -m = make the GPU library using Makefile.auto + -b = make the GPU library using Makefile.auto first performs a "make clean" - produces libgpu.a if successful + then produces libgpu.a if successful 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 +make lib-gpu args="-b" # build GPU lib with default Makefile.linux +make lib-gpu args="-m xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision +make lib-gpu args="-m mpi -a 35 -p single -o mpi.mixed -b" # create new Makefile.mpi.mixed, also build GPU lib with these settings """ # 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() # parse args @@ -65,7 +69,7 @@ outflag = 0 iarg = 0 while iarg < nargs: - if args[iarg] == "-i": + if args[iarg] == "-m": if iarg+2 > nargs: error() isuffix = args[iarg+1] iarg += 2 @@ -89,7 +93,7 @@ while iarg < nargs: eflag = 1 lmpsuffix = args[iarg+1] iarg += 2 - elif args[iarg] == "-m": + elif args[iarg] == "-b": makeflag = 1 iarg += 1 elif args[iarg] == "-o": @@ -117,9 +121,9 @@ fp = open("Makefile.auto",'w') for line in lines: words = line.split() if len(words) != 3: - print >>fp,line, + fp.write(line) continue - + if hflag and words[0] == "CUDA_HOME" and words[1] == '=': line = line.replace(words[2],hdir) if aflag and words[0] == "CUDA_ARCH" and words[1] == '=': @@ -128,20 +132,20 @@ for line in lines: line = line.replace(words[2],precstr) if eflag and words[0] == "EXTRAMAKE" and words[1] == '=': line = line.replace(words[2],"Makefile.lammps.%s" % lmpsuffix) - - print >>fp,line, + fp.write(line) fp.close() # perform make # make operations copies EXTRAMAKE file to Makefile.lammps if makeflag: - print "Building libgpu.a ..." + print("Building libgpu.a ...") cmd = "rm -f libgpu.a" - commands.getoutput(cmd) + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) cmd = "make -f Makefile.auto clean; make -f Makefile.auto" - commands.getoutput(cmd) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + print(txt.decode('UTF-8')) if not os.path.exists("libgpu.a"): error("Build of lib/gpu/libgpu.a was NOT successful") if not os.path.exists("Makefile.lammps"): @@ -150,6 +154,6 @@ if makeflag: # copy new Makefile.auto to Makefile.osuffix if outflag: - print "Creating new Makefile.%s" % osuffix + print("Creating new Makefile.%s" % osuffix) cmd = "cp Makefile.auto Makefile.%s" % osuffix - commands.getoutput(cmd) + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) diff --git a/lib/gpu/Makefile.linux b/lib/gpu/Makefile.linux index d72c0ba437..dfcc5bf7d3 100644 --- a/lib/gpu/Makefile.linux +++ b/lib/gpu/Makefile.linux @@ -37,7 +37,7 @@ CUDA_INCLUDE = -I$(CUDA_HOME)/include CUDA_LIB = -L$(CUDA_HOME)/lib64 CUDA_OPTS = -DUNIX -O3 -Xptxas -v --use_fast_math $(LMP_INC) -CUDR_CPP = mpic++ -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1 -fPIC +CUDR_CPP = mpicxx -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1 -fPIC CUDR_OPTS = -O2 $(LMP_INC) # -xHost -no-prec-div -ansi-alias BIN_DIR = ./ diff --git a/lib/gpu/Makefile.mingw32-cross b/lib/gpu/Makefile.mingw32-cross deleted file mode 100644 index 6f77634755..0000000000 --- a/lib/gpu/Makefile.mingw32-cross +++ /dev/null @@ -1,17 +0,0 @@ -CUDA_HOME = ../../tools/mingw-cross/OpenCL - -OCL_CPP = i686-w64-mingw32-g++ -O2 -march=i686 -mtune=generic -mfpmath=387 \ - -mpc64 -DMPI_GERYON -DUCL_NO_EXIT -I../../src/STUBS \ - -I$(CUDA_HOME)/include -OCL_LINK = -static -Wl,--enable-stdcall-fixup -L$(CUDA_HOME)/../Obj_mingw32 -Wl,-Bdynamic,-lOpenCL,-Bstatic -L../../src/STUBS -lmpi_mingw32 -OCL_PREC = -D_SINGLE_DOUBLE -OCL_TUNE = -DFERMI_OCL -EXTRAMAKE = Makefile.lammps.mingw-cross - -BIN_DIR = Obj_mingw32 -OBJ_DIR = Obj_mingw32 -LIB_DIR = Obj_mingw32 -AR = i686-w64-mingw32-ar -BSH = /bin/sh - -include Opencl.makefile diff --git a/lib/gpu/Makefile.mingw32-cross-mpi b/lib/gpu/Makefile.mingw32-cross-mpi deleted file mode 100644 index 94099cd90b..0000000000 --- a/lib/gpu/Makefile.mingw32-cross-mpi +++ /dev/null @@ -1,19 +0,0 @@ -CUDA_HOME = ../../tools/mingw-cross/OpenCL - -OCL_CPP = i686-w64-mingw32-g++ -O2 -march=i686 -mtune=generic -mfpmath=387 \ - -mpc64 -DMPI_GERYON -DUCL_NO_EXIT -I$(CUDA_HOME)/include \ - -I../../tools/mingw-cross/mpich2-win32/include/ \ - -DMPICH_IGNORE_CXX_SEEK -OCL_LINK = -static -Wl,--enable-stdcall-fixup -L$(CUDA_HOME)/../Obj_mingw32 -Wl,-Bdynamic,-lOpenCL,-Bstatic \ - -L../../tools/mingw-cross/mpich2-win32/lib -lmpi -OCL_PREC = -D_SINGLE_DOUBLE -OCL_TUNE = -DFERMI_OCL -EXTRAMAKE = Makefile.lammps.mingw-cross - -BIN_DIR = Obj_mingw32-mpi -OBJ_DIR = Obj_mingw32-mpi -LIB_DIR = Obj_mingw32-mpi -AR = i686-w64-mingw32-ar -BSH = /bin/sh - -include Opencl.makefile diff --git a/lib/gpu/Makefile.mingw64-cross b/lib/gpu/Makefile.mingw64-cross deleted file mode 100644 index 54f6af8c65..0000000000 --- a/lib/gpu/Makefile.mingw64-cross +++ /dev/null @@ -1,18 +0,0 @@ -CUDA_HOME = ../../tools/mingw-cross/OpenCL - -OCL_CPP = x86_64-w64-mingw32-g++ -O3 -march=core2 -mtune=core2 -mpc64 \ - -msse2 -DMPI_GERYON -DUCL_NO_EXIT -I../../src/STUBS \ - -I$(CUDA_HOME)/include -OCL_LINK = -static -Wl,--enable-stdcall-fixup -L$(CUDA_HOME)/../Obj_mingw64 -Wl,-Bdynamic,-lOpenCL,-Bstatic \ - -L../../src/STUBS -lmpi_mingw64 -OCL_PREC = -D_SINGLE_DOUBLE -OCL_TUNE = -DFERMI_OCL -EXTRAMAKE = Makefile.lammps.mingw-cross - -BIN_DIR = Obj_mingw64 -OBJ_DIR = Obj_mingw64 -LIB_DIR = Obj_mingw64 -AR = x86_64-w64-mingw32-ar -BSH = /bin/sh - -include Opencl.makefile diff --git a/lib/gpu/Makefile.mingw64-cross-mpi b/lib/gpu/Makefile.mingw64-cross-mpi deleted file mode 100644 index 2ff72d98b1..0000000000 --- a/lib/gpu/Makefile.mingw64-cross-mpi +++ /dev/null @@ -1,20 +0,0 @@ -CUDA_HOME = ../../tools/mingw-cross/OpenCL - -OCL_CPP = x86_64-w64-mingw32-g++ -O3 -march=core2 -mtune=core2 -mpc64 \ - -msse2 -DMPI_GERYON -DUCL_NO_EXIT -I$(CUDA_HOME)/include \ - -I../../tools/mingw-cross/mpich2-win64/include/ \ - -DMPICH_IGNORE_CXX_SEEK - -OCL_LINK = -static -Wl,--enable-stdcall-fixup -L$(CUDA_HOME)/../Obj_mingw64 -Wl,-Bdynamic,-lOpenCL,-Bstatic \ - -L../../tools/mingw-cross/mpich2-win64/lib -lmpi -OCL_PREC = -D_SINGLE_DOUBLE -OCL_TUNE = -DFERMI_OCL -EXTRAMAKE = Makefile.lammps.mingw-cross - -BIN_DIR = Obj_mingw64-mpi -OBJ_DIR = Obj_mingw64-mpi -LIB_DIR = Obj_mingw64-mpi -AR = x86_64-w64-mingw32-ar -BSH = /bin/sh - -include Opencl.makefile diff --git a/lib/gpu/Makefile.mpi b/lib/gpu/Makefile.mpi new file mode 120000 index 0000000000..8bad27d081 --- /dev/null +++ b/lib/gpu/Makefile.mpi @@ -0,0 +1 @@ +Makefile.linux \ No newline at end of file diff --git a/lib/gpu/Makefile.serial b/lib/gpu/Makefile.serial index 809e99cc94..9348dc565a 100644 --- a/lib/gpu/Makefile.serial +++ b/lib/gpu/Makefile.serial @@ -1,5 +1,5 @@ # /* ---------------------------------------------------------------------- -# Generic Makefile for CUDA using MPI STUBS library +# Generic Linux Makefile for CUDA # - Change CUDA_ARCH for your GPU # ------------------------------------------------------------------------- */ @@ -7,23 +7,38 @@ EXTRAMAKE = Makefile.lammps.standard -CUDA_HOME = $(HOME)/cuda +ifeq ($(CUDA_HOME),) +CUDA_HOME = /usr/local/cuda +endif + NVCC = nvcc # Tesla CUDA -CUDA_ARCH = -arch=sm_20 +CUDA_ARCH = -arch=sm_21 # newer CUDA #CUDA_ARCH = -arch=sm_13 # older CUDA #CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE +CUDA_ARCH = -arch=sm_35 + +# this setting should match LAMMPS Makefile +# one of LAMMPS_SMALLBIG (default), LAMMPS_BIGBIG and LAMMPS_SMALLSMALL + +LMP_INC = -DLAMMPS_SMALLBIG + +# precision for GPU calculations +# -D_SINGLE_SINGLE # Single precision for all calculations +# -D_DOUBLE_DOUBLE # Double precision for all calculations +# -D_SINGLE_DOUBLE # Accumulation of forces, etc. in double CUDA_PRECISION = -D_SINGLE_DOUBLE -CUDA_INCLUDE = -I$(CUDA_HOME)/include -CUDA_LIB = -L$(CUDA_HOME)/lib64 -L../../src/STUBS -lmpi -CUDA_OPTS = -DUNIX -O3 -Xptxas -v --use_fast_math -CUDR_CPP = g++ -DMPI_GERYON -DUCL_NO_EXIT -I../../src/STUBS -CUDR_OPTS = -O2 +CUDA_INCLUDE = -I$(CUDA_HOME)/include +CUDA_LIB = -L$(CUDA_HOME)/lib64 -L../../src/STUBS -lmpi_stubs +CUDA_OPTS = -DUNIX -O3 -Xptxas -v --use_fast_math $(LMP_INC) + +CUDR_CPP = g++ -DMPI_GERYON -DUCL_NO_EXIT -fPIC -I../../src/STUBS +CUDR_OPTS = -O2 $(LMP_INC) # -xHost -no-prec-div -ansi-alias BIN_DIR = ./ OBJ_DIR = ./ @@ -31,5 +46,7 @@ LIB_DIR = ./ AR = ar BSH = /bin/sh +CUDPP_OPT = -DUSE_CUDPP -Icudpp_mini + include Nvidia.makefile From b7b1257b0146f0abeeb8ecfafb3d10eb859611d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Aug 2017 17:00:09 -0400 Subject: [PATCH 8/9] remove attempts to use urllib and use curl for all downloading. restore printing help with no flags. --- lib/Install.py | 5 +++-- lib/kim/Install.py | 48 +++++++++++++++++++++++------------------- lib/mscg/Install.py | 30 ++++++++++++++------------ lib/smd/Install.py | 22 ++++++++++++------- lib/voronoi/Install.py | 35 +++++++++++++++--------------- 5 files changed, 76 insertions(+), 64 deletions(-) diff --git a/lib/Install.py b/lib/Install.py index 416a2319c6..d30cbffcf1 100644 --- a/lib/Install.py +++ b/lib/Install.py @@ -23,8 +23,9 @@ specify -m and optionally -e, order does not matter Examples: -make lib-poems args="-m g++" # build COLVARS lib with GNU g++ compiler -make lib-meam args="-m ifort" # build MEAM lib with Intel ifort compiler +make lib-poems args="-m serial" # build POEMS lib with same settings as in the serial Makefile in src +make lib-colvars args="-m mpi" # build USER-COLVARS lib with same settings as in the mpi Makefile in src +make lib-meam args="-m ifort" # build MEAM lib with custom Makefile.ifort (using Intel Fortran) """ # print error message or help diff --git a/lib/kim/Install.py b/lib/kim/Install.py index f7ddcfda96..06479d2d4d 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -1,44 +1,41 @@ #!/usr/bin/env python -# install.py tool to setup the kim-api library +# install.py tool to download, compile, and setup the kim-api library # used to automate the steps described in the README file in this dir + from __future__ import print_function import sys,os,re,subprocess -# transparently use either urllib or an external tool -try: - import ssl - try: from urllib.request import urlretrieve as geturl - except: from urllib import urlretrieve as geturl -except: - def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt - help = """ -Syntax from src dir: make lib-kim args="-v version -a kim-name" -Syntax from lib dir: python Install.py -v version -a kim-name +Syntax from src dir: make lib-kim args="-b -v version -a kim-name" + or: make lib-kim args="-b -a everything" + or: make lib-kim args="-n -a kim-name" + or: make lib-kim args="-p /usr/local/open-kim -a kim-name" +Syntax from lib dir: python Install.py -b -v version -a kim-name + or: python Install.py -b -a everything + or: python Install.py -n -a kim-name + or: python Install.py -p /usr/local/open-kim -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 base KIM API library with example Models (default) + -b = download and build base KIM API library with example Models this will delete any previous installation in the current folder - -n = do NOT download and build base KIM API library. Use an existing installation + -n = do NOT download and build base KIM API library. + Use an existing installation -p = specify location of KIM API installation (implies -n) -a = add single KIM model or model driver with kim-name to existing KIM API lib (see example below). If kim-name = everything, then rebuild KIM API library with - all available OpenKIM Models (this implies -b). + *all* available OpenKIM Models (make take a long time). -vv = be more verbose about what is happening while the script runs Examples: -make lib-kim # install KIM API lib with only example models +make lib-kim args="-b" # install KIM API lib with only example models make lib-kim args="-a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # Ditto plus one model -make lib-kim args="-a everything" # install KIM API lib with all models +make lib-kim args="-b -a everything" # install KIM API lib with all models make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # only add one model or model driver See the list of KIM model drivers here: @@ -52,8 +49,9 @@ https://openkim.org/kim-api in the "What is in the KIM API source package?" section """ -def error(): - print(help) +def error(str=None): + if not str: print(help) + else: print("ERROR",str) sys.exit() # expand to full path name @@ -62,15 +60,21 @@ def error(): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() thisdir = os.environ['PWD'] version = "kim-api-v1.8.2" -buildflag = True +buildflag = False everythingflag = False addflag = False verboseflag = False diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index 70d2eda241..e4e5ec5613 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -6,32 +6,26 @@ from __future__ import print_function import sys,os,re,subprocess -try: - import ssl - try: from urllib.request import urlretrieve as geturl - except: from urllib import urlretrieve as geturl -except: - def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt - # help message help = """ Syntax from src dir: make lib-mscg args="-p [path] -m [suffix]" + or: make lib-mscg args="-b -m [suffix]" Syntax from lib dir: python Install.py -p [path] -m [suffix] +Syntax from lib dir: python Install.py -b -m [suffix] specify one or more options, order does not matter - -b = download and build MS-CG library (default) + -b = download and build MS-CG library -p = specify folder of existing MS-CG installation -m = machine suffix specifies which src/Make/Makefile.suffix to use default suffix = g++_simple Example: -make lib-mscg args="-b " # download/build in lib/mscg/MSCG-release-master +make lib-mscg args="-b -m serial " # download/build in lib/mscg/MSCG-release-master with settings compatible with "make serial" +make lib-mscg args="-b -m mpi " # download/build in lib/mscg/MSCG-release-master with settings compatible with "make mpi" +make lib-mscg args="-p /usr/local/mscg-release " # use existing MS-CG installation in /usr/local/mscg-release """ # settings @@ -53,15 +47,21 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() homepath = "." homedir = tardir -buildflag = True +buildflag = False pathflag = False linkflag = True msuffix = "g++_simple" @@ -72,7 +72,6 @@ while iarg < nargs: if iarg+2 > nargs: error() mscgpath = fullpath(args[iarg+1]) pathflag = True - buildflag = False iarg += 2 elif args[iarg] == "-m": if iarg+2 > nargs: error() @@ -93,6 +92,9 @@ if (pathflag): if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") +if (not buildflag and not pathflag): + error("Have to use either -b or -p flag") + # download and unpack MS-CG tarfile if buildflag: diff --git a/lib/smd/Install.py b/lib/smd/Install.py index fe02835639..1c270bea5e 100644 --- a/lib/smd/Install.py +++ b/lib/smd/Install.py @@ -5,22 +5,20 @@ 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 from src dir: make lib-smd +Syntax from src dir: make lib-smd args="-b" or: make lib-smd args="-p /usr/include/eigen3" -Syntax from lib dir: python Install.py +Syntax from lib dir: python Install.py -b or: python Install.py -p /usr/include/eigen3" or: python Install.py -v 3.3.4 -b specify one or more options, order does not matter - -b = download and unpack/configure the Eigen library (default) + -b = download and unpack/configure the Eigen library -p = specify folder holding an existing installation of Eigen -v = set version of Eigen library to download and set up (default = 3.3.4) @@ -28,6 +26,7 @@ specify one or more options, order does not matter Example: make lib-smd args="-b" # download/build in default lib/smd/eigen-eigen-* +make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 """ # settings @@ -48,16 +47,21 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() homepath = "." homedir = "eigen3" -grabflag = True -buildflag = True +buildflag = False pathflag = False linkflag = True @@ -71,7 +75,6 @@ while iarg < nargs: if iarg+2 > nargs: error() eigenpath = fullpath(args[iarg+1]) pathflag = True - buildflag = False iarg += 2 elif args[iarg] == "-b": buildflag = True @@ -86,6 +89,9 @@ if (pathflag): if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") +if (not buildflag and not pathflag): + error("Have to use either -b or -p flag") + # download and unpack Eigen tarball # use glob to find name of dir it unpacks to diff --git a/lib/voronoi/Install.py b/lib/voronoi/Install.py index 6db0495a37..5a246bbeb1 100644 --- a/lib/voronoi/Install.py +++ b/lib/voronoi/Install.py @@ -6,35 +6,26 @@ from __future__ import print_function import sys,os,re,subprocess -try: - import ssl - try: from urllib.request import urlretrieve as geturl - except: from urllib import urlretrieve as geturl -except: - def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt - # help message help = """ -Syntax from src dir: make lib-voronoi +Syntax from src dir: make lib-voronoi args="-b" or: make lib-voronoi args="-p /usr/local/voro++-0.4.6" - or: make lib-voronoi args="-v voro++-0.4.6 -b" -Syntax from lib dir: python Install.py -v voro++-0.4.6 -b - or: python Install.py + or: make lib-voronoi args="-b -v voro++-0.4.6" +Syntax from lib dir: python Install.py -b -v voro++-0.4.6 + or: python Install.py -b or: python Install.py -p /usr/local/voro++-0.4.6 specify one or more options, order does not matter - -b = download and build the Voro++ library (default) - -p = specify folder of existing Voro++ installation + -b = download and build the Voro++ library + -p = specify folder of existing Voro++ installation -v = set version of Voro++ to download and build (default voro++-0.4.6) Example: make lib-voronoi args="-b" # download/build in lib/voronoi/voro++-0.4.6 +make lib-voronoi args="-p $HOME/voro++-0.4.6" # use existing Voro++ installation in $HOME/voro++-0.4.6 """ # settings @@ -55,15 +46,21 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() homepath = "." homedir = version -buildflag = True +buildflag = False pathflag = False linkflag = True @@ -77,7 +74,6 @@ while iarg < nargs: if iarg+2 > nargs: error() voropath = fullpath(args[iarg+1]) pathflag = True - buildflag = False iarg += 2 elif args[iarg] == "-b": buildflag = True @@ -94,6 +90,9 @@ if (pathflag): if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") +if (not buildflag and not pathflag): + error("Have to use either -b or -p flag") + # download and unpack Voro++ tarball if buildflag: From 95ece8a6c01c2bad9630386551876fd3203d460d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Aug 2017 17:03:52 -0400 Subject: [PATCH 9/9] consistently use $(PYTHON) in the master makefile (which defaults to "python") --- src/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3d1085e0be..7dfc2c312a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -224,7 +224,7 @@ mpi-stubs: @cd STUBS; $(MAKE) clean; $(MAKE) # install LAMMPS shared lib and Python wrapper for Python usage -# include python package settings to +# include python package settings to # automatically adapt name of python interpreter sinclude ../lib/python/Makefile.lammps @@ -343,10 +343,10 @@ no-%: lib-%: @if [ -e ../lib/$(LIBDIR)/Install.py ]; then \ echo "Installing lib $(@:lib-%=%)"; \ - cd ../lib/$(LIBDIR); python Install.py $(args); \ + cd ../lib/$(LIBDIR); $(PYTHON) Install.py $(args); \ elif [ -e ../lib/$(LIBUSERDIR)/Install.py ]; then \ echo "Installing lib $(@:lib-user-%=%)"; \ - cd ../lib/$(LIBUSERDIR); python Install.py $(args); \ + cd ../lib/$(LIBUSERDIR); $(PYTHON) Install.py $(args); \ else \ echo "Install script for lib $(@:lib-%=%) does not exist"; \ fi;