Previous Up Next

Chapter 2  The BSML Scripts

2.1  Compilation (bsmlc and bsmlopt)

bsmlc.mpi, bsmlc.seq, and bsml.tcp are scripts that calls the Objective Caml batch compiler ocamlc, which compiles Caml source files to bytecode object files and link these object files to produce standalone bytecode executable files with arguments to use the BSML library :

bsmlc is a more general script. For exameple bsmlc -seq is equivalent to bsmlc.seq. Other flags are -mpi and -tcp.

Parallel versions of the programs shoud be run with the scripts bsmlrun.mpi or bsmlrun.tcp, or the general script bsmlrun.

The bsmlrun.mpi script has the same options as the mpirun program you are using. The bsmlrun.tcp script looks for a .bsmlnodes file in your home directory. This file should contain the list of the names (or IP addresses) of the machines in your cluster. Another file could be given using the -nodes option.

When you run a program which uses the BSML library, the machine’s BSP parameters are read from the file $HOME/.bsmlrc. Entries in this file are of the form

number_of_procs,g_parameter,l_parameter,r_parameter

g_parameter, l_parameter and r_parameter must be written as caml float ie, 1 is written 1. or 1.0. The sequential version of the library reads the first line of the file, the parallel version reads the line which correspond to the number of processor available on your machine.

See also the ocamlc command and the mprun command.

bsmlopt.mpi, bsmlopt.tcp and bsmlopt.seq produce respectively parallel and sequential native code if the ocamlopt compiler is present on your machine. There also exists a more general bsmlopt script.

See also the ocamlopt command.

2.2  The toplevel system (bsml)

bsml permits interactive use of the Objective Caml system with the BSML library through a read-eval-print loop. In this mode, the system repeatedly reads Caml phrases from the input, then typechecks, compiles and evaluates them, then prints the inferred type and result value, if any. The system prints a # (sharp) prompt before reading each phrase. The evaluation is done sequentially. If you use the pure functional subset of Ocaml the result will be exactly the same as in the parallel case (Even if you use imperative features the result may be the same).

See also the ocaml command.


Previous Up Next