Hello all,
Apologies, still using cylc v7.9.1 here. But my issue likely applies to cylc 8 as well.
I have a suite with dynamic parameters tat depend on the model domain which is defined by values is rose-suite.conf. Upon startup the suite creates a grid, extracts the horizontal grid dimensions, calculates how many processors are required, and finally calculates the required number of nodes to run the model.
The startup tasks that compute these runtime parameters simply write those values into little files in ${CFG_MPI_PARAMS_DIR} (under the suite’s share directory). In the root’s environment section I can import the values of these dynamic parameters, because shell substitution works well there:
[[root]]
[[[environment]]]
MPI_PARAM_NPROCS = $(cat ${CFG_MPI_PARAMS_DIR}/MPI_PARAM_NPROCS.cfg || echo 0)
MPI_PARAM_NUM_NODES = $(cat ${CFG_MPI_PARAMS_DIR}/MPI_PARAM_NUM_NODES.cfg || echo 0)
so any subsequent task can grab the values from the environment variables, e.g. MPI_PARAM_NPROCS.
In the runtime section I define the task that runs the model like this:
[runtime]
[[run_model]]
[[[environment]]]
ROSE_TASK_APP = run_model
MPI_OPTS = -np ${MPI_PARAM_NPROCS}
[[[directives]]]
--partition = defq
--nodes = ${MPI_PARAM_NUM_NODES}
While this looks logical to me, the mechanism of using variables only works for the [[[environment]]] section of the task definition. The variable MPI_OPTS will indeed take a value like “-np 103” if 103 was the content of the little file ${CFG_MPI_PARAMS_DIR}/MPI_PARAM_NPROCS.cfg (written by the suite startup tasks).
But this doesn’t work for the [[[directives]]] and the job fails to start at all with an error reported in job-activity.log:
[STDERR] sbatch: error: “${MPI_PARAM_NUM_NODES}” is not a valid node count
It appears that no shell substitution is done, the text is interpreted verbatim as –nodes ${MPI_PARAM_NUM_NODES} rather than –nodes 4.
So my question is:
How can I dynamically set the tasks directives, like --nodes ?
Thanks,
Fred