1.3. Compiling the POOMA Library

Most of the POOMA Toolkit source code is available in header files containing template class definitions. A few files are compiled and collected together into the POOMA library.

Before the POOMA toolkit may be compiled, it must be configured. Configuration creates files used during compilation that are specific to the particular operating system, compiler, and available libraries that are to be used. The configuration files in the config/arch/ directory correspond to supported operating systems and compilers. For example, LINUXgcc.conf supports compiling under a Linux operating system with gcc (really g++). SGI64KCC.conf supports compiling under a 64-bit SGI Irix operating system with KCC.

To configure the source code, use a command like


./configure - -arch LINUXgcc - -opt - -suite LINUXgcc-opt
The architecture argument to the - -arch option is the name of the corresponding configuration file, omitting its .conf suffix. The - -opt indicates the POOMA Toolkit will contain optimized source code, which makes the code run more quickly but may impede debugging. Alternatively, use the - -debug option which supports debugging. The suite name can be any arbitrary string. We chose LINUXgcc-opt to remind us of the architecture and optimization choice. configure creates subdirectories named "LINUXgcc-opt" for use when compiling the source files. Comments at the beginning of lib/suiteName/PoomaConfiguration.h record the configuration arguments.

To create the POOMA library, the toolkit source files need to be compiled. Specify the desired suite by setting the POOMASUITE environment variable to the appropriate value. For example, if using the bash shell, use


export POOMASUITE=suiteName
substituting the suite name's suiteName. If using the csh shell, use

setenv POOMASUITE suiteName
In the previous paragraph, the suite name is LINUXgcc-opt so we would issue the statement

setenv POOMASUITE LINUXgcc-opt

Issuing the make command compiles the POOMA source code files to create the POOMA library. The POOMA makefiles assume the GNUMake is available so substitute the proper command to run GNUMake if necessary. As each source file is compiled, a line is printed. If the compilation succeeds, the POOMA library can be found in, e.g., lib/LINUXgcc-opt/libpooma-gcc.a. If it fails, the makefiles will print a line indicating which file failed to compile. Reading the corresponding .info file may indicate what failed.

The same POOMA source code can support multiple suites as long as different names are used. For example, we could have LINUXgcc-opt and LINUXgcc-debug suites. Both of these might specify use of the Linux operating system and gcc, but one could have optimized code corresponding to the configuration option - -opt and the other could have debuggable code corresponding to the configuration option - -debug. When compiling both the library and user code, the POOMASUITE environment variable indicates which suite to use.

1.3.1. DANGER: Configuration Options

(Are you sure you should be reading this section? The DANGER in the title is meant to warn you about material that ought to be skipped on the first reading. And maybe also on the second reading. The reader-beware paragraphs sometimes refer to concepts that aren't explained until later chapters. (Thanks to Donald E. Knuth for the concept of DANGER sections and for the preceding text.))

The configuration script supports many more command-line options than the two used above, but few POOMA users need use them except those using distributed POOMA, which are described below. ./configure -h yields a complete list. We also describe them here.

Table 1-1. Configuration Options

optiondescription
Architecture and Installation Choices 
- -arch architecturespecify the desired operating system and compiler. architecture should correspond to a file in config/arch/ omitting the .conf suffix.
- -suite suitespecify a name for the this particular configuration. The environment variable POOMASUITE's value should equal suite when compiling the library. suite can be any string that can serve as a filename. If this option is omitted, the - -arch architecture is used.
- -prefix directoryindicates the directory where files are installed. make install should be invoked after compiling the library.
Debugging and Optimization Choices 
- -optcauses an optimized library to be built. Optimized code typically runs faster than unoptimized code, but debugging can be inhibited.
- -debugcauses an debuggable library to be built. That is, a debugger will be able to traverse library code.
Compiler Choices 
- -cpp compilerspecifies the C++ compiler to use. The default value is specified by the architecture configuration file.
- -c compilerspecifies the C compiler to use when compiling C executables. Such executables usually are example programs. The default value is specified by the architecture configuration file.
- -f77 compilerspecifies the Fortran77 compiler to use. The default value is specified by the architecture configuration file.
- -ar archiverspecifies the library archiver to use when creating a static library. The default value is specified by the architecture configuration file.
- -link linkerspecifies the linker to use when creating POOMA executables. The default value, usually the same as the C++ compiler, is specified by the architecture configuration file.
Compiler Options 
- -staticcreates a static library that will be directly linked into executables, rather than loaded dynamically. Compare with the - -shared option. This option is a default.
- -sharedcreates a library that will be dynamically loaded when a POOMA executable starts. It is the executable user's responsibility to configure the operating system so the library will be found, e.g., by setting the LD_LIBRARY_PATH environment variable.
- -venables verbose output from the compiler and linker.
- -qdisables verbose output from the compiler and linker.
- -strictenables ANSI C++ conformance checking by the compiler.
- -inc directorycauses -Idirectory options to be passed to the compiler. These indicate directories where header files are located. This option may be specified repeatedly.
- -def definitioncauses -Ddefinition options to be passed to the compiler. These define preprocessor symbols. This option may be specified repeatedly.
- -cpparg argumentsspecifies C++ compiler options. This option may be specified repeatedly.
- -carg argumentsspecifies C compiler options. This option may be specified repeatedly.
- -f77arg argumentsspecifies Fortran77 compiler options. This option may be specified repeatedly.
- -ararg argumentsspecifies archiver options. This option may be specified repeatedly.
- -linkarg argumentsspecifies linker options. This option may be specified repeatedly.
- -oneperenables the one-per-template-instantiation compiler option. The KCC compiler requires this option to avoid problems from instantiating the same template class repeatedly.
- -noonperdisables the one-per-template-instantiation compiler option. See - -oneper description.
Code Checking 
- -boundsturns on bound checking for indexing operations. That is, indexes into a C (a(3,4)) are checked to be in the domain. This option is not the default because it slows each access but is useful when checking program correctness.
- -insureenables Insure++ code checking.
- -purifyenables Purify code checking.
Language Choices 
- -exenables use of exceptions if available. Only one of this xor the - -noex option should be specified.
- -noexdisables use of exceptions. Only one of this xor the - -ex option should be specified.
- -arch-specific-functionsenables the use of architecture-specific initialization functions.
Library Options 
- -preinstcauses preinstantiated versions of several templated classes to be included in the library. This may reduce the time to compile executables.
DANGER: Option for Distributed Computation 
- -messagingenables creation of distributed POOMA executables by enabling use of the Cheetah communications package.
Configure Options 
-vturns on verbose output during configuration, showing which options are chosen and which are not.
-iprevents overwriting existing files during configuration without first querying the user.
-fforces overwriting existing files during configuration without querying the user. This is the default.
-hprints the list of configuration options.
-?prints the list of configuration options. This is the same as -h.