Changeset 3015 in Sophya for trunk/SophyaLib
- Timestamp:
- Jul 17, 2006, 10:33:09 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Manual/sophya.tex
r3006 r3015 1 \documentclass[twoside,1 1pt]{article}1 \documentclass[twoside,10pt]{article} 2 2 % Package standard : Utilisation de caracteres accentues, mode francais et graphique 3 3 \usepackage{url} … … 215 215 216 216 \subsection{Directories, environment variables, configuration files} 217 \label{directories} 217 218 The environment variable {\bf SOPHYABASE} is used 218 219 to define the path where the Sophya libraries and binaries are installed. … … 220 221 \item \$SOPHYABASE/include : Include (.h) files 221 222 \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) 223 224 \item \$SOPHYABASE/exe : Path for binary program files 224 225 \end{itemize} 225 226 226 In order to use the shared libraries, the {\bf LD\_LIBRARY\_PATH} variable227 should contain the Sophya shared library path228 ({\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 } defines232 the shared library path in this case and should contain ({\tt \$SOPHYABASE/slb }.233 On IBM machines with AIX, the {\bf LIBPATH} environment variables234 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 shared238 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 files244 \item \$SOPHYABASE/include/FFTW : FFTW library include files245 \item \$SOPHYABASE/include/XAstro : XEphem library include files246 \end{itemize}247 248 227 The directory { \tt \$SOPHYABASE/include/SophyaConfInfo/ } contains files 249 228 describing the installed configuration of SOPHYA software. 250 229 251 230 The 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, 232 are found in { \tt \$SOPHYABASE/include/sspvflags.h } 253 233 254 234 The file { \tt \$SOPHYABASE/include/sophyamake.inc } contains the … … 259 239 260 240 The configure script (BuildMgr/configure) creates the directory tree and the 261 above files. 241 above files. It also copy (or create symbolic link) for all SOPHYA include 242 files as well as symbolic links for external libraries 243 include files path in {\tt \$SOPHYABASE/include} (FitsIO, FFTW, XAstro \ldots). 244 245 Object files for each module are grouped in a static archive library 246 by the build procedure (libXXX.a for module 247 XXX, with XXX = BaseTools, TArray, HiStats, FitsIOServer \ldots). 248 249 When shared libraries are build, all stand alone SOPHYA modules 250 are grouped in {\tt libsophya.so}, {\tt libextsophya.so} contains 251 the interface modules with external libraries {\bf (FitsIOServer, LinAlg \ldots)}, 252 while {\bf PI, PIext, PIGcont} modules are grouped in {\tt libPI.so}. 253 Alternatively, it is possible to group all modules in a single shared 254 library {\tt libAsophyaextPI.so} (See \ref{build}) 255 256 In order to use the shared libraries, the {\bf LD\_LIBRARY\_PATH} variable 257 should contain the Sophya shared library path 258 ({\tt \$SOPHYABASE/slb}). 259 On Silicon Graphics machines with IRIX64 operating system, 260 the default SOPHYA configuration correspond to the 64 bit architecture. 261 The environment variable { \bf LD\_LIBRARY64\_PATH } replace in 262 this case the usual {\bf LD\_LIBRARY\_PATH} variable. 263 On IBM machines with AIX, the {\bf LIBPATH} environment variables 264 contains the shared libraries search path. 265 266 When using the dynamic load services in SOPHYA ({\tt PDynLinkMgr} 267 class), in runcxx or (s)piapp applications for example, the shared 268 library search path must contain the current working directory ( 269 dot . in unix). 262 270 263 271 \subsection{the runcxx program} … … 1444 1452 \section{Module SysTools} 1445 1453 The {\bf SysTools} module contains classes implementing interface to some 1446 OS specific services. The class {\bf ResourceUsage} \index{ResourceUsage} 1454 OS specific services, such as thread creation and management, dynamic loading and 1455 resource usage information. For example, yhe class {\bf Periodic} provides the 1456 necessary 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} 1447 1460 and {\bf Timer} {\index{Timer} provides access to information 1448 1461 about various resource usage (memory, CPU, ...). 1449 The class {\bf Periodic} provides the necessary services needed to 1450 implement the execution of a periodic action. 1462 The class {\bf Timer} {\index{time (CPU, elapsed)} and c-functions 1463 {\tt InitTim() , PrtTim(const char * Comm) } can be used to print 1464 the amount of CPU and elapsed time in programs. 1465 1466 The 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} 1451 1476 1452 1477 \subsection{Thread management classes} 1453 1478 A basic interface to POSIX threads \index{thread} is also provided 1454 through the \index{ZThread} {\bf ZThread}, {\bf ZMutex} and {\bf ZSync} 1455 classes. 1479 through the \index{threads} {\bf ZThread}, {\bf ZMutex} and {\bf ZSync} 1480 classes. The best way to use thread management classes is by inheriting 1481 from {\bf ZThread} and redefining the {\tt run() } method. 1482 It is also possible to use the default {\tt run() } implementation and associate 1483 a 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} 1500 The classes {\bf ZMutex} \index{mutex} and {\bf ZSync} can be used 1501 to perform synchronisation and signaling between threads. 1456 1502 1457 1503 \subsection{Dynamic linker and C++ compiler classes} … … 1499 1545 Arithmetic expression evaluation is implemented through the {\bf CExpressionEvaluator} 1500 1546 and {\bf RPNExpressionEvaluator} classes. 1547 The command language provides variable manipulation through the usual 1548 {\tt \$varname} vector variable and arithmetic expression extensions, as well 1549 as the control and test blocs. 1550 \begin{verbatim} 1551 #include "commander.h" 1552 ... 1553 Commander cmd; 1554 char* ss[3] = {"foreach f ( AA bbb CCCC ddddd )", "echo $f" , "end"}; 1555 for(int k=0; k<3; k++) { 1556 string line = ss[k]; 1557 cmd.Interpret(line); 1558 } 1559 \end{verbatim} 1501 1560 1502 1561 \newpage … … 1576 1635 1577 1636 \newpage 1578 \section{Module Samba} 1637 \section{Samba and SkyT} 1638 \subsection{Samba} 1579 1639 \index{Spherical Harmonics} 1580 1640 \index{SphericalTransformServer} … … 1602 1662 \end{verbatim} 1603 1663 1604 \newpage 1605 \section{Module SkyT} 1606 \index{RadSpectra} \index{SpectralResponse} 1664 \subsection{Module SkyT} 1665 \index{RadSpectra} \index{SpectralResponse} \index 1607 1666 The SkyT module is composed of two types of classes: 1608 1667 \begin{itemize} … … 1639 1698 \newpage 1640 1699 \section{Module FitsIOServer} 1700 \index{FITS} \index{FitsInFile} \index{FitsOutFile} 1701 This module provides classes for handling file input-output in FITS format using the cfitsio library. Its 1702 design is similar to the SOPHYA persistence (see Module BaseTools). 1703 Delegate classes or handlers perform the actual read/write from/to fits files. 1704 Compared to the SOPHYA native persistence (PPF format), 1705 FITS format has the advantage of being used extensively, and handled 1706 by a many different software tools. It is a de facto standard in 1707 astronomy and astrophysics. 1708 However, FITS lacks some of the features present in SOPHYA PPF, and although 1709 many SOPHYA objects can be saved in FITS files, FITS persistence has 1710 some limitations. For example, FITS does not currently handle complex arrays. 1711 \par 1712 The class {\bf FitsInOutFile} can be seen as a wrapper class for the cfitsio library functions. 1713 This class has been introduced in 2005 (V=1.9), when the module has been 1714 extensively changed. In order to keep backward compatibility, the old fits wrapper 1715 classes ({\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. 1641 1720 \begin{figure}[hbt] 1642 \dclsbb{FitsFile}{FitsInFile} 1643 \dclsb{FitsOutFile} 1721 \dclsa{FitsInOutFile} 1722 \dclscc{FitsFile}{FitsInFile} 1723 \dclscc{FitsFile}{FitsOutFile} 1644 1724 \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 1727 Handlers classes inheriting from {\bf FitsHandlerInterface} perform write/read operations 1728 for AnyDataObj objects to/from FitsInOutFile streams. The {\bf FitsManager} class provides 1729 top level services for object read/write in FITS files. 1730 In most cases, \\ 1731 {\tt FitsInOutFile\& $<<$ } and {\tt FitsInOutFile\& $>>$ } or \\ 1732 {\tt FitsOutFile\& $<<$ } and {\tt FitsInFile\& $>>$ } \\ 1733 operators can be used 1734 write 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$>$}. \\ 1737 A number of more specific handlers are also available, in particular for NTuple, 1738 \tcls{SphereHealPix} and \tcls{SphereThetaPhi}. 1739 %%% 1740 The 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 : 1751 FitsIOServerInit(); 1752 // Create and open a fits file named myfile.fits 1753 FitsInOutFile fos("myfile.fits", FitsInOutFile ::Fits_Create); 1754 // Create and save a 15x11 matrix of integers 1755 TMatrix<int_4> mxi(15, 11); 1756 mxi = RegularSequence(10.,10.); 1757 fos << mxi; 1758 // Save a HEALPix spherical map using FitsManager services 1759 SphereHEALPix<r_8> sph(16); 1760 sph = 48.3; 1761 FitsManager::Write(fos, sph); 1762 } 1763 \end{verbatim} 1764 \end{enumerate} 1765 1766 1647 1767 \begin{verbatim} 1648 1768 #include "spherehealpix.h" … … 1696 1816 \end{verbatim} 1697 1817 1698 The class {\bf FITS\_AutoReader} provides a limited FITS files reading 1699 and decoding capabilities. A partial class diagram of FITS persistence1700 handling classes is shown below: 1818 A partial class diagram of FITS persistence handling classes is shown below. The 1819 class {\tt FitsIOhandler} conforms to the old FitsIOServer module design and 1820 should not be used anymore. 1701 1821 \begin{figure}[hbt] 1702 \dclsbb{Fits IOhandler}{FITS\_TArray}1703 \dclsb{ FITS\_NTuple}1704 % \dclsb{FITS\_XNTuple}1705 \dcls b{FITS\_SphereHEALPix}1822 \dclsbb{FitsHandlerInterface}{FitsArrayHandler$<$T$>$} 1823 \dclsb{\tcls{FitsHandler}} 1824 \dclscc{FitsIOhandler}{FITS\_NTuple} 1825 \dclsc{FITS\_SphereHEALPix} 1706 1826 % \dclsb{FITS\_LocalMap} 1707 1827 \end{figure} … … 1757 1877 OS & compiler \\ 1758 1878 \hline 1759 HP/Compaq/DEC Tru64 ( OSF1) & cxx (6.1 , 6.3) \\1760 1879 Linux (RH) & g++ (3.2) \\ 1761 1880 Linux (SCL) & icc (8.1) (Intel compiler) \\ 1881 MacOSX/Darwin 10.3 & g++ 3.3 \\ 1882 HP/Compaq/DEC Tru64 ( OSF1) & cxx (6.1 , 6.3) \\ 1762 1883 SGI IRIX64 & CC (7.3) \\ 1763 MacOSX/Darwin 10.3 & g++ 3.3\\1884 IBM AIX & xlC (7.x) \\ 1764 1885 \hline 1765 1886 \end{tabular} … … 1776 1897 ({\tt libextsophya.so}). The {\bf PI} and {\bf PIext} modules are 1777 1898 grouped in ({\tt libPI.so}). 1899 Alternatively, it is possible to group all modules in a single shared 1900 library {\tt libAsophyaextPI.so}. 1778 1901 1779 1902 \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} 1904 The build procedure has two main steps: 1905 \begin{enumerate} 1906 \item The configure step (BuildMgr/configure) setup the directory structure and 1907 the necessary configuration file. Refer to section \ref{directories} for 1908 the description of SOPHYA directory tree and files. 1909 \item The make step compiles the different sources files, create the library and optionaly 1785 1910 builds all or some of the associated executables. 1786 1787 \par 1911 \end{enumerate} 1912 1788 1913 {\tt BuildMgr/configure } is a c-shell script with a number of arguments: 1789 1914 \begin{verbatim} … … 1795 1920 [-noextlib -noext fits -noext fftw -noext lapack ] 1796 1921 [-noext astro -noext minuit] 1922 [-usefftw2 -uselapack2] [-singleslb] 1797 1923 \end{verbatim} 1798 1924 \begin{itemize} … … 1813 1939 \item[] -noext : Disable compiling of the specified module (with reference to external 1814 1940 library. 1941 \item[] -usefftw2: FFTW V2 is being used (default FFTW V3) - A compilation flag 1942 will be defined in sspvflags.h 1943 \item[] -uselapack2: Lapack V2 is being used (defaulr V3) - A compilation flag 1944 will be defined in sspvflags.h 1945 \item[] -singleslb: A single shared library for all SOPHYA, PI and external library interface 1946 modules will be build. A compilation flag 1947 will be defined in sspvflags.h . `See also target {\tt slballinone} below. 1815 1948 \end{itemize} 1816 1949 … … 1829 1962 csh> ./configure -sbase /usr/local/Sophya -scxx g++ -extp /usr/local/ExtLibs/ \ 1830 1963 -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 1965 csh> ls -lt *.inc 1966 csh> more sophyamake.inc 1967 \end{verbatim} 1968 If necessary, edit the generated file {\tt sophyamake.inc } in order to modify 1969 compilation flags, library list. The file is rather short and self documented. 1970 \begin{verbatim} 1832 1971 # Step 2.a: Compile the modules without external library reference 1833 1972 csh> make libs … … 1845 1984 1846 1985 To compile all modules and build the shared libraries, it is possible 1847 to use: 1986 to perform the steps 2.a to 2.f using the targets {\tt all} and {\tt slball} 1987 defined in the Makefile 1848 1988 \begin{verbatim} 1849 1989 # Step 2.a ... 2.f 1850 csh> make all slball 1990 csh> make all slball 1991 \end{verbatim} 1992 1993 It is also possible to group all modules in a single shared library using 1994 the target {\tt slballinone}. 1995 \begin{verbatim} 1996 # Step 2.a ... 2.f 1997 csh> make all slballinone 1851 1998 \end{verbatim} 1852 1999 … … 1854 2001 Sophya libraries can now be built: 1855 2002 \begin{verbatim} 1856 # To compile test programs 1857 csh> cd ../PrgUtil 1858 csh> make 2003 # To compile some of the test programs 2004 csh> make basetests 2005 # To compile runcxx , scanppf , scanfits 2006 csh> make prgutil 1859 2007 # 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. 2008 csh> make piapp 2009 \end{verbatim} 2010 2011 \subsection{Platform specific notes } 1868 2012 \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 2014 libraries are used. We have been able to run SOPHYA programs either 2015 using static libraries, or a single shared library (libAsophyaextPI.so) 2016 if extlibs and PI are needed, in addition to stand alone SOPHYA modules. 1894 2017 \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 2023 the smakefiles in each module. 2024 \item[] {\bf mkmflib:} c-shell script for creation of library module 2025 Makefile / smakefile. 2026 {\tt ./mkmflib -sbase /tmp/sbase SUtils } 2027 \item[] {\b mkmfprog:} 2028 {\tt c-shell script for creation of programs module 2029 Makefile / 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 }. 2035 These files are used to generate {\tt sophyamake.inc} 2036 \end{itemize} 2037 2038 \noindent {\large \bf NOTE} \hspace{5mm} 2039 The {\bf Mgr} module contains makefiles and build scripts 2040 whih were used in SOPHYA up to version 1.7 (2004). 2041 It should not be used anymore. 2042 2043 1896 2044 \newpage 1897 2045 \appendix
Note:
See TracChangeset
for help on using the changeset viewer.