|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| README | H A D | 01-Apr-2020 | 9.5 KiB | 260 | 186 |
| README.SGI | H A D | 01-Apr-2020 | 6.7 KiB | 203 | 153 |
| README.f77 | H A D | 01-Apr-2020 | 1.8 KiB | 75 | 54 |
| README.suf | H A D | 01-Apr-2020 | 4.7 KiB | 125 | 96 |
| amplsolv.lbc | H A D | 01-Apr-2020 | 1 KiB | 91 | 90 |
| amplsolv.sy | H A D | 01-Apr-2020 | 1.3 KiB | 91 | 90 |
| arith.h0 | H A D | 01-Apr-2020 | 2.3 KiB | 63 | 49 |
| arith.h1 | H A D | 01-Apr-2020 | 1.8 KiB | 57 | 52 |
| arith.ibm | H A D | 01-Apr-2020 | 1.4 KiB | 32 | 26 |
| arithchk.c | H A D | 01-Apr-2020 | 6.4 KiB | 286 | 235 |
| asl.h | H A D | 01-Apr-2020 | 40.7 KiB | 1,216 | 964 |
| asl_pfg.h | H A D | 01-Apr-2020 | 1.2 KiB | 30 | 5 |
| asl_pfgh.h | H A D | 01-Apr-2020 | 1.3 KiB | 31 | 6 |
| asldate.c | H A D | 01-Apr-2020 | 29 | 2 | 1 |
| atof.c | H A D | 01-Apr-2020 | 1.7 KiB | 55 | 22 |
| auxinfo.c | H A D | 01-Apr-2020 | 1.5 KiB | 43 | 13 |
| avltree.c | H A D | 01-Apr-2020 | 11.1 KiB | 666 | 594 |
| avltree.h | H A D | 01-Apr-2020 | 4.6 KiB | 96 | 33 |
| b_search.c | H A D | 01-Apr-2020 | 3.1 KiB | 130 | 76 |
| basename.c | H A D | 01-Apr-2020 | 1.5 KiB | 52 | 26 |
| bscanf.c | H A D | 01-Apr-2020 | 6.1 KiB | 321 | 280 |
| changes | H A D | 01-Apr-2020 | 129.2 KiB | 3,188 | 2,680 |
| com2eval.c | H A D | 01-Apr-2020 | 15.7 KiB | 926 | 832 |
| comeval.c | H A D | 01-Apr-2020 | 2.6 KiB | 107 | 77 |
| comptry.bat | H A D | 01-Apr-2020 | 209 | 14 | 13 |
| con1ival.c | H A D | 01-Apr-2020 | 6 KiB | 277 | 241 |
| con2ival.c | H A D | 01-Apr-2020 | 6 KiB | 277 | 241 |
| con2val.c | H A D | 01-Apr-2020 | 4.8 KiB | 208 | 183 |
| conadj.c | H A D | 01-Apr-2020 | 2 KiB | 64 | 30 |
| configure | H A D | 01-Apr-2020 | 1.7 KiB | 57 | 25 |
| configurehere | H A D | 01-Apr-2020 | 1.7 KiB | 52 | 28 |
| conpval.c | H A D | 01-Apr-2020 | 19.8 KiB | 1,032 | 971 |
| conscale.c | H A D | 01-Apr-2020 | 3.4 KiB | 190 | 177 |
| conval.c | H A D | 01-Apr-2020 | 4.5 KiB | 197 | 174 |
| degree.c | H A D | 01-Apr-2020 | 4.2 KiB | 211 | 156 |
| derprop.c | H A D | 01-Apr-2020 | 1.3 KiB | 40 | 14 |
| details.c0 | H A D | 01-Apr-2020 | 182 | 6 | 4 |
| dtoa.c | H A D | 01-Apr-2020 | 154.7 KiB | 6,204 | 5,540 |
| dtoa1.c | H A D | 01-Apr-2020 | 3.3 KiB | 151 | 110 |
| dtoa_locks.c | H A D | 01-Apr-2020 | 379 | 31 | 25 |
| duthes.c | H A D | 01-Apr-2020 | 3.6 KiB | 143 | 111 |
| dvalue.hd | H A D | 01-Apr-2020 | 1.1 KiB | 80 | 79 |
| dynlink.c | H A D | 01-Apr-2020 | 1.3 KiB | 39 | 9 |
| errchk.h | H A D | 01-Apr-2020 | 1.7 KiB | 44 | 17 |
| f_read.c | H A D | 01-Apr-2020 | 1.2 KiB | 28 | 2 |
| fg_read.c | H A D | 01-Apr-2020 | 35.9 KiB | 1,813 | 1,694 |
| fg_write.c | H A D | 01-Apr-2020 | 17 KiB | 862 | 798 |
| fgh_read.c | H A D | 01-Apr-2020 | 33.6 KiB | 1,726 | 1,608 |
| float.h0 | H A D | 01-Apr-2020 | 1.8 KiB | 63 | 54 |
| fpecatch.c | H A D | 01-Apr-2020 | 1.5 KiB | 53 | 22 |
| fpinit.c | H A D | 01-Apr-2020 | 5.5 KiB | 258 | 204 |
| fpinitmt.c | H A D | 01-Apr-2020 | 4.8 KiB | 248 | 201 |
| fpsetprec.s | H A D | 01-Apr-2020 | 535 | 28 | 25 |
| fpsetprec64.s | H A D | 01-Apr-2020 | 488 | 27 | 24 |
| fullhes.c | H A D | 01-Apr-2020 | 3.9 KiB | 166 | 127 |
| func_add.c | H A D | 01-Apr-2020 | 11.2 KiB | 551 | 463 |
| funcadd.c | H A D | 01-Apr-2020 | 3.4 KiB | 142 | 92 |
| funcadd.h | H A D | 01-Apr-2020 | 15.9 KiB | 489 | 334 |
| funcadd0.c | H A D | 01-Apr-2020 | 1.3 KiB | 37 | 7 |
| funcadd1.c | H A D | 03-May-2022 | 10.6 KiB | 506 | 434 |
| funcaddk.c | H A D | 01-Apr-2020 | 3.3 KiB | 137 | 87 |
| funcaddr.c | H A D | 01-Apr-2020 | 1.2 KiB | 27 | 2 |
| g_fmt.c | H A D | 01-Apr-2020 | 3.1 KiB | 141 | 99 |
| genrowno.c | H A D | 01-Apr-2020 | 1.8 KiB | 52 | 20 |
| getenv.c | H A D | 01-Apr-2020 | 1.4 KiB | 46 | 14 |
| getstub.c | H A D | 01-Apr-2020 | 12.9 KiB | 635 | 572 |
| getstub.h | H A D | 01-Apr-2020 | 6.9 KiB | 207 | 134 |
| htcl.c | H A D | 01-Apr-2020 | 2.2 KiB | 95 | 66 |
| indic_cons.c | H A D | 01-Apr-2020 | 13.6 KiB | 694 | 636 |
| jac0dim.c | H A D | 01-Apr-2020 | 6.7 KiB | 300 | 251 |
| jac2dim.c | H A D | 01-Apr-2020 | 1.7 KiB | 46 | 17 |
| jac2dim.h | H A D | 01-Apr-2020 | 1.9 KiB | 45 | 24 |
| jacdim.c | H A D | 01-Apr-2020 | 1.8 KiB | 51 | 22 |
| jacinc.c | H A D | 01-Apr-2020 | 2.2 KiB | 79 | 48 |
| jacinc1.c | H A D | 01-Apr-2020 | 2 KiB | 62 | 34 |
| jacpdim.h | H A D | 01-Apr-2020 | 2.3 KiB | 56 | 35 |
| libnamsave.c | H A D | 01-Apr-2020 | 117 | 6 | 4 |
| mach.c | H A D | 01-Apr-2020 | 2.6 KiB | 108 | 79 |
| mainexit.c | H A D | 01-Apr-2020 | 1.7 KiB | 68 | 32 |
| makefile.lc | H A D | 01-Apr-2020 | 5.9 KiB | 208 | 151 |
| makefile.sy | H A D | 01-Apr-2020 | 5.5 KiB | 197 | 148 |
| makefile.u | H A D | 01-Apr-2020 | 10.9 KiB | 453 | 309 |
| makefile.vc | H A D | 01-Apr-2020 | 7.3 KiB | 237 | 148 |
| makefile.wat | H A D | 01-Apr-2020 | 5.7 KiB | 202 | 148 |
| mip_pri.c | H A D | 01-Apr-2020 | 7.7 KiB | 329 | 276 |
| misc.c | H A D | 01-Apr-2020 | 29 KiB | 1,546 | 1,405 |
| mkfile | H A D | 01-Apr-2020 | 194 | 7 | 5 |
| mpec_adj.c | H A D | 01-Apr-2020 | 8.9 KiB | 389 | 340 |
| mpec_adj0.c | H A D | 01-Apr-2020 | 70 | 6 | 4 |
| mqpcheckv.c | H A D | 01-Apr-2020 | 19.3 KiB | 1,006 | 915 |
| mypow.c | H A D | 01-Apr-2020 | 2.4 KiB | 111 | 82 |
| names.c | H A D | 01-Apr-2020 | 4.2 KiB | 188 | 146 |
| nl_obj.c | H A D | 01-Apr-2020 | 2.5 KiB | 86 | 57 |
| nlp.h | H A D | 01-Apr-2020 | 5.3 KiB | 258 | 202 |
| nlp2.h | H A D | 01-Apr-2020 | 7 KiB | 341 | 276 |
| nqpcheck.c | H A D | 01-Apr-2020 | 17.9 KiB | 946 | 849 |
| nqpcheckZ.c | H A D | 01-Apr-2020 | 1.2 KiB | 28 | 6 |
| obj2val.c | H A D | 01-Apr-2020 | 4.4 KiB | 196 | 171 |
| obj_adj.c | H A D | 01-Apr-2020 | 15.3 KiB | 750 | 702 |
| obj_adj.h | H A D | 01-Apr-2020 | 2.2 KiB | 45 | 10 |
| obj_adj0.c | H A D | 01-Apr-2020 | 67 | 7 | 4 |
| obj_prec.c | H A D | 01-Apr-2020 | 1.4 KiB | 46 | 17 |
| objconst.c | H A D | 01-Apr-2020 | 2.2 KiB | 73 | 48 |
| objval.c | H A D | 01-Apr-2020 | 5.5 KiB | 262 | 234 |
| objval_.c | H A D | 01-Apr-2020 | 3.4 KiB | 144 | 104 |
| op_type.c | H A D | 01-Apr-2020 | 1.2 KiB | 34 | 8 |
| op_type.hd | H A D | 01-Apr-2020 | 1.3 KiB | 84 | 83 |
| op_typeb.hd | H A D | 01-Apr-2020 | 1.3 KiB | 84 | 83 |
| opcode.hd | H A D | 01-Apr-2020 | 1.3 KiB | 71 | 70 |
| opnos.hd | H A D | 01-Apr-2020 | 78 | 6 | 5 |
| pfg_read.c | H A D | 01-Apr-2020 | 95.7 KiB | 5,000 | 4,669 |
| pfghread.c | H A D | 01-Apr-2020 | 1.1 KiB | 23 | 3 |
| printf.c | H A D | 01-Apr-2020 | 23.5 KiB | 1,334 | 1,230 |
| pshvprod.c | H A D | 01-Apr-2020 | 30 KiB | 1,616 | 1,498 |
| psinfo.h | H A D | 01-Apr-2020 | 9.6 KiB | 333 | 269 |
| punknown.c | H A D | 01-Apr-2020 | 1.7 KiB | 55 | 25 |
| qp_read.c | H A D | 01-Apr-2020 | 3.9 KiB | 175 | 133 |
| qpcheck.c | H A D | 01-Apr-2020 | 1.6 KiB | 49 | 27 |
| qpcheckZ.c | H A D | 01-Apr-2020 | 1.6 KiB | 49 | 25 |
| qsortv.c | H A D | 01-Apr-2020 | 4.8 KiB | 150 | 108 |
| r_op.hd | H A D | 01-Apr-2020 | 890 | 84 | 83 |
| r_opn.hd | H A D | 01-Apr-2020 | 412 | 17 | 16 |
| r_opn0.hd | H A D | 01-Apr-2020 | 342 | 18 | 17 |
| r_qp.hd | H A D | 01-Apr-2020 | 184 | 11 | 10 |
| readsol.c | H A D | 01-Apr-2020 | 8 KiB | 362 | 322 |
| repwhere.c | H A D | 01-Apr-2020 | 10 KiB | 478 | 396 |
| rnd_prod.s | H A D | 01-Apr-2020 | 1.4 KiB | 53 | 27 |
| rops.c | H A D | 01-Apr-2020 | 18.7 KiB | 1,239 | 1,095 |
| rops2.c | H A D | 01-Apr-2020 | 20 KiB | 1,284 | 1,131 |
| sigcatch.c | H A D | 01-Apr-2020 | 2.3 KiB | 109 | 72 |
| sjac0dim.c | H A D | 01-Apr-2020 | 1.5 KiB | 42 | 15 |
| sos_add.c | H A D | 01-Apr-2020 | 22.5 KiB | 1,051 | 909 |
| sphes.c | H A D | 01-Apr-2020 | 26.7 KiB | 1,318 | 1,227 |
| sprintf.c | H A D | 01-Apr-2020 | 3 KiB | 150 | 109 |
| sscanf.c | H A D | 01-Apr-2020 | 3.2 KiB | 163 | 125 |
| stderr.c | H A D | 01-Apr-2020 | 2 KiB | 75 | 38 |
| stdio1.h0 | H A D | 01-Apr-2020 | 3 KiB | 109 | 95 |
| strerror.c | H A D | 01-Apr-2020 | 1.3 KiB | 37 | 8 |
| studchk0.c | H A D | 01-Apr-2020 | 1.4 KiB | 36 | 9 |
| suf_sos.c | H A D | 01-Apr-2020 | 12.1 KiB | 591 | 542 |
| value.c | H A D | 01-Apr-2020 | 5.7 KiB | 280 | 228 |
| writesol.c | H A D | 01-Apr-2020 | 11.9 KiB | 538 | 492 |
| wrtsol_.c | H A D | 01-Apr-2020 | 2.4 KiB | 93 | 64 |
| ws_desc.c | H A D | 01-Apr-2020 | 214 | 7 | 6 |
| wsu_desc.c | H A D | 01-Apr-2020 | 170 | 6 | 5 |
| x2check.c | H A D | 01-Apr-2020 | 2.2 KiB | 90 | 67 |
| xectim.c | H A D | 01-Apr-2020 | 3.6 KiB | 150 | 102 |
| xp1known.c | H A D | 01-Apr-2020 | 3.5 KiB | 151 | 121 |
| xp2known.c | H A D | 01-Apr-2020 | 6.2 KiB | 287 | 252 |
| xsum0.out | H A D | 01-Apr-2020 | 3.4 KiB | 145 | 144 |
README
1This directory contains source for a library of routines that help
2solvers work with AMPL. In this README file, the library is called
3amplsolver.a (the name it usually has on Unix systems), but on some
4systems it may have another name, such as amplsolv.lib on Microsoft
5systems. Services provided by amplsolver.a include reading AMPL's
6generic output (.nl) files, and writing solution (.sol) files. On
7netlib, subdirectories (e.g., cplex, examples, minos) contain
8interface routines for particular solvers; you may wish to modify
9these routines to make your own solver work with AMPL.
10
11To make an executable version of a particular solver, you need
12at least this directory and the solver's subdirectory. You need
13to invoke "make" once in this directory to create amplsolver.a,
14and then invoke "make" in each solver subdirectory of interest.
15The exact form of the "make" command depends on the system you
16are using. There is more discussion about "make" and makefiles
17below.
18
19Some installations have several kinds of computers, with various
20hardware and operating systems, and with cross-mounted file systems
21visible from the various computers. On such systems, the "configure"
22script may be helpful. It arranges to compile amplsolver.a in
23system-specific subdirectories with names that, unless otherwise
24specified, begin with "sys." and by default are determined by the
25Bourne-shell syntax
26
27 sys.`uname -m`.`uname -s`
28
29Invoking
30
31 ./configure
32
33creates a sys.* directory for the current system and adds a
34generic makefile, such that invoking "make" will give the
35same result as
36
37 cd sys.`uname -m`.`uname -s`
38 make
39
40(creating amplsolver.a in the system-specific subdirectory).
41
42Alternatively, if you deal with only one kind of hardware and
43Unix- or Linux-like operating system (including Cygwin or MinGW/MSYS
44under MS Windows), you could invoke
45
46 ./configurehere
47
48to arrange for compiling amplsolver.a in this directory. Either
49way (after "./configure" or "./configurehere") you invoke "make"
50to compile amplsolver.a
51
52
53Updates to the source for amplsolver.a appear first in
54
55 http://ampl.com/netlib/solvers
56
57and the current source is generally available in the gzipped tar file
58
59 http://ampl.com/netlib/solvers.tgz
60
61In the course of a week or so, updates should reach netlib servers,
62such as http://www.netlib.org.
63
64For more about AMPL itself, see the AMPL book (second edition):
65
66 "AMPL: A Modeling Language for Mathematical Programming"
67 by Robert M. Fourer, David M. Gay, and Brian W. Kernighan;
68 Duxbury Press / Brooks/Cole Publishing Company, 2002;
69 ISBN 0-534-38809-4
70
71PDF files for individual chapters are freely available from the
72AMPL web site; see http://ampl.com/resources/the-ampl-book/ .
73
74
75For solvers written in Fortran 77, we assume the f2c calling
76conventions. Source for f2c (Fortran-to-C converter) is
77available from netlib.
78
79See README.f77 for a summary of adjustments that permit use of the
80native Fortran 77 compilers on some systems.
81
82For machines with IBM mainframe arithmetic (i.e., the arithmetic
83of the IBM 360 and 370 series and their successors and imitators,
84such as Amdahl), use arith.ibm as arith.h and add rnd_prod.s to
85the end of the "a =" assignment in the makefile. For other systems,
86let the makefile compile and execute arithchk.c to create a
87suitable arith.h. Do not copy arith.h from one kind of computer
88to another.
89
90See the comments in "makefile" about compiling on particular systems.
91
92
93Various solver-specific subdirectories are available from netlib or
94http://ampl.com/netlib, including the following. They provide sample
95AMPL interfaces, but do not include source or objects for the solvers
96themselves (which you must get from the relevant solver vendor, noted
97in the README.1st file in each subdirectory).
98
99 Subdirectory Comments
100
101 bpmpd Research interior LP code by Cs. Meszaros.
102
103 cplex Uses CPLEX Corp.'s solver: linear (simplex and
104 interior algorithms), network, quadratic, and MIP
105 problems.
106
107 donlp2 General nonlinear optimizer by Peter Spellucci.
108 Uses an SQP algorithm and dense linear algebra.
109
110 examples Source for examples in "Hooking Your Solver to AMPL".
111
112 fsqp Based on CFSQP, a nonlinear solver by Craig Lawrence,
113 Jian L. Zhou, and Andre L. Tits.
114
115 funclink Examples and system-specific makefiles for making
116 shared libraries (.dll files) of imported (i.e.,
117 user-defined) functions.
118
119 gurobi Uses Gurobi Optimization's solver: linear (simplex
120 and interior algorithms), network, quadratic, and
121 MIP problems.
122
123 lancelot Based on LANCELOT (by A. R. Conn, Nick Gould, and
124 Ph. L. Toint): general nonlinear programming code
125 using sparse linear algebra.
126
127 loqo Interior code by Robert Vanderbei: for linear and
128 convex quadratic (or convex nonlinear) problems.
129
130 lpsolve Simplex and MIP solver based on lp_solve by
131 Michel Berkelaar (michel@es.ele.tue.nl).
132
133 minos Uses Murtagh & Saunders's code for nonlinear problems;
134 reduces to simplex on linear problems.
135
136 nlc Source for "nlc" program, which emits Fortran or C
137 for computing objectives, constraint bodies, and
138 their gradients.
139
140 npopt New version of npsol (see below), available from
141 Philip Gill to people who have npsol.
142
143 npsol Based on NPSOL (by Gill, Murray, Saunders, Wright),
144 a sequential quadratic programming code for solving
145 nonlinear programming problems.
146
147 path Based on the PATH solver of Prof. Michael C. Ferris
148 and his former students Steven P. Dirkse and Todd S.
149 Munson, for solving "square" nonlinear
150 complementarity problems.
151
152 snopt Sparse nonlinear solver by Philip Gill et al.,
153 available from him to people who have npsol.
154
155 xpress Based on XPRESS-MP, a solver for linear and
156 quadratic programming problems involving continuous
157 or integer variables by Fair Isaac Corporation.
158
159For information about arranging to use other solvers with AMPL,
160see "Hooking Your Solver to AMPL", Postscript for which is
161
162 http://ampl.com/REFS/hooking.ps.gz
163
164and a corresponding html version is
165
166 http://ampl.com/REFS/HOOKING/
167
168Updates to AMPL are reported in
169
170 http://ampl.com/dl/ampl.updates.html
171
172
173This directory contains two makefile variants with names of the
174form makefile.*; makefile.u is for Unix systems and makefile.vc is
175for Microsoft systems. Comments in makefile.u describe adaptions
176for particular Unix systems.
177
178The makefile.vc variant creates "amplsolv.lib" and has comments about
179linking solvers. This variant require you to make details.c by hand
180(since deriving it automatically seems hard to do reliably). The
181details.c file should reflect the compiler you are using. For
182example, for Microsoft Visual C++ 6.0, having details.c consist of the
183single line
184 char sysdetails_ASL[] = "MS VC++ 6.0";
185would be appropriate. This string is used by some solvers as part of
186the output produced for the "version" keyword and the -v command-line
187option.
188
189If you know that your math library never sets errno, adding -DNO_ERRNO
190to the relevant CFLAGS assignment will save a little time and perhaps
191avoid compiler complaints.
192
193When linking nonlinear solvers on some systems, it's necessary to
194add system-dependent keywords to the linking command, e.g., to make
195dlopen() visible. Some of the makefiles for specific solvers have
196comments about this, and on netlib, subdirectory funclink contains
197sample makefiles that illustrate how to do things on for several'
198popular systems.
199
200In general, it is necessary once in this directory to give the
201appropriate "make" invocation, such as
202
203 make
204
205on Unix platforms,
206
207 nmake -f makefile.vc
208
209under MS Windows, and then to give a suitable "make" invocation in
210each solver subdirectory of interest. On non-Unix (non-Linux)
211systems, in many of the solver subdirectories it may be necessary to
212modify the Unix makefile into the form required by the system.
213
214With Microsoft Studio 2017, due to a compiler bug you will need to
215compile avltree.c without optimization. After the "nmake" invocation
216aborts with an error message about an internal error in the compiler,
217invoke
218
219 cl -c -MT avltree.c
220
221and then again invoke
222
223 nmake -f makefile.vc
224
225to continue building the solver-interface library.
226
227A variant of the "solvers" directory is "solvers2", whose source is
228in the gzipped tar file
229
230 http://ampl.com/netlib/solvers2.tgz
231
232which is preferable for use with many nonlinear solvers, because its
233nonlinear evaluations are often faster, and for large problems, its
234internal representation of nonlinear expressions takes less space.
235With suitable call variants involving a thread-specific workspace,
236it also allows parallel nonlinear evaluations. For most nonlinear
237solvers that just use one thread, "solvers2" is a drop-in replacement
238for the "solvers" directory. Solvers that use multiple threads should
239first call fg_read() or pfgh_read() and then invoke
240
241 EvalWorkspace *ew = ewalloc();
242
243(or "ew = asl->p.Ewalloc(asl);") once per thread. Such solvers should
244use the resulting thread-specific ew value in call variants whose
245names end in "_ew" and whose first argument is ew, e.g.,
246"objval(ew,np,x,ne)" rather than "objval(np,x,ne)". The "_ew"
247variants are declared in solvers2/asl.h.
248
249Some solvers, such as ilogcp for constraint programming, need to see
250expression graphs. Such solvers must continue to use "solvers"
251rather than "solvers2".
252
253Solver source can check "#ifdef _ASL_EW_" to determine whether header
254files come from "solvers2" (when the "ifdef" test is true) or
255"solvers". This should only be relevant to solvers that use multiple
256threads. When using the "solvers" directory (rather than "solvers2"),
257for each new thread, such solvers must allocate a new ASL structure,
258use it in a call on the desired .nl reader, and use the thread-specific
259asl value when doing nonlinear evaluations.
260
README.SGI
1SGI machines executing binaries compiled with -n32 or -64 (but not -o32)
2do not do correct IEEE arithmetic: they flush underflows to zero rather
3than underflowing gradually. For many (non-benchmark) computations,
4there are no underflows, so this detail does not matter, but it can
5lead to different computational results when true IEEE arithmetic would
6involve gradual underflow.
7
8There are several ways to work around this bug. The least attractive
9is machine-dependent source code modification: in the source file for
10main(), insert
11
12 #include <sys/fpu.h>
13
14and at the start of main(), insert
15
16 union fpc_csr f;
17 f.fc_word = get_fpc_csr();
18 f.fc_struct.flush = 0;
19 set_fpc_csr(f.fc_word);
20
21A more portable approach, not requiring changes to source code or
22makefiles, is to put a suitable "cc" shell script into a directory in
23$PATH (ahead of the directory containing SGI's "cc") to cause binaries
24to be linked as described in the following messages. For example,
25for -64 C compilation, I might have a "cc" in my bin consisting of
26
27 #!/bin/sh
28 exec /bin/cc -64 -L/usr/dmg/lib/64 -Wl,-init,__zap_fz_bit /usr/dmg/lib/64/zapfzbit.o "$@"
29
30with zapfzbit.o compiled from
31
32 /* Clear FPCSR_FLUSH_ZERO bit on SGI machines -- see mbox./98/bean */
33 /* Load with cc -Wl,-init,__zap_fz_bit */
34
35 #include <sys/fpu.h>
36 #include <sys/syssgi.h>
37
38 void
39 __zap_fz_bit(void)
40 {
41 union fpc_csr f;
42
43 f.fc_word = get_fpc_csr();
44 f.fc_struct.flush = 0;
45 set_fpc_csr ( f.fc_word );
46 }
47
48For C++, something more complicated is required, as seen in the
49following messages...
50
51From bean@sgi.com Thu Oct 22 16:41:06 1998
52From: bean anderson <bean@sgi.com>
53To: dmg@bell-labs.com, cbm@research.bell-labs.com
54Subject: FPCSR_FLUSH_ZERO
55
56Hi David,
57
58It was a pleasure talking with you today. I've written
59up what we talked about and I hope it will meet your needs.
60Again, don't hesitate to call me directly if you have
61any problems with it.
62
63I've attached three files:
64
65 ieee.c -- The source code for setting processor state.
66 bug.c -- Simple test case.
67 Makefile -- Build and test
68
69A discussion of how to use this mechanism and what the
70performance costs might be are included in comments
71in the file "ieee.c". And, if it should be necessary,
72the engineering bug report number is PV 628694.
73
74-bean
75
76[ Bean Anderson, bean@sgi.com, 650-933-4107 ]
77
78begin 644 t.tar.gz
79M'XL(`%&=+S8``^U72V_;1A!6TDO(2WK,<9(T@!Q(-&7+<I!'D4?E5$#<&+;[
80M.`0@:&HH;4/N"KM+RW+JMG^@0']"D;;W'E*@Q]S:0POT7[3H(9?^@<Z2U(.*
81M$Q\:I6C+#[:7WIW'-S,[RZ5>KBP<KNNNKZV!&1O-;'17FMF8`]Q6J[&ZWF@U
82MU^FY07`KL+9X:I5*HK0OB4HW[IT@A_)EZWD<D_%?`KV\Z3_$D$6X.!^4CU:S
83M^>+Z-]8:D_HWFNM4_Y6U9JL"[N(H3?$_K__%\Z!BV@&VK5%IZRKL)3W;<I;-
84M8-.?;,81P!#1$;85!%`7\-9-J'\8U>J,,UWSO(WW[]WS.NUVV[NUW=E]=[.]
85MV[E3T`-[ZO+-LU__TJR<KHC/*I53,U1.G7WRM)H*G/ZT2;_G)@JGCWXPX]GO
86M/_@YDYRLC,<SN=QW^<0;J?SC/W0Z/OGUIW3\]O:7+TC#C[/_3.0?__ZTZ*=R
87M)J=Z,_/WQ=."7NYOROM1QON;[3&OS_,1YOQ#IO_;>,OG\7SR53;_Y\V,U[-J
88MD>>S/%^C<\?YGZX?G#M.WT";2CO!_/0KQ4G]WVPUY_O?72W[_[7@(N-!E'01
89MKBO=9<+IOVW;79'L10@'<`,:6%]UW1J,S+,S>5UGT]=L._89K^X+UEVR']F0
90M(]<_I/7QU"'I'T`=1M<F4P/)N`ZK%XR;2TYCI?>`CZ:/%VIP0&Z7IO(LA"K)
91MWJ!)F/J:M[:32'I4>!X@$SY/MF:L'`%&"E]B(&59X'$XJV[;1_9_J__3`WJA
92M!\`)_;_:6F_-]_^*ZY;]_SJP?!ELN%Q_E2![L-&YU[Z:O?N#!=BG'^MNXDN?
93M:T0P%P_8P[Z_SX2$(=-]D*@&&&C0`KK(A8S]B!UB%W@2[Z%4CC&P`%Z6.0K!
94M\Q1J+U3>'M.>%IX+U:6<M'4G0E\JV-@!6@3&(8R$KQGOP4#0`02!X%J*"&A7
95MZD11'#VF-$IGK/_>_5U*+.SVF8)0R``5^'1NSED1`Y3TO^`*4BW=]RD7=,W+
96MLT%*BIP/$A*5$+->7T,/N5'"5&$L)CB(1!LYRJ26_H"TS%,?X2%*CA$,^R@Q
97M=X*TJK1,`N,:B"'&240FNQ/Z[Z1VC1'DBNTCQ4OOGB&+(L`#(LV0!P@^*-;C
98M+&0!%3C5BX0B,B&02&BJ25)CF[,I'W@#B0$=_S,9WTZXR7.^4,>#``<IO]BX
99MKFY?,>TJ>#1:<@`*:;8HS0B90-\D+!Y;GTOWQ&:VL:S;&/AT7AC")O,U,*56
100MP(4F!:68>3N.\TE$9G=HJI^6CW<5$>I0`607I9$W)@N[>2P'0X28#K*L#(DD
101MG;"0JRQ6$@59R`84LY&Q3__<YU2%-/0:Q4#DTQIUI1]3X($?12-0D1C2NWY(
102MDK0T24FJ/M[,7:RE87],[&!N@ZBL50L1/1>^SAQ3;R,9`@Q#T]9F6Y(U"9N=
103MK1T*1E`?*)'WM65>U#,[X[B/DU3.A$&=L"?(MAX*D+35&4>5[ZQ7?CBT/[JU
104MN67.1:KJOJ!F#!.>M8J?:#%-+/4JA=2C7(/YO@+-8G1@LCDO`7V#62D>I''0
105M]U@\,AHP,W?2UUDNEW^>S5C+3.5SN;$H6-"!N6R/+Z#6=352R^$@,5?0XB3]
106MJAY+KZ:FI-9QYRO0_=-*N$EF.`B\0$D(Z?YIA4X8>$-J(;K2]=(C(EVLTITN
107M6\NVHQ-&B>J3#%UJ+365@RI,+9#.49%"X;PA`AG3ZL[=CK?3WO4VMKRM[?:=
108MSDZ[UB@H'UN1S,2\Y93I<Q%7,W-_O_[_]/VC1(D2)4J4*%&B1(D2)4J4*%&B
109.1(D2B\-?J5T;9``H````
110`
111end
112
113From dmg Thu Oct 22 17:38:16 1998
114From: "David M. Gay" <dmg@research.bell-labs.com>
115To: bean@sgi.com (bean anderson)
116Subject: FPCSR_FLUSH_ZERO
117
118Thanks for your helpful message. That's a nice way get
119initializations done.
120
121If you could some little functions like __set_fs_bit_to_0 and
122__set_fp_precise into, e.g., libc, then it would be easy to
123add a set of flags to cc to specify various behaviors
124independently. But for now I'm glad to have a simple work-around
125(a suitable "cc" script in PATH) that permits gradual underflow with
12664-bit addressing.
127
128-- dmg
129
130From bean@sgi.com Thu Oct 22 18:03:03 1998
131Sender: bean@sgi.com
132From: bean anderson <bean@sgi.com>
133To: "David M. Gay" <dmg@research.bell-labs.com>
134Subject: FPCSR_FLUSH_ZERO
135
136David,
137
138I was just reminded that for released compilers, C++ already
139uses the -init functionality for static initializers/constructors,
140so these mechanisms may interfere with each other. [ This is
141because the linker can handle at most one -init function. ]
142
143As of 7.3, the linker will accept multiple -init entries
144and it plays well with c++ static initializers. [The 7.3
145compiler release is in test right now and is scheduled for
146release in March '99]
147
148In the mean time, as long as you are not using static
149constructors in C++, there should be no problem.
150
151-bean
152
153------------
154
155p.s. Here is an alternate way to deal with this if
156 c++ static constructors become a problem.
157
158Another way to deal with this is to recognize that the .init
159section exists in each a.out and each DSO (dynamic library) so
160as each executable file gets loaded by the dynamic loader,
161it's associated .init section get's run.
162
163In the worst case scenario, you could put the ieee.o
164file into it's own dynamic library. Here is an
165example (assuming it is a -64 compile):
166
167 % ld -64 -shared -o libieee.so -soname libieee.so \
168 ieee.o -init __FULL_IEEE_ARITHMETIC
169
170 % CC -64 -o myprog ... -L. -lieee ...
171
172
173There are two ways to "find" this library at run time.
174
175 (1) Copy it to one of the standard locations in
176 which the runtime loader (RLD) always looks
177 for requested dynamic libraries:
178
179 % cp libieee.so /usr/lib64/internal
180 or
181 % cp libieee.so /opt/lib64
182
183 % myprog
184
185
186 (2) Set an environment variable to tell the runtime
187 loader (RLD) where else search:
188
189 % setenv LD_LIBRARY_PATH my-library-directory
190 % myprog
191
192From dmg Fri Oct 23 23:31:58 1998
193To: bean@sgi.com (bean anderson)
194Subject: FPCSR_FLUSH_ZERO
195
196Thanks for the second message you sent yesterday (about C++
197and using dynamic libraries). I had assumed that one could
198have multiple -init functions and am glad to hear that will
199eventually be possible.
200
201-- dmg
202
203
README.f77
1The following changes (to solvers/makefile and solvers/*/makefile)
2may permit use of the native Fortran 77 compiler on some systems.
3On other systems, you may be able to discover suitable changes by
4studying system documents (including man pages), and by using the nm
5command to look at the names in relevant libraries. Often the
6compiler flags "-v -v" (two -v's) will cause the compiler to tell
7you what libraries it references; if, say, /usr/lib/libF77.a is
8among them, you could try thing like
9
10 nm /usr/lib/libF77.a | grep -i arg
11
12to get a hint at the system's variant (if any) of xargv.
13
14If you make the changes shown below, also remove -lf2c from
15solvers/*/makefile. In other words, if you use the native Fortran
16compiler, do not link against libf2c.a.
17
18
19Sun SunOS:
20 CFLAGS = -O -DKR_headers -DMAIN__=MAIN_ -Dxargv=_xargv
21
22
23Sun Solaris:
24 CFLAGS = -O -DMAIN__=main_ -Dxargv=__xargv
25 For solvers defining MAIN__, add fmain.o built
26 from fmain.f consisting of the two lines
27 call main
28 end
29
30
31HP:
32 CFLAGS = -Aa -O
33 FFLAGS = +ppu
34 For solvers defining MAIN__, add fmain.o built
35 from fmain.c consisting of the following:
36
37 char **xargv;
38 extern void MAIN__(void);
39 main(int argc, char **argv)
40 {
41 xargv = argv;
42 MAIN__();
43 return 0;
44 }
45
46
47IBM RS6000:
48 CFLAGS = -O -Dxargv=p_xargv -DMAIN__=main_
49 FFLAGS = -qextname
50 For solvers defining MAIN__, add fmain.o built
51 from fmain.f consisting of the two lines
52 call main
53 end
54
55
56SGI IRIX:
57 CFLAGS = -O -Dxargv=f77argv
58
59
60DEC OSF1 (Unix for Alpha chip):
61 CFLAGS = -O -Dxargv=for__a_argv
62
63Linux (with g77):
64 CFLAGS = -O -Dxargv=f__xargv
65
66Linux (with gfortran):
67 CFLAGS = -O
68 For solvers defining MAIN__, supply fmain.o as for HP above.
69 For solvers (e.g., snopt) that reference etime_(), append
70
71 extern double xectim_();
72 float etime_(float *tarray) { return (float) xectim_(); }
73
74 to fmain.c (source for fmain.o; see HP above).
75
README.suf
1Unfortunately, we have not yet had time to update "Hooking Your Solver
2to AMPL" to explain facilities we added a few years ago for exchanging
3suffixes with AMPL. Use of these facilities from a user's perspective
4are described in chapter 14 of the second edition of the AMPL book,
5with older descriptions appearing in
6
7 http://www.ampl.com/NEW/statuses.html
8and
9 http://www.ampl.com/NEW/suffixes.html
10
11If your solver deals with a basis, it would be good if your driver
12could accept an incoming basis and return an optimal basis. The
13process is fairly straightforward. You declare
14
15 static SufDecl
16 suftab[] = {
17 { "sstatus", 0, ASL_Sufkind_var, 1 },
18 { "sstatus", 0, ASL_Sufkind_con, 1 }
19 };
20
21Before calling the .nl reader, you invoke
22
23 suf_declare(suftab, sizeof(suftab)/sizeof(SufDecl));
24
25to tell the reader to save the incoming .sstatus values. If you were
26interested in other incoming or outgoing suffix values, you would also
27include lines for them in suftab. See, for example,
28/netlib/ampl/solvers/cplex/cplex.c or /netlib/ampl/solvers/osl/osl.c .
29
30To access an incoming suffix array (after calling the .nl reader,
31which reads them), say an array of priorities on variables, declare
32
33 SufDesc *dp;
34
35and invoke
36
37 dp = suf_get("priority", ASL_Sufkind_var);
38
39suf_get returns a pointer to a SufDesc (which is declared in asl.h);
40the second argument indicates the kind of entity to which the suffix
41pertains: variable, constraints, objective, or problem.
42
43If you wanted to see integer values for the suffix, then dp->u.i is
44the array of suffix values; otherwise dp->u.r is the array of (real)
45suffix values.
46
47To return .sstatus values (i.e., a basis), you call suf_iput
48twice, once for constraint.sstatus and once for variable.sstatus.
49It's probably simplest to proceed as in /netlib/ampl/solvers/minos/m55.c:
50having declared
51
52 int *varstat;
53 SufDesc *csd, *vsd;
54
55and having computed NB = M + N, where M >= n_con and N >= n_var are the
56numbers of constraints and variables (possibly adjusted, depending on the
57needs of your solver -- for example, some solvers require adding an
58extra variable and possibly an extra constraint to add a constant term
59to the objective values that they report if they're asked to print
60progress lines during their solution process), you allocate storage
61for the .sstatus values by (something equivalent to)
62
63 varstat = (int*)M1alloc(NB*sizeof(int));
64 vsd = suf_iput("sstatus", ASL_Sufkind_var, varstat);
65 csd = suf_iput("sstatus", ASL_Sufkind_con, varstat + N);
66
67before invoking the .nl reader. After calling the reader, deal
68appropriately with the incoming .sstatus values, if present:
69
70 if (vsd->kind & ASL_Sufkind_input)
71
72then you have incoming variable.sstatus values in array varstat
73(the third argument to suf_iput); similarly,
74
75 if (csd->kind & ASL_Sufkind_input)
76
77then you have incoming constraint.sstatus values (which, in the
78above example, are in varstat+N, though you might wish to give
79a separate name to this array). The values are encoded as in
80the first column of AMPL's default $sstatus_table:
81
82 0 none no status assigned
83 1 bas basic
84 2 sup superbasic
85 3 low nonbasic <= (normally =) lower bound
86 4 upp nonbasic >= (normally =) upper bound
87 5 equ nonbasic at equal lower and upper bounds
88 6 btw nonbasic between bounds
89
90After solving the problem and before calling write_sol (which will
91transmit the suffix arrays mentioned in previous suf_iput and, for
92real, i.e., double, values, suf_rput calls), translate your basis
93information to values in the outgoing status arrays that accord with
94the above table.
95
96For returning real (floating-point) suffix values, call suf_rput
97rather than suf_iput. Examples (for sensitivity information, i.e.,
98suffixes .up, .current, and .down) appear in the cplex.c and osl.c
99files mentioned above.
100
101Another detail not yet documented in "Hooking Your Solver..." is that
102you should assign a solve_result_num value to indicate success,
103failure, iteration limit, etc. before calling write_sol. This is
104an integer value in one of the ranges indicated by AMPL's default
105$solve_result_table:
106
107 0 solved
108 100 solved?
109 200 infeasible
110 300 unbounded
111 400 limit
112 500 failure
113
114For successful solves, solve_result_num should thus be an integer
115in [0,99]. If the problem might be solved, but tolerances may have
116been too tight to satisfy all stopping tests, assign an integer in
117[100,199], etc. -- any value >= 500 indicates failure (such as
118insufficient memory). Then AMPL's symbolic solve_result will be
119assigned one of the values in the second column of the above table,
120and scripts that need more detail can base tests on solve_result_num.
121
122Many of the sample solver interfaces appearing in subdirectories
123of netlib's ampl/solvers directory make use of suffixes and supply
124solve_result_num.
125