AMPL

From FarmShare

(Difference between revisions)
Jump to: navigation, search
(submit to barley)
(submit to barley)
Line 87: Line 87:
#$ -l mem_free=5G
#$ -l mem_free=5G
-
/usr/sweet/bin/ampl model.run  
+
ampl model.run  
</pre>
</pre>
-
You'll need to use the '-V' flag either on the command line or in the job script, and you'll need to run 'module load CPLEX_Studio-12.4' before you submit the job.  The latter will add cplex and cplexamp to your PATH and the former will pass that environment variable through to the job environment.
+
You'll need to use the '-V' flag either on the command line or in the job script, and you'll need to run 'module load CPLEX_Studio-12.4' and 'module load AMPL' before you submit the job.  The latter will add cplex and cplexamp to your PATH and the former will pass that environment variable through to the job environment.
Submit with:
Submit with:
-
   qsub my_ample.script
+
   qsub my_ampl.script

Revision as of 15:00, 15 August 2012

I tried running an ampl example, specifically cut3.run from here: http://www.ampl.com/NEW/LOOP2/index.html

But you need to replace the command "option solver cplex" with "option solver cplexamp"

Put cplex in my path:

[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ module load CPLEX_Studio-12.4
[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ which cplex
/mnt/glusterfs/software/non-free/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1/cplex
[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ which cplexamp 
/mnt/glusterfs/software/non-free/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1/cplexamp

Interactive

Run interactive /usr/sweet/bin/ampl using the absolute path:

[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ /usr/sweet/bin/ampl 
ILOG AMPL 11.210, licensed to "stanford-palo alto, ca", options: MaintenanceEnd=20110531 
AMPL Version 20081120 (Linux 2.6.18-5-amd64)
ampl: include cut3.run

  52.10  -2.00e-01    1  0  0  0  1
  50.50  -2.00e-01    1  2  0  0  0
  47.00  -1.00e-01    3  0  1  0  0
  46.25  -1.00e-06  


Rounded up to integer:  48 rolls

Cut     0   0   9   5   0   8  18   8

 20     5   0   0   0   0   1   1   3
 45     0   2   0   0   0   0   2   0
 50     0   0   2   0   0   0   0   1
 55     0   0   0   2   0   0   0   0
 75     0   0   0   0   1   1   0   0

WASTE =  7.48%


Best integer:  47 rolls

Cut     0   0   8   5   0   8  18   8

 20     5   0   0   0   0   1   1   3
 45     0   2   0   0   0   0   2   0
 50     0   0   2   0   0   0   0   1
 55     0   0   0   2   0   0   0   0
 75     0   0   0   0   1   1   0   0

WASTE =  5.51%

ampl: quit; 

If you use "option solver cplex" in your run file, it will just sit there indefinitely and produce no output. If you use 'ampl' instead of '/usr/sweet/bin/ampl', you need to have /usr/sweet/bin in your PATH first.

non-interactive, aka batch

You can just give ampl the filename of the run file as an argument, instead of invoking ampl interactively. E.g.

 /usr/sweet/bin/ampl cut3.run

It will still print the output out to stdout, so you may want to redirect to a file, e.g.

 /usr/sweet/bin/ample cut3.run > output_of_cut3.out

submit to barley

Since we can run the program non-interactively, we can submit it to the resource management system. Write a job script like this:

#!/bin/bash
# use the current directory
#$ -cwd
# use the current environment
#$ -V
# mail this address
#$ -M chekh@stanford.edu
# send mail on begin, end, suspend
#$ -m bes
# request 5GB of RAM for this job
#$ -l mem_free=5G

ampl model.run 

You'll need to use the '-V' flag either on the command line or in the job script, and you'll need to run 'module load CPLEX_Studio-12.4' and 'module load AMPL' before you submit the job. The latter will add cplex and cplexamp to your PATH and the former will pass that environment variable through to the job environment.

Submit with:

 qsub my_ampl.script
Personal tools
Toolbox
LANGUAGES