diff --git a/tools/Readme.configure b/tools/Readme.configure index 6e1058e6472..36b310ee5f9 100644 --- a/tools/Readme.configure +++ b/tools/Readme.configure @@ -1,36 +1,60 @@ -SYNOPSIS - configure [options] -OPTIONS - User supplied values are denoted in angle brackets (<>). Any value that contains - white-space must be quoted. Long option names may be supplied with either single - or double leading dashes. A consequence of this is that single letter options may - NOT be bundled. +usage: configure [-h] [-d] [-v] [-s] [--machine MACHINE] + [--machines-dir MACHINES_DIR] + [--macros-format {Makefile,CMake}] [--output-dir OUTPUT_DIR] + [--compiler COMPILER] [--mpilib MPILIB] - -cimeroot Specify the toplevel cime directory. - default: use CIMEROOT environment variable - -mach Specify a machine (required). - -compiler Specify a compiler for the target machine (optional) - default: default compiler for the target machine - -mpilib Specify an mpi library for the target machine (optional) - default: mpi-serial (most of the tools are serial apps) - -mach_dir Specify the locations of the Machines directory (optional). +This script writes CIME build information to a directory. The pieces of +information that will be written include: 1. Machine-specific build settings +(i.e. the "Macros" file). 2. File-specific build settings (i.e. "Depends" +files). 3. Environment variable loads (i.e. the env_mach_specific files). The +.env_mach_specific.sh and .env_mach_specific.csh files are specific to a given +compiler, MPI library, and DEBUG setting. By default, these will be the +machine's default compiler, the machine's default MPI library, and FALSE, +respectively. These can be changed by setting the environment variables +COMPILER, MPILIB, and DEBUG, respectively. - -output_dir default: current working directory - -output_format Output format can be make or cmake. - default: make - -help [or -h] Print usage to STDOUT (optional). - -loglevel +optional arguments: + -h, --help show this help message and exit + -d, --debug Print debug information (very verbose) to file /home/j + edwards/cesm2_0_alpha/cime/tools/mapping/map_field/src + /configure.log + -v, --verbose Add additional context (time and file) to log messages + -s, --silent Print only warnings and error messages + --machine MACHINE The machine to create build information for. + --machines-dir MACHINES_DIR + The machines directory to take build information from. + Overrides the CIME_MODEL environment variable, and + must be specified if that variable is not set. + --macros-format {Makefile,CMake} + The format of Macros file to generate. If 'Makefile' + is passed in, a file called 'Macros.make' is + generated. If 'CMake' is passed in, a file called + 'Macros.cmake' is generated. This option can be + specified multiple times to generate multiple files. + If not used at all, Macros generation is skipped. Note + that Depends files are currently always in Makefile + format, regardless of this option. + --output-dir OUTPUT_DIR + The directory to write files to. If not specified, + defaults to the current working directory. + --compiler COMPILER, -compiler COMPILER + Specify a compiler. To see list of supported compilers + for each machine, use the utility manage_case in this + directory + --mpilib MPILIB, -mpilib MPILIB + Specify the mpilib. To see list of supported mpilibs + for each machine, use the utility manage_case in this + directory. The default is the first listing in MPILIBS + in config_machines.xml + --clean Remove old Macros and env files before attempting to + create new ones -EXAMPLES - ./configure -mach bluefire -compiler ibm -cimeroot /path/to/cime - -This tool is used to create Macros files to build CESM tools on supported machines. It will create a Macros file in make or cmake format along with the module support for the specified or default compiler. It will also create two files .env_mach_specific.csh .env_mach_specific.sh Before you try to run make you should source the file above appropriate for your shell -this will set the proper environment for supported systems which use modules. \ No newline at end of file +this will set the proper environment for supported systems which use modules. diff --git a/tools/configure b/tools/configure index 9ff2e003a96..bba14b82d70 100755 --- a/tools/configure +++ b/tools/configure @@ -55,6 +55,19 @@ def parse_command_line(args): help="The directory to write files to. If not " "specified, defaults to the current working directory.") + parser.add_argument("--compiler", "-compiler", + help="Specify a compiler. " + "To see list of supported compilers for each machine, use the utility manage_case in this directory") + + parser.add_argument("--mpilib", "-mpilib", + help="Specify the mpilib. " + "To see list of supported mpilibs for each machine, use the utility manage_case in this directory. " + "The default is the first listing in MPILIBS in config_machines.xml") + + parser.add_argument("--clean", action="store_true", + help="Remove old Macros and env files before attempting to create new ones") + + argcnt = len(args) args = parser.parse_args() CIME.utils.handle_standard_logging_options(args) @@ -83,7 +96,9 @@ def parse_command_line(args): opts['output_dir'] = args.output_dir # Set compiler. - if "COMPILER" in os.environ: + if args.compiler is not None: + compiler = args.compiler + elif "COMPILER" in os.environ: compiler = os.environ["COMPILER"] else: compiler = machobj.get_default_compiler() @@ -94,11 +109,14 @@ def parse_command_line(args): opts['compiler'] = compiler opts['os'] = machobj.get_value('OS') # Set MPI library. - if "MPILIB" in os.environ: + if args.mpilib is not None: + mpilib = args.mpilib + elif "MPILIB" in os.environ: mpilib = os.environ["MPILIB"] else: mpilib = machobj.get_default_MPIlib() os.environ["MPILIB"] = mpilib + expect(opts['machobj'].is_valid_MPIlib(mpilib), "Invalid MPI library name given in MPILIB environment variable: %s" % mpilib) @@ -115,12 +133,25 @@ def parse_command_line(args): os.environ["DEBUG"] = "FALSE" opts['debug'] = debug + + if args.clean: + files = ["Macros.make", "Macros.cmake", "env_mach_specific.xml", ".env_mach_specific.sh", + ".env_mach_specific.csh", "Depends.%s"%compiler, "Depends.%s"%args.machine, + "Depends.%s.%s"%(args.machine,compiler)] + for file_ in files: + if os.path.isfile(file_): + logger.warn("Removing file %s"%file_) + os.remove(file_) + if argcnt == 2: + opts['clean_only'] = True + return opts def _main(): opts = parse_command_line(sys.argv) - configure(opts['machobj'], opts['output_dir'], opts['macros_format'], - opts['compiler'], opts['mpilib'], opts['debug'], opts['os']) + if "clean_only" not in opts or not opts["clean_only"]: + configure(opts['machobj'], opts['output_dir'], opts['macros_format'], + opts['compiler'], opts['mpilib'], opts['debug'], opts['os']) if __name__ == "__main__": _main() diff --git a/tools/mapping/map_field/src/map_field.F90 b/tools/mapping/map_field/src/map_field.F90 index a612772d359..3f0a9c132bc 100644 --- a/tools/mapping/map_field/src/map_field.F90 +++ b/tools/mapping/map_field/src/map_field.F90 @@ -469,7 +469,8 @@ subroutine write_file(fid, fout, units, n, ni, nj, & if (rcode == 0) then call check_ret(nf_put_att_text(fid,NF_GLOBAL,'hostname' ,len_trim(host),host)) else - write(6,*) 'WARNING: could not determine hostname, so that information will not be stored in netCDF attribute. To avoid this warning in the future, set environment variable HOST or HOSTNAME.' + write(6,*) 'WARNING: could not determine hostname, so that information will not be & + &stored in netCDF attribute. To avoid this warning in the future, set environment variable HOST or HOSTNAME.' end if end if