Skip to content

Commit

Permalink
Merge pull request #36 from balmorelcommunity/HPC_threads_dev
Browse files Browse the repository at this point in the history
New cplex options file for HPC runs, including documentation update
  • Loading branch information
tgraulich authored Jan 7, 2025
2 parents a00620c + c89cf78 commit d89f89e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ Remember to study the log report after your job finishes, so you can be more acc

After having transferred our Balmorel model through WinSCP (see [previous page](access.md)), we need to submit a job. This means creating a job script that asks for the right amount of memory usage and time before completion. This is done through a job script, illustrated in the code snippet below. We refer to [this general guide](https://www.hpc.dtu.dk/?page_id=1416) by DTU Computing Center for the exact explanations of the different elements. Note that the paths in the `export` commands are specific to our setup at DTU's clusters.

The bottom commands assumes that the job script is submitted from inside your Balmorel folder, and that your Balmorel project contains a "scenario1" scenario - see [how to create new scenarios](../get_started/scenario_setup.md). The `--threads=$LSB_DJOB_NUMPROC` command makes sure that Balmorel does not use more cores than defined in your job script (four in this case, due to `#BSUB -n 4`)
The bottom commands assumes that the job script is submitted from inside your Balmorel folder, and that your Balmorel project contains a "scenario1" scenario - see [how to create new scenarios](../get_started/scenario_setup.md). The `threads=$LSB_DJOB_NUMPROC` command makes sure that Balmorel does not use more cores than defined in your job script (four in this case, due to `#BSUB -n 4`)

:::{warning}
Please make sure to switch to the solver options file `cplex.op2`, by going into the `balgams.opt` file and setting `$Setglobal USEOPTIONFILE 2`. Otherwise CPLEX will overwrite the number of chosen threads and will ue more resources than requested.
:::

```bash
#!/bin/sh
### General options
Expand Down Expand Up @@ -48,7 +53,7 @@ export LD_LIBRARY_PATH=/appl/gams/47.6.0:$LD_LIBRARY_PATH
# Go to model folder of your scenario - this assumes that the job script is at the same level of the Balmorel folder
cd scenario1/model
# Run Balmorel
gams Balmorel --threads=$LSB_DJOB_NUMPROC
gams Balmorel threads=$LSB_DJOB_NUMPROC
```

## Submitting the Job from PuTTY
Expand Down
1 change: 1 addition & 0 deletions base/model/balgams.opt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ option intVarUp = 0
$Setglobal USEOPTIONFILE 4
*!option 0 No option file is used. Note that not setting anything will generate an error.
*!option 1 Use option file SolverName.opt.
*!option 2 Predefined, don't change. Used with CPLEX it opens cplex.op2 and sets 'LPmethod 4' to run barrior method. Also does not set any Threads option to allow running on HPC.
*!option 4 Predefined, don't change. Used with CPLEX it opens cplex.op4 and sets 'LPmethod 4' to run barrior method.
*!option 6 Predefined, don't change. Used with CPLEX it opens cplex.op6 and sets 'LPmethod 6' to run multiple methods in parallel.

Expand Down
11 changes: 11 additions & 0 deletions base/model/cplex.op2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* Option file 2 for CPLEX solver for HPC runs. For possible options, see the GAMS Solver Manual.
* To use with CPLEX, set '$Setglobal USEOPTIONFILE 2' in balgams.opt.
* Do not change this file, it is predefined.
* To use other options with CPLEX, make and/or use some other file, see USEOPTIONFILE in balgams.opt.
* "LPmethod 4": Barrier method
* If memory tight, set the Threads parameter to 1.
* advind is set to 0 by default since for large problems a better performance has been experienced. If 0, the optimization will not use the previous solution to try to find the next run faster.

LPmethod 4
advind 0
predual -1

0 comments on commit d89f89e

Please sign in to comment.