How to use load_balacing_solve.py? What is the data format of its input?

peverley

Courtney Peverley
Moderator
Staff member
Hi,

I believe you can use the timing data from a successful simulation with the "--timing-dir" option like..

./load_balancing_solve.py --timing-dir /full/path/to/timing/directory/in/your/case --total-tasks <tasks> --blocksize <blocksize> --layout IceLndAtmOcn

You can also use load_balancing_submit.py to run a series of simulations, as described in the documentation you linked.

Hope that helps.

Courtney
 

wfc1102@163_com

New Member
Hi,

I believe you can use the timing data from a successful simulation with the "--timing-dir" option like..



You can also use load_balancing_submit.py to run a series of simulations, as described in the documentation you linked.

Hope that helps.

Courtney
Thank you Courtney.
It seems load_balancing_solve.py and load_balancing_submit.py are written in python2 format. Because under python/3.10.10, it raises errors.

export PYTHONPATH=~/cesm2.2.2/cime/scripts/:~/cesm2.2.2/cime/tools/load_balancing_tool/​
./load_balancing_solve.py --timing-dir ~/cesm2.2.2/cime/scripts/BHIST.f09_g17/timing/ --layout IceLndAtmOcn --total-tasks 360 --blocksize 8 --json-output a.json --test-root ~/cesm2.2.2/exps/BHIST.f09_g17/run/​
./load_balancing_solve.py", line 21​
except ImportError, e:​
^^^^^^^^^^^^^^​
SyntaxError: multiple exception types must be parenthesized​

Anyway, this is a small issue and does not matter that much. Then I turn to python2.7
conda create -n py27 python=2.7​
conda activate py27​

It raises other errors:
found directory ~/cesm2.2.2/cime/scripts/BHIST.f09_g17/timing/​
Reading timing file ~/cesm2.2.2/cime/scripts/BHIST.f09_g17/timing/cesm_timing.BHIST.f09_g17.32403813.240411-182424​
Writing MILP data to a.json​
Traceback (most recent call last):​
File "load_balancing_solve.py", line 341, in <module>​
_main_func(__doc__)​
File "load_balancing_solve.py", line 336, in _main_func​
sys.exit(load_balancing_solve(test_id, test_root, timing_dir, blocksizes, total_tasks, layout, graph_models, print_models, pe_output, json_output, json_input))​
File "load_balancing_solve.py", line 305, in load_balancing_solve​
opt = optimize_model.solver_factory(data)​
File "~/cesm2.2.2/cime/tools/load_balancing_tool/optimize_model.py", line 50, in solver_factory​
solver.set_data(data)​
File "~/cesm2.2.2/cime/tools/load_balancing_tool/optimize_model.py", line 109, in set_data​
self.models[key] = ModelData(key, data_dict[key])​
File "~/cesm2.2.2/cime/tools/load_balancing_tool/optimize_model.py", line 59, in __init__​
self.blocksize = model_dict['blocksize']​
KeyError: 'blocksize'​

First, I am not sure what is the vaule '--blocksize 8' means, Does it come from somewhere in my simulation --blocksize simulation BHIST.f09_g17? I only found some BLCK strings in env_build.xml.
env_build.xml: can manually set the values of CICE_BLCKX, CICE_BLCKY, CICE_MXBLCKS,​
env_build.xml: <entry id="CICE_BLCKX" value="4">​
env_build.xml: <entry id="CICE_BLCKY" value="96">​
env_build.xml: <entry id="CICE_MXBLCKS" value="2">​
env_build.xml: <entry id="CICE_CPPDEFS" value=" -Dncdf -DNUMIN=11 -DNUMAX=99 -DNICECAT=5 -DNXGLOB=320 -DNYGLOB=384 -DNTRAERO=3 -DNTRISO=0 -DNBGCLYR=3 -DNICELYR=8 -DNSNWLYR=3 -DTRAGE=1 -DTRFY=1 -DTRLVL=1 -DTRPND=1 -DTRBRI=0 -DTRBGCS=0 -DBLCKX=4 -DBLCKY=96 -DMXBLCKS=2">​
env_build.xml: <entry id="POP_BLCKX" value="64">​
env_build.xml: <entry id="POP_BLCKY" value="48">​
env_build.xml: <entry id="POP_MXBLCKS" value="1">​
env_build.xml: <entry id="POP_CPPDEFS" value="-DCCSMCOUPLED -DMARBL_TIMING_OPT=CIME -DBLCKX=64 -DBLCKY=48 -DMXBLCKS=1 -DNT=38 -DMARBL_NT=32 -DIRF_NT=0 ">​

Second, This is a new machine called "pi2", without setting "--test-root ..." it will raise:
Could not find machine match for 'pilogin3.pi.sjtu.edu.cn' or 'pilogin3.pi.sjtu.edu.cn'​
Could not find machine match for 'pilogin3.pi.sjtu.edu.cn' or 'pilogin3.pi.sjtu.edu.cn'​
Could not find machine match for 'pilogin3.pi.sjtu.edu.cn' or 'pilogin3.pi.sjtu.edu.cn'​
ERROR: Could not initialize machine object from ~/cesm2.2.2/cime/config/cesm/machines/config_machines.xml or ~/cesm2.2.2/cime/config/e3sm/machines/config_machines.xml. This machine is not available for the target CIME_MODEL. The supported CIME_MODELS that can be used are: []​
And "./load_balancing_solve.py --help" shows as below. Then I suppose add machine information by adding "--test-root TEST_ROOT".
-r TEST_ROOT, --test-root TEST_ROOT
Where test cases were created. Will default to output
root as defined in the config_machines file (default:
None)
 
Back
Top