-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #641 from xylar/update-to-1.2.0-alpha.6
Update to 1.2.0-alpha.6
- Loading branch information
Showing
19 changed files
with
680 additions
and
76 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,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 |
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,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 |
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,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 |
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
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 @@ | ||
__version__ = '1.2.0-alpha.5' | ||
__version__ = '1.2.0-alpha.6' |
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
chicoma-cpu, gnu, mpich | ||
chrysalis, gnu, openmpi | ||
pm-cpu, gnu, mpich | ||
morpheus, gnu, openmpi |
Oops, something went wrong.