AD tools integration with NEOS
From Autodiff
Contents |
Setup
All parts are installed by neosotc in its home directory. We assume the following directory structure:
- the solvers/scripts :
/home/neosotc/neos_AD_solvers
from the mercurial repository clone with
hg clone /mcs/mercurial/ad/neos_AD_solvers - tools and libraries used by the solvers in:
/home/neosotc/neos_AD_solvers_Extras
To differentiate tools and libraries for different OS/CPU/compiler combinations we use
like
setenv INST_ARCH linux_i686_gnu
to name subdirectories, libraries etc.
There are environment variable set up by SolverDriver.py as follows.
os.environ['NEOS_OS'] = 'linux' # for now there are no other architectures in use
os.environ['NEOS_MACH'] = os.popen("uname -m").read().rstrip()
os.environ['NEOS_COMP'] = 'gnu' # here one could distinguish different compilers
Like this string in the examples below all version numbers etc are given in green and may have to be changed in other installations.
Miscellaneous Shared Utilities
Under neos_AD_solvers/shared_lib are a number of source files to make a library of shared utility methods. It is created by running
make
in that directory, the INST_ARCH environment variable has to be set as specified above.
Solvers
Overview
| ADIC | Adol-C | user supplied gradient in C | ADIFOR | OpenAD | driver for partially separable input | user supplied gradient in Fortran | |
|---|---|---|---|---|---|---|---|
| NMTR | Y | Y | Y | Y | Y | only Adifor | Y |
| BLMVM | Y | Y | Y | Y | Y | only Adifor | Y |
| TRON | Y |
NMTR
Sources for the solver are included in the neos_AD_solvers repository
BLMVM
The sources for the actual solver come from TAO/PETSc; see below.
TRON
The sources for the TRON solver are included in the neos_AD_solvers repository
and are a copy of the TRON tar file given as version 1.2, except that we use the system installed BLAS instead of the
ones bundled with the TRON sources.
To build the TRON libraries one has to
setenv ARCH ${INST_ARCH}
and in neos_AD_solvers/TRON run
make
External Tools and Libraries
Below paths may be given relativ to /home/neosotc/neos_AD_solvers_Extras
ADIC
The ADIC version we use is installed under /home/derivs. The exact path is specified in AD_tools.py under
os.environ['ADIC'] = ...
To build the NMTR sources one needs to
setenv ADIC /home/derivs/adic-1.2.0
ADIFOR
The ADIFOR version we use is installed at /home/derivs/ADIFOR2.0E. There is no 64-bit compiled version of the ADIFOR front-end and therefore we cannot run the Fortran solver version on a 64-bit machine.
Adol-C
Unpack Adol-C and in the source directory configure it as follows.
setenv ADOLC_VER 1.10.2
./configure --prefix=/home/neosotc/neos_AD_solvers_Extras/adolc-${ADOLC_VER}_${INST_ARCH}
and run
make install
The path to the installation is used in Makefiles etc by way of the environment variable ADOLC_DIR
which is hard coded at os.environ['ADOLC_DIR'] = ... in AD_tools.py.
Adol-C Preprocessor
Obtain the sources with
hg clone /mcs/mercurial/ad/ADOLCpp ADOLCpp_${INST_ARCH}
set the environment for make step to point to the the Adol-C installation
setenv ADOLC_DIR /home/neosotc/neos_AD_solvers_Extras/adolc-${ADOLC_VER}_${INST_ARCH}
and in the source directory cloned as ADOLCpp_${INST_ARCH} run
make
which makes the preprocessor and runs a sanity test.
The path to the preprocessor is hard coded as ADOLCpp_DIR = ... in AD_tools.py.
OpenAD
Unpack the OpenAD sources into a directory
OpenAD_${INST_ARCH}
and build the sources as described on the OpenAD webpage. The path is hard coded in AD_tools.py as
os.environ['OPENADROOT'] = ....
Solver Specific
For NMTR
The solver uses the BLAS and LAPACK libraries for which we reference the system installation in /usr/lib. This setting can be be changed in driver.py at
os.environ['BLAS'] = ... os.environ['LAPACK'] = ...
The solver sources are built by going to NMTR/src. Various environment variables are needed to build the sources and their values are suggested in the respective sections on this page.
For BLMVM
PETSc
Get PETSc sources, unpack it, set the environment
setenv PETSC_VER 2.3.3-p13
setenv PETSC_DIR /home/neosotc/neos_AD_solvers_Extras/petsc-${PETSC_VER}
setenv PETSC_ARCH ${INST_ARCH}
In the source directory configure it with
config/configure.py --with-cc=gcc --with-fc=gfortran --download-mpich=1 --with-shared --with-fortran --with-clanguage=C++ --PETSC_ARCH=${INST_ARCH}
and run
make all
The script BLMVM/script/driver.py sets the path as os.environ["PETSC_DIR"] = ....
The PETSc installation as configured includes its own version of mpich but in
any case one needs to extend the PATH
to include the mpich binaries as done with the following example in the same driver.py file.
os.environ['PATH'] = os.environ['PATH']+":"+os.environ['PETSC_DIR']+"/externalpackages/mpich2-1.0.5p4/"+os.environ['PETSC_ARCH']+"/bin"
TAO
Get TAO sources, unpack it, set the environment
setenv PETSC_DIR /home/neosotc/neos_AD_solvers_Extras/petsc-${PETSC_VER}
setenv PETSC_ARCH ${INST_ARCH}
setenv TAO_VER 1.9
setenv TAO_DIR /home/neosotc/neos_AD_solvers_Extras/tao-${TAO_VER}
and run
make all
The script BLMVM/script/driver.py sets the path as os.environ["TAO_DIR"] = ....
Registering a Solver and Examples
The following description only applies to solvers running at MCS neos servers. Log in with the neos user id. The solver is described (per input format) as an XML file found under ~/neos_AD_solvers/<solver>/script/<scriptName>.xml To register the solver for the test server use
<neos:category>test</neos:category>
Otherwise replace "test" with the proper solver category. The same applies to the examples registered for a given solver (see below).
At the bottom of the XML file all machines are listed on which this solver may run.
On each of these
machines the NEOS solver daemon (found in ~/neos-5/SolverTools/SolverDaemon.py) must be running.
Each solver has to be associated with a top level driver file. The associations are made by entries listed under DRIVER_FILE in the NEOS server configuration file found in ~/neos-5/SolverTools/config.py. Currently this driver file is called ~/neos-5-solvers/mcs_driver_list.
Add an entry for each solver in the DRIVER_FILE.
Register the solver by running
~/neos-5/SolverTools/register.py ~/neos_AD_solvers/<solver>/script/<scriptName>.xml
Examples are described in a similar fashion as the solvers by XML files found under ~/neos_AD_solvers/<solver>/script/examples/<exampleName>.xml.
The examples can be registered as follows.
~/neos-5/SolverTools/registerExample.py ~/neos_AD_solvers/<solver>/script/examples/<exampleName>.xml <solverPassword>
