diff --git a/compass/machines/default.cfg b/compass/machines/default.cfg index 57965541a3..1a0d5051e4 100644 --- a/compass/machines/default.cfg +++ b/compass/machines/default.cfg @@ -1,4 +1,3 @@ - # The parallel section describes options related to running tests in parallel [parallel] @@ -7,6 +6,3 @@ system = single_node # whether to use mpirun or srun to run the model parallel_executable = mpirun - -# cores per node on the machine -cores_per_node = 4 diff --git a/compass/parallel.py b/compass/parallel.py index aa701d8a06..5eff9f95c2 100644 --- a/compass/parallel.py +++ b/compass/parallel.py @@ -30,8 +30,10 @@ def get_available_cores_and_nodes(config): args = ['squeue', '--noheader', '-j', job_id, '-o', '%D'] nodes = _get_subprocess_int(args) elif parallel_system == 'single_node': - cores_per_node = config.getint('parallel', 'cores_per_node') - cores = min(multiprocessing.cpu_count(), cores_per_node) + cores = multiprocessing.cpu_count() + if config.has_option('parallel', 'cores_per_node'): + cores_per_node = config.getint('parallel', 'cores_per_node') + cores = min(cores, cores_per_node) nodes = 1 else: raise ValueError('Unexpected parallel system: {}'.format( @@ -90,6 +92,10 @@ def set_cores_per_node(config): if old_cpus_per_node != cpus_per_node: warnings.warn(f'Slurm found {cpus_per_node} cpus per node but ' f'config from mache was {old_cpus_per_node}') + elif parallel_system == 'single_node': + if not config.has_option('parallel', 'cores_per_node'): + cores = multiprocessing.cpu_count() + config.set('parallel', 'cores_per_node', f'{cores}') def _get_subprocess_int(args): diff --git a/docs/users_guide/machines/index.rst b/docs/users_guide/machines/index.rst index 6bea3235e2..d970572fba 100644 --- a/docs/users_guide/machines/index.rst +++ b/docs/users_guide/machines/index.rst @@ -171,13 +171,10 @@ in your user config file: system = single_node # whether to use mpirun or srun to run the model - parallel_executable = mpirun + parallel_executable = mpirun -host localhost - # cores per node on the machine - cores_per_node = 4 - - # the number of multiprocessing or dask threads to use - threads = 4 + # cores per node on the machine, detected automatically by default + # cores_per_node = 4 The paths for the MPAS core "databases" can be any emtpy path to begin with. If the path doesn't exist, ``compass`` will create it. diff --git a/docs/users_guide/quick_start.rst b/docs/users_guide/quick_start.rst index e1218a7a89..aaba9fc92e 100644 --- a/docs/users_guide/quick_start.rst +++ b/docs/users_guide/quick_start.rst @@ -301,20 +301,17 @@ in the repository. # whether to use mpirun or srun to run the model parallel_executable = mpirun -host localhost - # cores per node on the machine - cores_per_node = 4 - - # the number of multiprocessing or dask threads to use - threads = 4 + # cores per node on the machine, detected automatically by default + # cores_per_node = 4 The two ``*_database_root`` directories can point to locations where you would like to download data for MALI and MPAS-Ocean. This data is downloaded only once and cached for the next time you call ``compass setup`` or ``compass suite`` (see below). -The ``cores_per_node`` and ``threads`` config options should be the number of -CPUs on your computer. You can set this to a smaller number if you want -``compass``. +The ``cores_per_node`` config option will default to the number of CPUs on your +computer. You can set this to a smaller number if you want ``compass`` to +use fewer cores. In order to run regression testing that compares the output of the current run with that from a previous compass run, use ``-b `` to specify diff --git a/example_configs/landice.cfg b/example_configs/landice.cfg index 448bd52ce8..ffc4514b38 100644 --- a/example_configs/landice.cfg +++ b/example_configs/landice.cfg @@ -22,11 +22,8 @@ system = single_node # whether to use mpirun or srun to run the model parallel_executable = mpirun -host localhost -# cores per node on the machine -cores_per_node = 4 - -# the number of multiprocessing or dask threads to use -threads = 4 +# cores per node on the machine, detected automatically by default +# cores_per_node = 4 # Options related to downloading files diff --git a/example_configs/ocean.cfg b/example_configs/ocean.cfg index 1d037a4e67..c90d9865d7 100644 --- a/example_configs/ocean.cfg +++ b/example_configs/ocean.cfg @@ -23,11 +23,8 @@ system = single_node # whether to use mpirun or srun to run the model parallel_executable = mpirun -host localhost -# cores per node on the machine -cores_per_node = 4 - -# the number of multiprocessing or dask threads to use -threads = 4 +# cores per node on the machine, detected automatically by default +# cores_per_node = 4 # Options related to downloading files