Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.2.0-alpha.6 #641

Merged
merged 20 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions compass/machines/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os
import socket

try:
from importlib.resources import contents as imp_res_contents
except ImportError:
# python<=3.8
from importlib_resources import contents as imp_res_contents

from mache import discover_machine as mache_discover_machine

from compass.config import CompassConfigParser


def discover_machine(quiet=False):
"""
Figure out the machine from the host name

Parameters
----------
quiet : bool, optional
Whether to print warnings if the machine name is ambiguous

Returns
-------
machine : str
The name of the current machine
"""
machine = mache_discover_machine(quiet=quiet)
if machine is None:
possible_hosts = _get_possible_hosts()
hostname = socket.gethostname()
for possible_machine, hostname_contains in possible_hosts.items():
if hostname_contains in hostname:
machine = possible_machine
break
return machine


def _get_possible_hosts():
machine_contents = imp_res_contents('compass.machines')
possible_hosts = dict()
for filename in machine_contents:
if filename.endswith('.cfg'):
machine = os.path.split(filename)[0]
config = CompassConfigParser()
config.add_from_package('compass.machines', filename)
if config.has_section('discovery') and \
config.has_option('discovery', 'hostname_contains'):
hostname_contains = config.get('discovery',
'hostname_contains')
possible_hosts[machine] = hostname_contains

return possible_hosts
60 changes: 60 additions & 0 deletions compass/machines/eligos.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# The parallel section describes options related to running jobs in parallel
[parallel]

# parallel system of execution: slurm, cobalt or single_node
system = single_node

# whether to use mpirun or srun to run a task
parallel_executable = mpirun

# cores per node on the machine
cores_per_node = 4


# Config options related to spack environments
[spack]

# whether to load modules from the spack yaml file before loading the spack
# environment
modules_before = False

# whether to load modules from the spack yaml file after loading the spack
# environment
modules_after = False


# The paths section describes paths that are used within the ocean core test
# cases.
[paths]

# A shared root directory where MPAS standalone data can be found
database_root = /home/xylar/data/mpas/mpas_standalonedata

# the path to the base conda environment where compass environments have
# been created
compass_envs = /home/xylar/data/mpas/compass_envs


# Options related to deploying a compass conda environment on supported
# machines
[deploy]

# the compiler set to use for system libraries and MPAS builds
compiler = gnu

# the system MPI library to use for gnu compiler
mpi_gnu = openmpi

# the base path for spack environments used by compass
spack = /home/xylar/data/mpas/spack

# whether to use the same modules for hdf5, netcdf-c, netcdf-fortran and
# pnetcdf as E3SM (spack modules are used otherwise)
use_e3sm_hdf5_netcdf = False


# Options related to machine discovery
[discovery]

# a substring used to identify this machine from its hostname
hostname_contains = eligos
60 changes: 60 additions & 0 deletions compass/machines/morpheus.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# The parallel section describes options related to running jobs in parallel
[parallel]

# parallel system of execution: slurm, cobalt or single_node
system = single_node

# whether to use mpirun or srun to run a task
parallel_executable = mpirun

# cores per node on the machine
cores_per_node = 8


# Config options related to spack environments
[spack]

# whether to load modules from the spack yaml file before loading the spack
# environment
modules_before = False

# whether to load modules from the spack yaml file after loading the spack
# environment
modules_after = False


# The paths section describes paths that are used within the ocean core test
# cases.
[paths]

# A shared root directory where MPAS standalone data can be found
database_root = /home/xylar/data/mpas/mpas_standalonedata

# the path to the base conda environment where compass environments have
# been created
compass_envs = /home/xylar/data/mpas/compass_envs


# Options related to deploying a compass conda environment on supported
# machines
[deploy]

# the compiler set to use for system libraries and MPAS builds
compiler = gnu

# the system MPI library to use for gnu compiler
mpi_gnu = openmpi

# the base path for spack environments used by compass
spack = /home/xylar/data/mpas/spack

# whether to use the same modules for hdf5, netcdf-c, netcdf-fortran and
# pnetcdf as E3SM (spack modules are used otherwise)
use_e3sm_hdf5_netcdf = False


# Options related to machine discovery
[discovery]

# a substring used to identify this machine from its hostname
hostname_contains = morpheus
6 changes: 3 additions & 3 deletions compass/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import sys
import warnings

from mache import discover_machine

from compass import provenance
from compass.config import CompassConfigParser
from compass.io import symlink
from compass.job import write_job_script
from compass.machines import discover_machine
from compass.mpas_cores import get_mpas_cores


Expand Down Expand Up @@ -432,7 +431,8 @@ def _get_basic_config(config_file, machine, mpas_model_path, mpas_core):

# add the E3SM config options from mache
if machine is not None:
config.add_from_package('mache.machines', f'{machine}.cfg')
config.add_from_package('mache.machines', f'{machine}.cfg',
exception=False)

# add the compass machine config file
if machine is None:
Expand Down
2 changes: 1 addition & 1 deletion compass/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.2.0-alpha.5'
__version__ = '1.2.0-alpha.6'
1 change: 1 addition & 0 deletions conda/albany_supported.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
chicoma-cpu, gnu, mpich
chrysalis, gnu, openmpi
pm-cpu, gnu, mpich
morpheus, gnu, openmpi
Loading