Launching the OOMMF host server: launchhost
Keywords: userguide

Next: Calculating H Fields from Up: Command Line Utilities Previous: Last Oxsii/Boxsi run: lastjob

##
Launching the OOMMF host server: launchhost

Under normal circumstances, the OOMMF host server (also known as the host service directory) is automatically launched in the background as needed by client applications. However, it can be useful, primarily in batch compute environments, to launch the host server explicitly in order to control the host server port address.

Launching
The launchhost command line is:

    tclsh oommf.tcl launchhost [standard options] port

where

`port`
  Requested port number for host server to listen on. For non-privileged users, this usually has to be larger than 1024, or the special value 0 which signals the host server to open on a random, unused port. On success, launchhost writes the host port number actually used to stdout.

As described in the OOMMF architecture documentation, the host server (host service directory) plays a vital role in allowing various OOMMF applications to communicate with one another. To work, the host server port number must be known to all OOMMF applications. Typically this port number is determined by the `Net_Host port` setting in the file `oommf/config/options.tcl`, although this setting may be overridden by the environment variable `OOMMF_HOSTPORT`.

In batch-mode settings, however, it can occur that one wants to run multiple concurrent but independent OOMMF sessions on a single machine. One way to accomplish this is to set the environment variable `OOMMF_HOSTPORT` to distinct values in each session. A difficulty here is the bookkeeping necessary to insure that each session really gets a distinct value. Using launchhost with `port` set to zero provides a straightforward solution to this problem. For example, consider the Bourne shell script:

       #!/bin/sh
       OOMMF_HOSTPORT=`tclsh oommf.tcl launchhost 0`
       export OOMMF_HOSTPORT
       tclsh oommf.tcl mmArchive
       tclsh oommf.tcl boxsi sample.mif
       tclsh oommf.tcl killoommf all

The second line (`OOMMF_HOSTPORT=...`) launches the host server on a random port; the port selected is printed to stdout by launchhost and sets the environment variable `OOMMF_HOSTPORT`. (Note in particular the backticks around the launchhost command, which invoke command execution.) The subsequent commands launch an instance of mmArchive in the background, and run boxsi on the problem described by `sample.mif`. (By default, boxsi runs in the foreground.) When boxsi returns, the killoommf command is used to terminate all OOMMF processes in this session. (Alternatively, the boxsi command option `-kill` may be used to the same effect as killoommf.) For csh and derivatives, use

       setenv OOMMF_HOSTPORT `tclsh oommf.tcl launchhost 0`

in place of the two `OOMMF_HOSTPORT` commands in the above example.

OOMMF Documentation Team
September 29, 2018