v0.7 - intel mpi options corrected, added support for building all libraries at once

This commit is contained in:
Patrick Lipka 2022-09-28 15:40:49 +02:00
parent 86f1632a8d
commit dde53580f9
3 changed files with 40 additions and 26 deletions

View File

@ -25,9 +25,10 @@ def init():
config_parser.add_argument('--compiler', help='Select compiler (gnu, intel, aocc) [gnu]', default='gnu') config_parser.add_argument('--compiler', help='Select compiler (gnu, intel, aocc) [gnu]', default='gnu')
config_parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx') config_parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx')
config_parser.add_argument('--threads', help='Number of threads used for make [8]', default='8') config_parser.add_argument('--threads', help='Number of threads used for make [8]', default='8')
config_parser.add_argument('--verbose', help='Print build output to screen instead piping it to logile', action='store_true') config_parser.add_argument('--verbose', help='Print build output to screen instead piping it to logfile', action='store_true')
config_parser.add_argument('--separate-lib64', help='Do not create symbolic links of files from lib64 in lib', action='store_true') config_parser.add_argument('--separate-lib64', help='Do not create symbolic links of files from lib64 in lib', action='store_true')
config_parser.add_argument('--disable-shared', help='Disable building of shared libraries', action='store_true') config_parser.add_argument('--disable-shared', help='Disable building of shared libraries', action='store_true')
config_parser.add_argument('--all', help='Install all libraries with config file in config/', action='store_true')
parser.add_argument('--config', help='Path to config directory [$pwd/config]', default=os.getcwd()+"/config") parser.add_argument('--config', help='Path to config directory [$pwd/config]', default=os.getcwd()+"/config")
parser.add_argument('--prefix', help='Path where install directory should be generated [$pwd]', default=os.getcwd()) parser.add_argument('--prefix', help='Path where install directory should be generated [$pwd]', default=os.getcwd())
@ -37,9 +38,10 @@ def init():
parser.add_argument('--compiler', help='Select compiler (gnu, intel, aocc) [gnu]', default='gnu') parser.add_argument('--compiler', help='Select compiler (gnu, intel, aocc) [gnu]', default='gnu')
parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx') parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx')
parser.add_argument('--threads', help='Number of threads used for make [8]', default='8') parser.add_argument('--threads', help='Number of threads used for make [8]', default='8')
parser.add_argument('--verbose', help='Print build output to screen instead piping it to logile', action='store_true') parser.add_argument('--verbose', help='Print build output to screen instead piping it to logfile', action='store_true')
parser.add_argument('--separate-lib64', help='Do not create symbolic links of files from lib64 in lib', action='store_true') parser.add_argument('--separate-lib64', help='Do not create symbolic links of files from lib64 in lib', action='store_true')
parser.add_argument('--disable-shared', help='Disable building of shared libraries', action='store_true') parser.add_argument('--disable-shared', help='Disable building of shared libraries', action='store_true')
parser.add_argument('--all', help='Install all libraries with config file in config/', action='store_true')
# run config parser and search config/*.json to add a build and version argument for it to the full parser # run config parser and search config/*.json to add a build and version argument for it to the full parser
config_dir = config_parser.parse_known_args()[0].config config_dir = config_parser.parse_known_args()[0].config

View File

@ -24,8 +24,8 @@ def get_mpi_version(mpi):
rawstr = get_from_command(["ompi_info"]).splitlines()[1] rawstr = get_from_command(["ompi_info"]).splitlines()[1]
mpistr = rawstr[rawstr.find(":")+2:] mpistr = rawstr[rawstr.find(":")+2:]
elif mpi == "intelmpi": elif mpi == "intelmpi":
rawstr = get_from_command(["ompi_info"]).splitlines()[0] rawstr = get_from_command(["mpirun","--version"])
mpistr = rawstr[rawstr.find("Version")+8:rawstr.find("Build")-1] mpistr = rawstr.split()[7]
elif mpi == "mpich": elif mpi == "mpich":
rawstr = get_from_command(["mpirun", "--version"]) rawstr = get_from_command(["mpirun", "--version"])
mpistr = rawstr.split()[4] mpistr = rawstr.split()[4]
@ -38,7 +38,7 @@ def set_toolchain(compiler, mpi):
cc = "mpicc" cc = "mpicc"
cxx = "mpic++" cxx = "mpic++"
fc = "mpifort" fc = "mpifort"
elif mpi == "intel": elif mpi == "intelmpi":
cc = "mpicc" cc = "mpicc"
cxx = "mpicxx" cxx = "mpicxx"
fc = "mpif90" fc = "mpif90"
@ -52,7 +52,7 @@ def set_toolchain(compiler, mpi):
os.environ["OMPI_MPIFC"] = "flang" os.environ["OMPI_MPIFC"] = "flang"
os.environ["OMPI_MPIF90"] = "flang" os.environ["OMPI_MPIF90"] = "flang"
os.environ["OMPI_MPIF77"] = "flang" os.environ["OMPI_MPIF77"] = "flang"
elif (mpi == "intel"): elif (mpi == "intelmpi"):
cc = "\"mpicc -cc=clang\"" cc = "\"mpicc -cc=clang\""
cxx = "\"mpicxx -cxx=clang++\"" cxx = "\"mpicxx -cxx=clang++\""
fc = "\"mpif90 -fc=flang\"" fc = "\"mpif90 -fc=flang\""
@ -66,7 +66,7 @@ def set_toolchain(compiler, mpi):
os.environ["OMPI_MPIFC"] = "ifort" os.environ["OMPI_MPIFC"] = "ifort"
os.environ["OMPI_MPIF90"] = "ifort" os.environ["OMPI_MPIF90"] = "ifort"
os.environ["OMPI_MPIF77"] = "ifort" os.environ["OMPI_MPIF77"] = "ifort"
elif mpi == "intel": elif mpi == "intelmpi":
cc = "mpiicc" cc = "mpiicc"
cxx = "mpiicpc" cxx = "mpiicpc"
fc = "mpiifort" fc = "mpiifort"

View File

@ -10,7 +10,7 @@ from lib.sort import sort_libs_by_dependencies
from lib.installer import install_lib from lib.installer import install_lib
from lib.init import init, check_python_version from lib.init import init, check_python_version
SCRIPT_VERSION = "v0.6" SCRIPT_VERSION = "v0.7"
# check if Python >=3.3.0 is used # check if Python >=3.3.0 is used
check_python_version() check_python_version()
@ -30,20 +30,28 @@ build_threads = arg_namespace.threads
verbose = arg_namespace.verbose verbose = arg_namespace.verbose
separate_lib64 = arg_namespace.separate_lib64 separate_lib64 = arg_namespace.separate_lib64
disable_shared = arg_namespace.disable_shared disable_shared = arg_namespace.disable_shared
install_all_libs = arg_namespace.all
# extract libraries and versions selected for installation # extract libraries and versions selected for installation
selected_libs = [] selected_libs = []
ignore_names = ["config", "mpi", "compiler", "prefix", "src", "work", "threads", "verbose", "version", "disable_shared"] if install_all_libs:
for lib_name in args: for cf in glob.glob(config_dir+"/*.json"):
if lib_name not in ignore_names and "version" not in lib_name: with open(cf, 'r') as f:
install = getattr(arg_namespace, lib_name) data = json.load(f)
if install: data['version'] = data['default version']
version = getattr(arg_namespace, lib_name+"_version") selected_libs.append(data)
config_file = config_dir + "/" + lib_name + ".json" else:
with open(config_file, 'r') as cf: ignore_names = ["config", "mpi", "compiler", "prefix", "src", "work", "keep_work", "threads", "verbose", "version", "disable_shared"]
data = json.load(cf) for lib_name in args:
data['version'] = version if lib_name not in ignore_names and "version" not in lib_name:
selected_libs.append(data) install = getattr(arg_namespace, lib_name)
if install:
version = getattr(arg_namespace, lib_name+"_version")
config_file = config_dir + "/" + lib_name + ".json"
with open(config_file, 'r') as cf:
data = json.load(cf)
data['version'] = version
selected_libs.append(data)
# set up install directory name # set up install directory name
compiler_version = get_compiler_version(compiler) compiler_version = get_compiler_version(compiler)
@ -62,6 +70,10 @@ print_welcome(SCRIPT_VERSION, compiler, compiler_version, mpi, mpi_version, buil
# install selected libraries # install selected libraries
if len(sorted_libs) > 0: if len(sorted_libs) > 0:
# add install dir to environment
os.environ["LIBRARY_PATH"] = inst_dir + "/lib" + os.pathsep + inst_dir + "/lib64" + os.pathsep + os.environ["LIBRARY_PATH"]
os.environ["LD_LIBRARY_PATH"] = inst_dir + "/lib" + os.pathsep + inst_dir + "/lib64" + os.pathsep + os.environ["LD_LIBRARY_PATH"]
# install libraries
for lib in sorted_libs: for lib in sorted_libs:
install_lib(lib, src_dir, work_dir, inst_dir, cc, cxx, fc, build_threads, disable_shared, verbose) install_lib(lib, src_dir, work_dir, inst_dir, cc, cxx, fc, build_threads, disable_shared, verbose)
print(bordered("ALL INSTALLS COMPLETED SUCCESSFULLY\nPlease add "+inst_dir+" to your environment")) print(bordered("ALL INSTALLS COMPLETED SUCCESSFULLY\nPlease add "+inst_dir+" to your environment"))