Chapter 1: Introduction





1.1: About this document

To use the Blitz++ library, you will need a compiler with near-draft standard syntax support (see the following section for possible compilers). If you'd like to participate in alpha testing, send a message containing "subscribe blitz" to majordomo@monet.uwaterloo.ca. Directions to the alpha release will follow.

Even if you're not able to participate in alpha testing, you're encouraged to look through this documentation and make suggestions. If you need to do something that Blitz++ doesn't support, see a possible improvement, or notice an error in the documentation, please let me know.

Note that this documentation is undergoing constant changes, so you may want to defer printing out the postscript version until it stabilizes.

Todd Veldhuizen tveldhui@extreme.indiana.edu





1.2: Platform notes

For up-to-date information on supported platforms, please consult the Blitz++ web page:

http://seurat.uwaterloo.ca/blitz/platforms/

The information in this document may be out of date.



1.2.1: KAI C++

Blitz++ was developed and tested using KAI C++ under AIX. It should (in theory) port to other KAI C++ platforms (Cray, SGI, HP, Sun, Linux, DEC) without difficulty. Since KAI C++ uses an EDG front end, other EDG front-ended compilers (e.g. Comeau) should be able to compile Blitz++.

Recommended compile flags are:

+K3 -O2 --restrict --abstract_pointer --abstract_float -tused

Note that you cannot compile with -tall (this will generate lots of errors).

Under Linux, you may need the flag -D__signed__=. You should omit -tused since this template instantiation model is not supported by gcc, which is used as the back-end compiler.

bzsubsubsect(Performance tuning for the T3E)

To get good performance out of Blitz++ with KAI C++ on the Cray T3E, you will want to edit <blitz/tuning.h> and set the tuning flags this way:

#undef BZ_PARTIAL_LOOP_UNROLL
#undef BZ_ARRAY_FAST_TRAVERSAL_UNROLL
#undef BZ_ARRAY_STACK_TRAVERSAL_UNROLL

This turns off unrolling of loops in Blitz++ (the back-end compiler does a better job). You will want to use these additional flags with KCC:

+K3 -O3 --backend -hpipeline3 --backend -hunroll --backend -hrestrict=a



1.2.2: Visual C++

Greg Wilson succeeded in compiling the compiler test suite under Visual C++ 5. The important missing features are:

#undef  BZ_MEMBER_TEMPLATES
#undef  BZ_MEMBER_TEMPLATES_OUTSIDE_CLASS
#undef  BZ_FUNCTION_NONTYPE_PARAMETERS
#undef  BZ_TYPE_PROMOTION
#undef  BZ_USE_NUMTRAIT
#undef  BZ_HAVE_COMPLEX_MATH
#undef  BZ_HAVE_IEEE_MATH
#undef  BZ_HAVE_SYSTEM_V_MATH

The most important is the first one, member templates. Blitz++ makes extensive use of these. If it had BZ_MEMBER_TEMPLATES, BZ_MEMBER_TEMPLATES_OUTSIDE_CLASS and BZ_FUNCTION_NONTYPE_PARAMETERS, there would be a chance of using Blitz++, but it looks hopeless now.

However, if you're really keen on using VC++, see the next section about Intel C++.



1.2.3: Intel C++

Intel has a drop-in compiler based on the EDG front end. It used to compile Blitz++, but since that time I've made use of some language features it doesn't support. However, there is a new beta version out (3.0) which may be able to compile Blitz++. Allan Stokes is working on this.

More information:

http://developer.intel.com/design/perftool/icl24/

http://developer.intel.com/design/perftool/icl24/icl24wht.htm



1.2.4: EGCS

EGCS is a free GNU C++ compiler. It is a fast-moving version of gcc. It compiles Blitz++ reliably.

EGCS may be downloaded from http://egcs.cygnus.com/.



1.2.5: Cray T3E/Cray T90/Cray C90/Cray J90

As of Version 0.2-alpha-02 of Blitz++, Version 3.0.0.0 of the Cray C++ compiler is supported (well, tolerated anyway). It seems to be based on an older version of the EDG front end, so some kludges are required. It doesn't support partial ordering of member templates, so slicing arrays requires the workaround described in Section 2.4.2. Portions of the standard library are missing, such as <limits>, <complex>, and <set>. This means you won't be able to use complex numbers (well, not the ISO/ANSI C++ versions anyway), numeric inquiry functions, or fast traversal orders.

These compilation flags are recommended:

-h instantiate=used

For optimization, you'll want:

-O3 -h aggress

The ability of the Cray C++ compiler to optimize away temporary objects is disappointing. It's not able to optimize away expression templates overhead or comma-delimited array initializers.





1.3: How to download Blitz++

To download the Blitz++ library, send an email message containing the line "subscribe blitz" to <majordomo@monet.uwaterloo.ca>. Download instructions will follow. But please read the section on supported platforms and compilers first.





1.4: Installation and porting



1.4.1: Installation

Blitz++ uses GNU Autoconf, which handles rewriting Makefiles for various platforms and compilers. It has greatly simplified installation and porting. Many thanks for John W. Eaton and Brendan Kehoe for their help with this.

To install blitz, unpack the blitz-VERSION.tar.gz file (it will install into a subdirectory blitz-VERSION). For example:

[tveldhui@n2001:~] 32: ls -l blitz*.gz
-rw-r--r--   1 tveldhui users      480953 Jun 23 15:20 blitz-0.3-alpha-01.tar.gz
[tveldhui@n2001:~] 33: gunzip blitz-0.3-alpha-01.tar.gz 
[tveldhui@n2001:~] 34: tar xvf blitz-0.3-alpha-01.tar
blitz-0.3-alpha-01/CHANGELOG
blitz-0.3-alpha-01/COPYING
blitz-0.3-alpha-01/INSTALL
blitz-0.3-alpha-01/Makefile.in
blitz-0.3-alpha-01/README
blitz-0.3-alpha-01/THANKS
  .
  .

Then go into the main blitz directory, and type:

./configure --with-cxx=[compiler]

where [compiler] is one of egcs, KCC, cray, aCC, or pgCC.

If your compiler has been renamed (e.g. eg++ for egcs instead of the usual g++), you can use this syntax to specify the command name for the compiler:

./configure --with-cxx=egcs:eg++

You can also specify special command-line options for your compiler, using this syntax:

./configure --with-cxx="egcs:eg++ -ftemplate-depth-50"

If you are interested in benchmarking, you may want to use the option --with-blas=... to specify the path where the blas library is found.

Once the configure script is done, you can do any of these things:



1.4.2: The Blitz++ directory tree

The main Blitz++ directory contains these subdirectories:



1.4.3: Header files

The Blitz++ library uses the X windows convention for header files. All headers are referred to with a prefix of "blitz/". For example, to use the Array<T,N> class, one needs to include <blitz/array.h> instead of just <array.h>. To make this work, the main Blitz++ directory must be in your include path. For example, if Blitz++ was installed in /software/Blitz++, you will need to compile with -I /software/Blitz++.



1.4.4: Porting Blitz++

If you want to try porting Blitz++ to a new compiler or platform, I suggest the following approach:





1.5: Licensing terms

The Blitz++ library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Caveat: The library and the techniques behind are still experimental; please be patient.

Note: numerous people have expressed concern about the GPL and its incompatibility with commercial software development. The licensing terms will be changed in a future release to be more friendly to commercial developers.





1.6: Mailing lists and support



1.6.1: How to subscribe to a mailing list

To subscribe to a Blitz++ mailing list, send a message containing one (or more) of these lines to majordomo@monet.uwaterloo.ca:

subscribe blitz-support
subscribe blitz-bugs
subscribe blitz-dev
subscribe blitz



1.6.2: blitz-bugs

You can report bugs (or things you suspect might be bugs) to blitz-bugs@monet.uwaterloo.ca.

It's not a very interesting list to be subscribed to. There are archives available from the Blitz++ web site.



1.6.3: blitz-dev

Blitz++ is in open development: anyone can contribute features and code to the library. If you are interested in helping out with coding or porting, you should start by subscribing to the blitz-dev mailing list.

This list is also the appropriate place to send suggestions for features; just send email to blitz-dev@monet.uwaterloo.ca. We can't implement it if you don't suggest it.

Archives of this list are available from the Blitz++ web site.



1.6.4: blitz-support

This mailing list is for posting and answering questions about using the Blitz++ library. Anyone can post questions; anyone can answer.



1.6.5: blitz

The blitz list is currently for alpha testers. It is very low traffic (one post every few months).