From 3ea23bfb8b058aab9307bbeef3559a499f15a57b Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Sun, 15 Mar 2020 17:59:57 +0300 Subject: [PATCH] Define an argparse parent parser for container image tools. Refs #3395 Change-Id: I8bcb314b21732cb870743f44de6aadc4d6bf534d --- admin/containers/utility.py | 91 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 admin/containers/utility.py diff --git a/admin/containers/utility.py b/admin/containers/utility.py new file mode 100644 index 0000000000..26958eca34 --- /dev/null +++ b/admin/containers/utility.py @@ -0,0 +1,91 @@ +# This file is part of the GROMACS molecular simulation package. +# +# Copyright (c) 2020, by the GROMACS development team, led by +# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, +# and including many others, as listed in the AUTHORS file in the +# top-level source directory and at http://www.gromacs.org. +# +# GROMACS is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 +# of the License, or (at your option) any later version. +# +# GROMACS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with GROMACS; if not, see +# http://www.gnu.org/licenses, or write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# If you want to redistribute modifications to GROMACS, please +# consider that scientific software is very special. Version +# control is crucial - bugs must be traceable. We will be happy to +# consider code for inclusion in the official distribution, but +# derived work must not be called official GROMACS. Details are found +# in the README & COPYING files - if they are missing, get the +# official version at http://www.gromacs.org. +# +# To help us fund GROMACS development, we humbly ask that you cite +# the research papers on the package. Check out http://www.gromacs.org. + +"""A `utility` module helps manage the matrix of configurations for CI testing and build containers. + +Provides importable argument parser. + +Authors: + * Paul Bauer + * Eric Irrgang + * Joe Jordan + +""" + +import argparse + + +parser = argparse.ArgumentParser(description='GROMACS CI image slug options.', add_help=False) +"""A parent parser for tools referencing image parameters. + +This argparse parser is defined for convenience and may be used to partially initialize +parsers for tools. + +.. warning:: Do not modify this parser. + + Instead, inherit from it with the *parents* argument to :py:class:`argparse.ArgumentParser` +""" + +# TODO: Try using distutils.version.StrictVersion. +parser.add_argument('--cmake', type=str, default='3.13.0', + choices=['3.13.0', '3.14.7', '3.15.7'], + help='Selection of CMake version to provide to base image') +compiler_group = parser.add_mutually_exclusive_group() +compiler_group.add_argument('--gnu', type=int, nargs='?', const=7, default=7, + choices=[6, 7, 8, 9], + help='Select GNU compiler tool chain. (Default) ' + 'Some checking is implemented to avoid incompatible combinations') +compiler_group.add_argument('--llvm', type=int, nargs='?', const=7, default=None, + choices=[6, 7, 8], + help='Select LLVM compiler tool chain. ' + 'Some checking is implemented to avoid incompatible combinations') +compiler_group.add_argument('--icc', type=int, nargs='?', const=7, default=None, + choices=[19, 20], + help='Select Intel compiler tool chain. ' + 'Some checking is implemented to avoid incompatible combinations') + +linux_group = parser.add_mutually_exclusive_group() +linux_group.add_argument('--ubuntu', type=str, nargs='?', const='18.04', default='18.04', + choices=['16.04', '18.04'], + help='Select Ubuntu Linux base image. (default: ubuntu 18.04)') +linux_group.add_argument('--centos', type=str, nargs='?', const='7', default=None, + choices=['6', '7'], + help='Select Centos Linux base image.') + +parser.add_argument('--cuda', type=str, nargs='?', const='10.2', default=None, + choices=['9.0', '10.0', '10.1', '10.2'], + help='Select a CUDA version for a base Linux image from NVIDIA.') + +parser.add_argument('--mpi', type=str, nargs='?', const='openmpi', default=None, + choices=['openmpi', 'impi'], + help='Enable MPI (default disabled) and optionally select distribution (default: openmpi)') -- 2.11.4.GIT