forked from lammps/lammps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add lib/pace/Install.py to automatically download the source files from github/ICAMS/lammps-user-pace; add lib/pace/CMakeLists.txt to build libpace.a add lib/pace/README update src/USER-PACE/Install.sh
- Loading branch information
Yury Lysogorskiy
committed
Apr 7, 2021
1 parent
6a99f5b
commit 3de3302
Showing
29 changed files
with
203 additions
and
10,268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.7) # CMake version check | ||
project(aceevaluator) | ||
set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard | ||
|
||
|
||
set(PACE_EVALUATOR_PATH ${CMAKE_CURRENT_LIST_DIR}/src/USER-PACE) | ||
# message("CMakeLists.txt DEBUG: PACE_EVALUATOR_PATH=${PACE_EVALUATOR_PATH}") | ||
set(PACE_EVALUATOR_SRC_PATH ${PACE_EVALUATOR_PATH}) | ||
|
||
FILE(GLOB PACE_EVALUATOR_SOURCE_FILES ${PACE_EVALUATOR_SRC_PATH}/*.cpp) | ||
list(FILTER PACE_EVALUATOR_SOURCE_FILES EXCLUDE REGEX ".*pair_pace.*") | ||
set(PACE_EVALUATOR_INCLUDE_DIR ${PACE_EVALUATOR_SRC_PATH}) | ||
|
||
|
||
##### aceevaluator ##### | ||
add_library(aceevaluator ${PACE_EVALUATOR_SOURCE_FILES}) | ||
target_include_directories(aceevaluator PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) | ||
target_compile_options(aceevaluator PRIVATE -O3) | ||
set_target_properties(aceevaluator PROPERTIES OUTPUT_NAME pace${LAMMPS_MACHINE}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,111 @@ | ||
# TODO | ||
# TODO#!/usr/bin/env python | ||
|
||
""" | ||
Install.py tool to download, compile, and setup the pace library | ||
used to automate the steps described in the README file in this dir | ||
""" | ||
|
||
from __future__ import print_function | ||
import sys, os, subprocess, shutil | ||
from argparse import ArgumentParser | ||
|
||
sys.path.append('..') | ||
from install_helpers import fullpath, geturl, checkmd5sum | ||
|
||
parser = ArgumentParser(prog='Install.py', | ||
description="LAMMPS library build wrapper script") | ||
|
||
# settings | ||
|
||
thisdir = fullpath('.') | ||
version = "v.2021.2.3" | ||
|
||
# known checksums for different PACE versions. used to validate the download. | ||
checksums = { \ | ||
'v.2021.2.3' : '9ebb087cba7e4ca041fde52f7e9e640c', \ | ||
} | ||
|
||
|
||
# help message | ||
|
||
HELP = """ | ||
Syntax from src dir: make lib-pace args="-b" | ||
or: make lib-pace args="-b -v version" | ||
Syntax from lib dir: python Install.py -b | ||
or: python Install.py -b -v version | ||
Examples: | ||
make lib-pace args="-b" # install default version of PACE lib | ||
make lib-pace args="-b -v version" # install specified version of PACE lib | ||
""" | ||
|
||
pgroup = parser.add_mutually_exclusive_group() | ||
pgroup.add_argument("-b", "--build", action="store_true", | ||
help="download and build base PACE library") | ||
parser.add_argument("-v", "--version", default=version, choices=checksums.keys(), | ||
help="set version of PACE library to download and build (default: %s)" % version) | ||
parser.add_argument("-vv", "--verbose", action="store_true", | ||
help="be more verbose about is happening while this script runs") | ||
|
||
args = parser.parse_args() | ||
|
||
# print help message and exit, if neither build nor path options are given | ||
if not args.build: | ||
parser.print_help() | ||
sys.exit(HELP) | ||
|
||
buildflag = args.build | ||
|
||
verboseflag = args.verbose | ||
version = args.version | ||
|
||
|
||
archive_extension = "tar.gz" | ||
url = "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/%s.%s" % (version, archive_extension) | ||
unarchived_folder_name = "lammps-user-pace-%s"%(version) | ||
|
||
# download PACE tarball, unpack, build PACE | ||
if buildflag: | ||
|
||
# download entire tarball | ||
|
||
print("Downloading pace tarball ...") | ||
archive_filename = "%s.%s" % (version, archive_extension) | ||
download_filename = "%s/%s" % (thisdir, archive_filename) | ||
print("Downloading from ",url," to ",download_filename, end=" ") | ||
geturl(url, download_filename) | ||
print(" done") | ||
|
||
# verify downloaded archive integrity via md5 checksum, if known. | ||
if version in checksums: | ||
if not checkmd5sum(checksums[version], archive_filename): | ||
sys.exit("Checksum for pace library does not match") | ||
|
||
print("Unpacking pace tarball ...") | ||
src_folder = thisdir+"/src" | ||
cmd = 'cd "%s"; rm -rf "%s"; tar -xvf %s; mv %s %s' % (thisdir, src_folder, archive_filename, unarchived_folder_name, src_folder) | ||
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
|
||
# configure | ||
|
||
build_folder = "%s/build"%(thisdir) | ||
print("Configuring libpace ...") | ||
cmd = 'cd %s && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release' % (thisdir) | ||
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) | ||
if verboseflag: print(txt.decode("UTF-8")) | ||
|
||
# build | ||
print("Building libpace ...") | ||
cmd = 'cd "%s" && make -j2 && cp libpace.a %s/' % (build_folder, thisdir) | ||
txt = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
if verboseflag: | ||
print(txt.decode("UTF-8")) | ||
|
||
# remove source files | ||
|
||
print("Removing pace build files and archive ...") | ||
cmd = 'rm %s; rm -rf %s' % (download_filename, build_folder) | ||
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) |
Oops, something went wrong.