doc-src/System/Thy/Sessions.thy
author wenzelm
Sat Jul 28 15:21:49 2012 +0200 (2012-07-28)
changeset 48578 21361b6189a6
child 48579 0b95a13ed90a
permissions -rw-r--r--
some description of isabelle build;
wenzelm@48578
     1
theory Sessions
wenzelm@48578
     2
imports Base
wenzelm@48578
     3
begin
wenzelm@48578
     4
wenzelm@48578
     5
chapter {* Isabelle sessions and build management *}
wenzelm@48578
     6
wenzelm@48578
     7
text {* FIXME *}
wenzelm@48578
     8
wenzelm@48578
     9
section {* Session ROOT specifications \label{sec:session-root} *}
wenzelm@48578
    10
wenzelm@48578
    11
text {* FIXME *}
wenzelm@48578
    12
wenzelm@48578
    13
wenzelm@48578
    14
section {* System build options \label{sec:system-options} *}
wenzelm@48578
    15
wenzelm@48578
    16
text {* FIXME *}
wenzelm@48578
    17
wenzelm@48578
    18
wenzelm@48578
    19
section {* Invoking the build process \label{sec:tool-build} *}
wenzelm@48578
    20
wenzelm@48578
    21
text {* The @{tool_def build} utility invokes the build process for
wenzelm@48578
    22
  Isabelle sessions.  It manages dependencies between sessions,
wenzelm@48578
    23
  related sources of theories and auxiliary files, and target heap
wenzelm@48578
    24
  images.  Accordingly, it runs instances of the prover process with
wenzelm@48578
    25
  optional document preparation.  Its command-line usage
wenzelm@48578
    26
  is:\footnote{Isabelle/Scala provides the same functionality via
wenzelm@48578
    27
  \texttt{isabelle.Build.build}.}
wenzelm@48578
    28
\begin{ttbox} Usage: isabelle build [OPTIONS] [SESSIONS ...]
wenzelm@48578
    29
wenzelm@48578
    30
  Options are:
wenzelm@48578
    31
    -a           select all sessions
wenzelm@48578
    32
    -b           build heap images
wenzelm@48578
    33
    -d DIR       include session directory with ROOT file
wenzelm@48578
    34
    -g NAME      select session group NAME
wenzelm@48578
    35
    -j INT       maximum number of parallel jobs (default 1)
wenzelm@48578
    36
    -n           no build -- test dependencies only
wenzelm@48578
    37
    -o OPTION    override session configuration OPTION
wenzelm@48578
    38
                 (via NAME=VAL or NAME)
wenzelm@48578
    39
    -s           system build mode: produce output in ISABELLE_HOME
wenzelm@48578
    40
    -v           verbose
wenzelm@48578
    41
wenzelm@48578
    42
  Build and manage Isabelle sessions, depending on implicit
wenzelm@48578
    43
  ISABELLE_BUILD_OPTIONS="..."
wenzelm@48578
    44
wenzelm@48578
    45
  ML_PLATFORM="..."
wenzelm@48578
    46
  ML_HOME="..."
wenzelm@48578
    47
  ML_SYSTEM="..."
wenzelm@48578
    48
  ML_OPTIONS="..."
wenzelm@48578
    49
\end{ttbox}
wenzelm@48578
    50
wenzelm@48578
    51
  \medskip Isabelle sessions are defined via session ROOT files as
wenzelm@48578
    52
  described in (\secref{sec:session-root}).  The totality of sessions
wenzelm@48578
    53
  is determined by collecting such specifications from all Isabelle
wenzelm@48578
    54
  component directories (\secref{sec:components}), augmented by more
wenzelm@48578
    55
  directories given via options @{verbatim "-d"}~@{text "DIR"} on the
wenzelm@48578
    56
  command line.  Each such directory may contain a session
wenzelm@48578
    57
  \texttt{ROOT} file and an additional catalog file @{verbatim
wenzelm@48578
    58
  "etc/sessions"} with further sub-directories (list of lines).  Note
wenzelm@48578
    59
  that a single \texttt{ROOT} file usually defines many sessions;
wenzelm@48578
    60
  catalogs are are only required for extra scalability and modularity
wenzelm@48578
    61
  of large libraries.
wenzelm@48578
    62
wenzelm@48578
    63
  \medskip The subset of sessions to be managed is selected via
wenzelm@48578
    64
  individual @{text "SESSIONS"} given as command-line arguments, or
wenzelm@48578
    65
  session groups that are specified via one or more options @{verbatim
wenzelm@48578
    66
  "-g"}~@{text "NAME"}.  Option @{verbatim "-a"} selects all sessions.
wenzelm@48578
    67
  The build tool takes the hierarchy of sessions into account: the
wenzelm@48578
    68
  selected set of sessions is completed by including all ancestors
wenzelm@48578
    69
  according to the dependency structure.
wenzelm@48578
    70
wenzelm@48578
    71
  \medskip The build process depends on additional options that are
wenzelm@48578
    72
  passed to the prover session eventually, see also
wenzelm@48578
    73
  (\secref{sec:system-options}).  The settings variable @{setting_ref
wenzelm@48578
    74
  ISABELLE_BUILD_OPTIONS} allows to provide additional defaults.
wenzelm@48578
    75
  Moreover, the environment of system build options may be augmented
wenzelm@48578
    76
  on the command line via @{verbatim "-o"}~@{text "NAME=VALUE"} or
wenzelm@48578
    77
  @{verbatim "-o"}~@{text "NAME"}, which abbreviates @{verbatim
wenzelm@48578
    78
  "-o"}~@{text "NAME=true"} for Boolean options.  Multiple occurrences
wenzelm@48578
    79
  of @{verbatim "-o"} on the command-line are applied in the given
wenzelm@48578
    80
  order.
wenzelm@48578
    81
wenzelm@48578
    82
  \medskip Option @{verbatim "-b"} ensures that heap images are
wenzelm@48578
    83
  produced for all selected sessions.  By default, images are only
wenzelm@48578
    84
  saved for inner nodes of the hierarchy of sessions, as required for
wenzelm@48578
    85
  other sessions to continue later on.
wenzelm@48578
    86
wenzelm@48578
    87
  \medskip Option @{verbatim "-j"} specifies the maximum number of
wenzelm@48578
    88
  parallel build jobs (prover processes).  Note that each process is
wenzelm@48578
    89
  subject to a separate limit of parallel threads, cf.\ system option
wenzelm@48578
    90
  @{system_option_ref threads}.
wenzelm@48578
    91
wenzelm@48578
    92
  \medskip Option @{verbatim "-s"} enables \emph{system mode}, which
wenzelm@48578
    93
  means that resulting heap images and log files are stored in
wenzelm@48578
    94
  @{verbatim "$ISABELLE_HOME/heaps"} instead of the default location
wenzelm@48578
    95
  @{setting ISABELLE_OUTPUT} (which is normally in @{setting
wenzelm@48578
    96
  ISABELLE_HOME_USER}, i.e.\ the user's home directory).
wenzelm@48578
    97
wenzelm@48578
    98
  \medskip Option @{verbatim "-n"} omits the actual build process
wenzelm@48578
    99
  after performing all dependency checks.  The return code indicates
wenzelm@48578
   100
  the status of the set of selected sessions.
wenzelm@48578
   101
wenzelm@48578
   102
  \medskip Option @{verbatim "-v"} enables verbose mode.
wenzelm@48578
   103
*}
wenzelm@48578
   104
wenzelm@48578
   105
subsubsection {* Examples *}
wenzelm@48578
   106
wenzelm@48578
   107
text {*
wenzelm@48578
   108
  Build a specific logic image:
wenzelm@48578
   109
\begin{ttbox}
wenzelm@48578
   110
isabelle build -b HOLCF
wenzelm@48578
   111
\end{ttbox}
wenzelm@48578
   112
wenzelm@48578
   113
  Build the main group of logic images (as determined by the session
wenzelm@48578
   114
  ROOT specifications of the Isabelle distribution):
wenzelm@48578
   115
\begin{ttbox}
wenzelm@48578
   116
isabelle build -b -g main
wenzelm@48578
   117
\end{ttbox}
wenzelm@48578
   118
wenzelm@48578
   119
  Provide a general overview of the status of all Isabelle sessions,
wenzelm@48578
   120
  without building anything:
wenzelm@48578
   121
\begin{ttbox}
wenzelm@48578
   122
isabelle build -a -n -v
wenzelm@48578
   123
\end{ttbox}
wenzelm@48578
   124
wenzelm@48578
   125
  Build all sessions with HTML browser info and PDF document
wenzelm@48578
   126
  preparation:
wenzelm@48578
   127
\begin{ttbox}
wenzelm@48578
   128
isabelle build -a -o browser_info -o document=pdf
wenzelm@48578
   129
\end{ttbox}
wenzelm@48578
   130
wenzelm@48578
   131
  Build all sessions with a maximum of 8 prover processes and 4
wenzelm@48578
   132
  threads each (on a machine with many cores):
wenzelm@48578
   133
wenzelm@48578
   134
\begin{ttbox}
wenzelm@48578
   135
isabelle build -a -j8 -o threads=4
wenzelm@48578
   136
\end{ttbox}
wenzelm@48578
   137
*}
wenzelm@48578
   138
wenzelm@48578
   139
end