Changeset 3015 in Sophya for trunk/SophyaLib/Manual/sophya.tex


Ignore:
Timestamp:
Jul 17, 2006, 10:33:09 AM (19 years ago)
Author:
ansari
Message:

Suite preparation documentation SOPHYA pour V2.0 , Reza 17/07/2006

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Manual/sophya.tex

    r3006 r3015  
    1 \documentclass[twoside,11pt]{article}
     1\documentclass[twoside,10pt]{article}
    22%  Package standard : Utilisation de caracteres accentues, mode francais et graphique
    33\usepackage{url}
     
    215215
    216216\subsection{Directories, environment variables, configuration files}
     217\label{directories}
    217218The environment variable {\bf SOPHYABASE}  is used
    218219to define the path where the Sophya libraries and binaries are installed.
     
    220221\item \$SOPHYABASE/include : Include (.h) files
    221222\item \$SOPHYABASE/lib : Path for the archive libraries (.a)
    222 \item \$SOPHYABASE/slb: Shared library path (.so)
     223\item \$SOPHYABASE/slb: Shared library path (.so or .dylib on Darwin/MacOS)
    223224\item \$SOPHYABASE/exe : Path for binary program files
    224225\end{itemize}
    225226
    226 In order to use the shared libraries, the {\bf LD\_LIBRARY\_PATH} variable
    227 should contain the Sophya shared library path
    228 ({\tt \$SOPHYABASE/slb }).
    229 On Silicon Graphics machines with IRIX64 operating system,
    230 the default SOPHYA configuration correspond to the 64 bit architecture.
    231 The environment variable { \bf LD\_LIBRARY64\_PATH } defines
    232 the shared library path in this case and should contain ({\tt \$SOPHYABASE/slb }.
    233 On IBM machines with AIX, the {\bf LIBPATH} environment variables
    234 contains the shared libraries serach path.
    235 
    236 When using the dynamic load services in SOPHYA ({\tt PDynLinkMgr}
    237 class), in runcxx or (s)piapp applications for example, the shared
    238 library search path must contain the current working directory (
    239 dot . in unix).
    240 
    241 The configure script creates links for external libraries include files in :
    242 \begin{itemize}
    243 \item \$SOPHYABASE/include/FitsIO : c-fitsio library include files
    244 \item \$SOPHYABASE/include/FFTW : FFTW library include files
    245 \item \$SOPHYABASE/include/XAstro : XEphem library include files
    246 \end{itemize}
    247 
    248227The directory { \tt \$SOPHYABASE/include/SophyaConfInfo/ } contains files
    249228describing the installed configuration of SOPHYA software.
    250229
    251230The file { \tt \$SOPHYABASE/include/machdefs.h } contains definitions
    252 (flags, typedef) used in SOPHYA.
     231(flags, typedef) used in SOPHYA, while some more specific flags,
     232are found in  { \tt \$SOPHYABASE/include/sspvflags.h } 
    253233
    254234The file { \tt \$SOPHYABASE/include/sophyamake.inc } contains the
     
    259239
    260240The configure script (BuildMgr/configure) creates the directory tree and the
    261 above files.
     241above files. It also copy (or create symbolic link) for all SOPHYA include
     242files as well as symbolic links for external libraries
     243include files path in {\tt \$SOPHYABASE/include} (FitsIO, FFTW, XAstro \ldots).
     244
     245Object files for each module are grouped in a static archive library
     246by the build procedure (libXXX.a for module
     247XXX, with XXX = BaseTools, TArray, HiStats,  FitsIOServer  \ldots).
     248
     249When shared libraries are build, all stand alone SOPHYA modules
     250are grouped in  {\tt libsophya.so},  {\tt libextsophya.so} contains
     251the interface modules with external libraries {\bf (FitsIOServer, LinAlg \ldots)},
     252while {\bf PI, PIext, PIGcont} modules  are grouped in  {\tt libPI.so}.
     253Alternatively, it is possible to group all modules in a single shared
     254library {\tt libAsophyaextPI.so} (See \ref{build})
     255
     256In order to use the shared libraries, the {\bf LD\_LIBRARY\_PATH} variable
     257should contain the Sophya shared library path
     258({\tt \$SOPHYABASE/slb}).
     259On Silicon Graphics machines with IRIX64 operating system,
     260the default SOPHYA configuration correspond to the 64 bit architecture.
     261The environment variable { \bf LD\_LIBRARY64\_PATH } replace in
     262this case the usual {\bf LD\_LIBRARY\_PATH} variable.
     263On IBM machines with AIX, the {\bf LIBPATH} environment variables
     264contains the shared libraries search path.
     265
     266When using the dynamic load services in SOPHYA ({\tt PDynLinkMgr}
     267class), in runcxx or (s)piapp applications for example, the shared
     268library search path must contain the current working directory (
     269dot . in unix).
    262270
    263271\subsection{the runcxx program}
     
    14441452\section{Module SysTools}
    14451453The {\bf SysTools} module contains classes implementing interface to some
    1446 OS specific services. The class {\bf ResourceUsage} \index{ResourceUsage}
     1454OS specific services, such as thread creation and management, dynamic loading and
     1455resource usage information. For example, yhe class {\bf Periodic} provides the
     1456necessary services needed to implement the execution of a periodic action.
     1457
     1458\subsection{Resource usage (CPU, memory \ldots) }
     1459 The class {\bf ResourceUsage} \index{ResourceUsage}
    14471460and {\bf Timer} {\index{Timer} provides access to information
    14481461about various resource usage (memory, CPU, ...).
    1449 The class {\bf Periodic} provides the necessary services needed to
    1450 implement the execution of a periodic action.
     1462The class {\bf Timer} {\index{time (CPU, elapsed)} and c-functions
     1463{\tt InitTim() , PrtTim(const char * Comm) } can be used to print
     1464the amount of CPU and elapsed time in programs.
     1465
     1466The following sample code illustrates the use of {\bf ResourceUsage} :
     1467\begin{verbatim}
     1468  // How to check resource usage for a given part of the program
     1469  ResourceUsage res;
     1470  // --- Part of the program to be checked : Start
     1471  // ...
     1472  res.Update();
     1473  cout << " Memory size increase (KB):" << res.getDeltaMemorySize() << endl;
     1474  cout << " Resource usage info : \n" << res << endl;
     1475\end{verbatim}
    14511476
    14521477\subsection{Thread management classes}
    14531478A basic interface to POSIX threads \index{thread} is also provided
    1454 through the \index{ZThread} {\bf ZThread}, {\bf ZMutex} and {\bf ZSync}
    1455 classes.
     1479through the \index{threads} {\bf ZThread}, {\bf ZMutex} and {\bf ZSync}
     1480classes. The best way to use thread management classes is by inheriting
     1481from {\bf ZThread} and redefining the {\tt run() } method.
     1482It is also possible to use the default {\tt run() } implementation and associate
     1483a function to perform the action, as in the example below :
     1484\begin{verbatim}
     1485  // The functions to perform computing
     1486  void fun1(void *arg) { }
     1487  void fun2(void *arg) { }
     1488  // ...
     1489  ZThread zt1;
     1490  zt1.setAction(fun1, arg[1]);
     1491  ZThread zt2;
     1492  zt2.setAction(fun2, arg[1]);
     1493  cout << " Starting threads ... " << endl;
     1494  zt1.start();
     1495  zt2.start();
     1496  cout << " Waiting for threads to end ... " << endl; 
     1497  zt1.join();
     1498  zt2.join();
     1499\end{verbatim}
     1500The classes {\bf ZMutex} \index{mutex} and {\bf ZSync} can be used
     1501to perform synchronisation and signaling between threads.
    14561502 
    14571503\subsection{Dynamic linker and C++ compiler classes}
     
    14991545Arithmetic expression evaluation is implemented through the {\bf CExpressionEvaluator}
    15001546and {\bf RPNExpressionEvaluator} classes.
     1547The command language provides variable manipulation through the usual
     1548{\tt \$varname} vector variable and arithmetic expression extensions, as well
     1549as the control and test blocs.
     1550\begin{verbatim}
     1551#include "commander.h"
     1552...
     1553Commander cmd;
     1554char* ss[3] = {"foreach f ( AA bbb CCCC ddddd )", "echo $f" , "end"};
     1555for(int k=0; k<3; k++) {
     1556  string line = ss[k];
     1557  cmd.Interpret(line);
     1558}
     1559\end{verbatim}
    15011560 
    15021561\newpage
     
    15761635
    15771636\newpage
    1578 \section{Module Samba}
     1637\section{Samba and SkyT}
     1638\subsection{Samba}
    15791639\index{Spherical Harmonics}
    15801640\index{SphericalTransformServer}
     
    16021662\end{verbatim}
    16031663
    1604 \newpage
    1605 \section{Module SkyT}
    1606 \index{RadSpectra} \index{SpectralResponse}
     1664\subsection{Module SkyT}
     1665\index{RadSpectra} \index{SpectralResponse} \index
    16071666The SkyT module is composed of two types of classes:
    16081667\begin{itemize}
     
    16391698\newpage
    16401699\section{Module FitsIOServer}
     1700\index{FITS} \index{FitsInFile} \index{FitsOutFile}
     1701This module provides classes for handling file input-output in FITS format using the cfitsio library. Its
     1702design is similar to  the SOPHYA persistence (see Module BaseTools).
     1703Delegate classes or handlers perform the actual read/write from/to fits files.
     1704Compared to the SOPHYA native persistence (PPF format),
     1705FITS format has the advantage of being used extensively, and handled
     1706by a many different software tools. It is a de facto standard in
     1707astronomy and astrophysics.
     1708However, FITS lacks some of the features present in SOPHYA PPF, and although
     1709many SOPHYA objects can be saved in FITS files, FITS persistence has
     1710some limitations. For example, FITS does not currently handle complex arrays.
     1711\par
     1712The class {\bf FitsInOutFile} can be seen as a wrapper class for the cfitsio library functions. 
     1713This class has been introduced in 2005 (V=1.9), when the module has been
     1714extensively  changed. In order to keep backward compatibility, the old fits wrapper
     1715classes ({\bf  FitsFile, FitsInFile, FitsOutFile} has been changed to inherit from
     1716 {\bf FitsInOutFile}.  The use of class FitsFile and specific services of these old classes
     1717 should  be avoided, but FitsInFile, FitsOutFile can be safely considered a specialisation
     1718 of FitsInOutFile for read/input and write/output operations respectively.
     1719 The diagram below shows the class hierarchy for cfitsio wrapper classes.
    16411720\begin{figure}[hbt]
    1642 \dclsbb{FitsFile}{FitsInFile}
    1643 \dclsb{FitsOutFile}
     1721\dclsa{FitsInOutFile}
     1722\dclscc{FitsFile}{FitsInFile}
     1723\dclscc{FitsFile}{FitsOutFile}
    16441724\end{figure}
    1645 \index{FITS} \index{FitsInFile} \index{FitsOutFile}
    1646 This module provides classes for handling file input-output in FITS format using the cfitsio library. It works like the SOPHYA persistence (see Module SysTools), using delegate objects, but its design is simpler. The following example  writes a matrix (see module TArray) and a spherical map (see module SkyMap)  on a FITS file and reads back from FITS file and creates new objects :
     1725%%%%
     1726\par
     1727Handlers classes inheriting from {\bf FitsHandlerInterface} perform write/read operations
     1728for AnyDataObj objects to/from FitsInOutFile streams. The {\bf FitsManager} class provides
     1729top level services for object read/write in FITS files.
     1730In most cases, \\
     1731{\tt FitsInOutFile\& $<<$ } and  {\tt FitsInOutFile\& $>>$ } or  \\
     1732 {\tt FitsOutFile\& $<<$ } and  {\tt FitsInFile\& $>>$ }  \\
     1733 operators can be used
     1734write and read objects.  The two main types of fits data structures, images and tables
     1735{\tt (IMAGE\_HDU , BINARY\_TBL , ASCII\_TBL)} are handled by the generic handlers: \\
     1736{\bf \tcls{FitsArrayHandler}}  and {\bf FitsHandler$<$BaseDataTable$>$}.  \\
     1737A number of more specific handlers are also available, in particular for NTuple,
     1738\tcls{SphereHealPix} and \tcls{SphereThetaPhi}.
     1739%%%
     1740The example below illustrates the usage of FitsIOServer classes.
     1741\begin{enumerate}
     1742\item Saving an array and a HealPix map to a Fits file
     1743\begin{verbatim}
     1744#include "fitsarrhand.h"
     1745#include "fitsspherehealpix.h"
     1746#include "fitsmanager.h"
     1747#include "fiosinit.h"
     1748// ....
     1749{
     1750// Initialize the FitsIOServer module :
     1751FitsIOServerInit();
     1752//  Create and open a fits file named myfile.fits
     1753FitsInOutFile fos("myfile.fits", FitsInOutFile ::Fits_Create);
     1754// Create and save a 15x11 matrix of integers
     1755TMatrix<int_4> mxi(15, 11);
     1756mxi = RegularSequence(10.,10.);
     1757fos << mxi;
     1758// Save a HEALPix spherical map using FitsManager services
     1759SphereHEALPix<r_8> sph(16);
     1760sph = 48.3;
     1761FitsManager::Write(fos, sph);
     1762}
     1763\end{verbatim}
     1764\end{enumerate}
     1765
     1766
    16471767\begin{verbatim}
    16481768#include "spherehealpix.h"   
     
    16961816\end{verbatim}
    16971817
    1698 The class {\bf FITS\_AutoReader} provides a limited FITS files reading
    1699 and decoding capabilities. A partial class diagram of FITS persistence
    1700 handling classes is shown below:
     1818A partial class diagram of FITS persistence handling classes is shown below. The
     1819class {\tt FitsIOhandler} conforms to the old FitsIOServer module design and
     1820should not be used anymore.
    17011821\begin{figure}[hbt]
    1702 \dclsbb{FitsIOhandler}{FITS\_TArray}
    1703 \dclsb{FITS\_NTuple}
    1704 % \dclsb{FITS\_XNTuple}
    1705 \dclsb{FITS\_SphereHEALPix}
     1822\dclsbb{FitsHandlerInterface}{FitsArrayHandler$<$T$>$}
     1823\dclsb{\tcls{FitsHandler}}
     1824\dclscc{FitsIOhandler}{FITS\_NTuple}
     1825\dclsc{FITS\_SphereHEALPix}
    17061826% \dclsb{FITS\_LocalMap}
    17071827\end{figure}
     
    17571877OS & compiler \\
    17581878\hline
    1759 HP/Compaq/DEC Tru64 ( OSF1)  &     cxx  (6.1 , 6.3)  \\
    17601879Linux (RH)          &     g++  (3.2)  \\
    17611880Linux  (SCL)          &     icc  (8.1)   (Intel compiler) \\
     1881MacOSX/Darwin 10.3  &         g++ 3.3  \\
     1882HP/Compaq/DEC Tru64 ( OSF1)  &     cxx  (6.1 , 6.3)  \\
    17621883SGI IRIX64       &     CC   (7.3)   \\
    1763 MacOSX/Darwin 10.3  &         g++ 3.3  \\
     1884IBM AIX       &     xlC   (7.x)   \\
    17641885\hline
    17651886\end{tabular}
     
    17761897({\tt libextsophya.so}). The {\bf PI} and {\bf PIext} modules are
    17771898grouped in ({\tt libPI.so}).
     1899Alternatively, it is possible to group all modules in a single shared
     1900library {\tt libAsophyaextPI.so}.
    17781901
    17791902\subsection{Installation}
    1780 
    1781 The build procedure has two main steps: \\
    1782 - The configure step (BuildMgr/configure) setup the directory structure and
    1783 the necessary configuration file. \\
    1784 - The make step compiles the different sources files, create the library and optionaly
     1903\label{build}
     1904The build procedure has two main steps:
     1905\begin{enumerate}
     1906\item The configure step (BuildMgr/configure) setup the directory structure and
     1907the necessary configuration file. Refer to section \ref{directories} for
     1908the description of SOPHYA directory tree and files.
     1909\item The make step compiles the different sources files, create the library and optionaly
    17851910builds all or some of the associated executables.
    1786 
    1787 \par
     1911\end{enumerate}
     1912
    17881913{\tt BuildMgr/configure } is a c-shell script with a number of arguments:
    17891914\begin{verbatim}
     
    17951920  [-noextlib -noext fits -noext fftw -noext lapack ]
    17961921  [-noext astro -noext minuit]
     1922  [-usefftw2 -uselapack2] [-singleslb]
    17971923\end{verbatim}
    17981924\begin{itemize}
     
    18131939\item[] -noext : Disable compiling of the specified module (with reference to external
    18141940library.
     1941\item[] -usefftw2: FFTW V2 is being used (default FFTW V3) - A compilation flag
     1942will be defined in sspvflags.h
     1943\item[] -uselapack2: Lapack V2 is being used (defaulr V3) - A compilation flag
     1944will be defined in sspvflags.h
     1945\item[] -singleslb: A single shared library for all SOPHYA, PI and external library interface
     1946modules will be build. A compilation flag
     1947will be defined in sspvflags.h . `See also target {\tt slballinone} below.
    18151948\end{itemize}
    18161949
     
    18291962csh> ./configure -sbase /usr/local/Sophya -scxx g++  -extp /usr/local/ExtLibs/ \
    18301963-noext astro -noext minuit
    1831 # Step 1.b : Check the generated file  $SOPHYABASE/include/
     1964# Step 1.b : Check the generated file  $SOPHYABASE/include/sophyamake.inc
     1965csh> ls -lt *.inc
     1966csh> more sophyamake.inc
     1967\end{verbatim}
     1968If necessary, edit the generated file {\tt sophyamake.inc } in order to modify
     1969compilation flags, library list. The file is rather short and self documented.
     1970\begin{verbatim}
    18321971# Step 2.a: Compile the modules without external library reference
    18331972csh> make libs
     
    18451984
    18461985To compile all modules and build the shared libraries, it is possible
    1847 to use:
     1986to perform the steps 2.a to 2.f using the targets {\tt all} and {\tt slball}
     1987defined  in the Makefile
    18481988\begin{verbatim}
    18491989# Step 2.a ... 2.f
    1850 csh> make all slball
     1990csh> make all slball
     1991\end{verbatim}
     1992
     1993It is also possible to group all modules in a single shared library using
     1994the target {\tt slballinone}.
     1995\begin{verbatim}
     1996# Step 2.a ... 2.f
     1997csh> make all slballinone
    18511998\end{verbatim}
    18521999
     
    18542001Sophya libraries can now be built:
    18552002\begin{verbatim}
    1856 # To compile test programs
    1857 csh> cd ../PrgUtil
    1858 csh> make
     2003# To compile some of the test programs
     2004csh> make basetests
     2005# To compile runcxx , scanppf , scanfits
     2006csh> make prgutil
    18592007# To build (s)piapp (libPI.so is needed)
    1860 csh> cd ../ProgPI
    1861 csh> make
    1862 csh> cd ..
    1863 \end{verbatim}
    1864 
    1865 \subsection{Mgr module}
    1866 This module contains scripts which can be used for generating the
    1867 makefiles for each module.
     2008csh> make piapp
     2009\end{verbatim}
     2010
     2011\subsection{Platform specific notes }
    18682012\begin{itemize}
    1869 \item {\bf Makefile} Top level Makefile for building the libraries.
    1870 \item {\bf Makefile.h} contains the definition of compilation flags for the
    1871 different compilers and systems. This file is used for building the
    1872 library and generating {\bf MakefileUser.h} (to be included in makefiles).
    1873 \item {\bf Makefile.slb} contains the rules for building shared libraries
    1874 for the different compilers and systems. (to be included in makefiles)
    1875 \item {\bf crerep\_sophya} c-shell script for creating the directory tree
    1876 under {\tt \$SOPHYABASEREP} and {\tt \$SOPHYADEVREP}
    1877 \item {\bf install\_sophya} c-shell script for installing the Sophya package.
    1878 Usually from {\tt \$SOPHYADEVREP} to {\tt \$SOPHYABASEREP}
    1879 \item {\bf mkmflien} c-shell script for making symbolic links or copying
    1880 include files to {\tt \$SOPHYADEVREP/Include} or {\tt \$SOPHYABASEREP/Include}
    1881 \item {\bf mkmf} c-shell script for generating module makefiles and the
    1882 top level makefile (named GNUmakefile)
    1883 \item {\bf mkmflib} c-shell script for generating each library module
    1884 makefile (named GNUmakefile)
    1885 \item {\bf mkmfprog} c-shell script for generating makefile for a module
    1886 containing the source for executable programs (named GNUmakefile).
    1887 \item {\bf mkmfPI} c-shell script for generating makefile for PI and PIext
    1888 modules (named GNUmakefile)
    1889 \item {\bf libdirs} List of Sophya modules without reference to external
    1890 libraries.
    1891 \item {\bf extlibdirs} List of Sophya modules with reference to external
    1892 libraries.
    1893 
     2013\item[{\bf AIX}] There seem to be a problem on AIX when several shared
     2014libraries are used. We have been able to run SOPHYA programs either
     2015using static libraries, or a single shared library (libAsophyaextPI.so)
     2016if extlibs and PI are needed, in addition to stand alone SOPHYA modules.
    18942017\end{itemize}
    1895  
     2018
     2019\subsection{Files and scripts in BuildMgr/ }
     2020\begin{itemize}
     2021\item[] {\bf Makefile:} Top level Makefile for building SOPHYA.
     2022{\tt smakefile} is similar to Makefile, except that it uses
     2023the smakefiles in each module.
     2024\item[] {\bf mkmflib:}  c-shell script for creation of library module
     2025Makefile / smakefile.
     2026{\tt  ./mkmflib -sbase /tmp/sbase SUtils }
     2027\item[] {\b mkmfprog:}
     2028{\tt c-shell script for creation of programs module
     2029Makefile / smakefile \\
     2030{\tt ./mkmfprog -sbase /tmp/sbase ProgPI }
     2031\item[] {\bf domkmf:} c-shell script - calls mkmflib for all modules \\
     2032{\tt ./domkmf -sbase /tmp/sbase}
     2033\item[] Configuration files for different compilers and OS
     2034(\tt  Linux\_g++\_make.inc , OSF1\_cxx\_make.inc \ldots }.
     2035These files are used to generate {\tt sophyamake.inc}
     2036\end{itemize}
     2037
     2038\noindent {\large \bf NOTE}  \hspace{5mm}
     2039The {\bf Mgr} module contains makefiles and build scripts
     2040whih were used in SOPHYA up to version 1.7 (2004).
     2041It should not be used anymore.
     2042
     2043
    18962044\newpage
    18972045\appendix
Note: See TracChangeset for help on using the changeset viewer.