FRIBParallelanalysis
1.0
FrameworkforMPIParalleldataanalysisatFRIB
|
This section describes how to build your application and how to run it.
The exact recipes for compiling an FRIB raw to parameter application depend on where the libraries are installed. At the FRIB they will normally be installed at /usr/opt/fribanalysis/major.minor-edit
where the major.minor-edit
directory identifies a deployed version of the library. major
is the majore version number, minor
is the minor version number and edit
a three digit edit level (edit levels normally are used for minor changes such as bugfixes).
For example:
/usr/opt/fribanalysis/1.0-003
is an installation of major version 1
, minor version 0
edit level 003
.
In our recipes we'll assume that you have defined the following symbols in your Makefile:
BASEDIR
- the base of the installation directory treeINCDIR
- as $BASEDIR/include
the headers directory.LIBDIR
- as $BASEDIR/lib
the library directory.For example:
These definitions in your Makefile allow you to easily move to a new library version and keep rules concise.
Makefiles support default compilation rules. These rules, in turn, can be tailored to support user supplied options. The following definition help support the default rules that turn a C++ source program into an object:
``` CPPFLAGS=-I ``
If I now have a source file called myapp.cpp My Makefile can have the rule:
and Make will supply a default rule that looks something like this:
Which in turn will expand to:
which will properly build my file. Naturally you may need other flags on your CPPFLAGS
definition depending on the contents of your files.
To link your application you will need to define link flags that:
Here's an example of a definition of LDFLAGS
which provides all of these for a program that only depends on the FRIB analysis framework libraries:
Note that if you are not using the SpecTclWorker
or classes derived from them to support SpecTcl event processing pipelines you may not need -lSpecTclFramework
Finally, let's look at a sample Makefile. We have the following sources that need to be compiled:
Worker.h
is assumed to be a header that defines the classe implemented in Worker.cpp
:
Note the use of default compilation rules for the C++ files to generate their objects. The special macro $^
means all of the dependencies (in this case it expands to main.o Worker.o
).
Since the FRIB analysis pipeline framwework builds MPI Parallel applications they cannot be run directly. Instead the mpirun command must be used from the directory against which the application framework was built.
How do we know where that is? When the analysis framework is built/installed, it writes a filenamed VERSION
at the top level of its installation diectory. Here are sample contents of this file:
Note that the second line of this file tells you which mpirunto use: /usr/opt/mpi/openmpi-4.0.1/bin/mpirun
mpirun must be given several command parameters:
For example, suppose we are running myprogram
with 10 workers and our input file is run-0000-00.evt which we want to produce the output file run-0000-00.pars and we're using the parameter definition file paramdef.tcl - and our application uses the default filename getters in the dealer and outputter and gets the parameter definition file from the fourth command word:
will do the job. mpirun has additional parameters including those which can distribute the application across several hosts. Normally, if you run on a cluster, however, this distribution will usually be handled by the job manager in parallel clusters.