Blitz++ library

Jacek M. Holeczek (holeczek@clri6g.gsi.de)
Wed, 4 Jun 1997 09:56:50 +0200 (EET)


Blitz++ Version Version 0.1 alpha 04b
April 1997

** Feel free to forward this notice to select people.

** Available by anon ftp from monet.uwaterloo.ca
as pub/blitz/.alpha/blitz-0.1-alpha-??.tar.gz

Blitz++ is a C++ template class library for scientific computing.
It offers a high level of abstraction, but performance which rivals
that of Fortran 77. The current alpha version supports only vectors;
matrices, and arrays will follow in the next few versions.

1. Contents of the alpha release

* Vector<T>
Numerical vector class; supports integral, floating, or complex types
Shallow copies and reference counting
Subvectors, possibly with non-unit stride
Rudimentary output formatting
Debug mode with bounds checking
Uses the NCEG restrict keyword if supported

* TinyVector<T,N>
For small vectors (recommended less than 10 elements)
Loops are unravelled for most operations
Debug mode with bounds checking
Uses restrict if supported

* Vector expressions
Evaluated using expression templates, which rival Fortran 77 when
used with KAI C++
Operators + - * / % ^ & | >> << > >= < <= == !=
Assignment operators = += -= *= /= %= ^= &= |= >>= <<=
Operands: vectors, tiny vectors, scalars, expressions, vector picks, Range
Arithmetic type promotion (in the C style)
where(X,Y,Z) implementation of the ?: operator

* Math functions (Vector, Range, or vector expression arguments)
abs acos acosh asin asinh atan
atnh cbrt ceil cos cosh exp
expm1 erf erfc fabs finite floor
ilogb isnan itrunc j0 j1 lgamma
log logb log1p log10 nearest rint
rsqrt sin sinh sqrt tan tanh
trunc uitrunc y0 y1

* Global vector functions
accumulate dot delta max
maxIndex maxValue mean min
minIndex minValue norm norm1
sum

* VectorPick
Selects an arbitrary subset or reordering of vector elements; may
be used as an lvalue
Rudimentary output formatting

* Random number generators
Uniform
Normal

* Benchmark classes
Benchmark
Timer

* Example programs

* Benchmarks
DAXPY
Haney's inductance benchmark

2. Is it faster than Fortran 77?

Maybe. There are two benchmark plots on the Blitz++ home page
(http://monet.uwaterloo.ca/blitz/) which show potential. On a
DAXPY operation, Blitz++ is just as fast as inlined Fortran code,
and is faster than a Fortran daxpy() function call. Blitz++
does fairly well on Scott Haney's inductance calculation benchmark:
it's 4% slower than Fortran, but 15% faster than C.
(It's possible that KAI C++ is passing up a possible optimization
on the C code). Note that these figures are for one platform
only (an IBM RS/6000).

I think there's a good chance that on application benchmarks,
Blitz++ compiled with KAI C++ will be faster than Fortran 77.

2. Availability and system requirements

The latest version of Blitz++ may be found in pub/blitz on
monet.uwaterloo.ca.

The Blitz++ library uses a number of new language features
which are not yet widely supported. So far, only compilers
which use a recent Edison Design Group (EDG) front end will be able
to compile Blitz++. I have tested Blitz++ on one of
these -- KAI C++ from Kuck and Associates, which is an excellent
optimizing C++ compiler. They can be found on the web at
http://www.kai.com. (I don't have a promotional arrangement
with KAI, but I do think very highly of their compiler!)

3. More information

For up to date information on the Blitz++ library, please
see the web page at: http://seurat.uwaterloo.ca/blitz/

The web page also contains explanations of the techniques
behind the library (expression templates, template
metaprograms, traits).

4. Installation

No libraries need to be built -- Blitz++ is entirely template-based.
Just extract the gzipped tar file in a convenient location:

e.g. gunzip blitz-0.1-alpha-1.tar.gz
tar xvf blitz-0.1-alpha-1.tar
x Blitz++/CHANGELOG, 156 bytes, 1 media blocks.
x Blitz++/README, 6983 bytes, 14 media blocks.
.
.

If you're using KAI C++, you're now ready to compile. Otherwise,
you need to configure the Blitz++ library for your compiler.
Go to the Blitz++/compiler directory, and use bash to run the
bzconfig script. This script will produce a config.h file for
your compiler, which you should then copy to Blitz++/blitz/config.h.

5. Directories

benchmarks Benchmark programs
blitz Blitz++ headers and source files
blitz/meta More Blitz++ headers
compiler Compiler tests. Use "bzconfig" to generate a config.h
file for your compiler.
examples Example programs
manual Documentation in HTML format (so far, only for Vector<T>
and Range)

6. Compiling programs

The Blitz++ library is mildly unusual in its use of header files.
All headers are referred to with a prefix of "blitz/".
For example, to use the Vector<T> class, one needs to include
<blitz/vector.h> instead of just <vector.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++.

Recommended compile flags for KAI C++:

+K3 -O2 -DNDEBUG --restrict --no_implicit_include --abstract_pointer
--abstract_float

To compile the benchmarks, you will need an implementation
of valarray<T>, part of the new standard C++ library. This
is included with the KAI C++ compiler.

7. Email addresses

The point of this release is to get feedback. If you have problems,
suggestions, results or bugs to report, please send them directly to me
at tveldhui@seurat.uwaterloo.ca.

Future addresses
Suggestions: blitz-suggest@cybervision.com
Bug reports: blitz-bugs@cybervision.com
Licensing inquiries: blitz-licenses@cybervision.com

8. CALL FOR BENCHMARKS

I am looking for people willing to compile and run benchmarks
on these platforms:

SPARC Solaris
SGI Irix
HP UX
Digital UNIX
Cray T3D
IBM AIX (upscale model)

I'm also collecting application benchmarks to compare the performance
of Blitz++ to Fortran 77, C, and existing C++ libraries. Do you
have a code excerpt of 10-50 lines which could be turned into
a benchmark? If so, please get in touch with me.

9. Copyright and std disclaimer

The Blitz++ library is copyright (C) 1997 Todd Veldhuizen.
The library may be redistributed in an unmodified form, provided
no fee is charged. Academics and hobbyists may use this library
free of charge. Commercial and government users may be asked
to purchase a license in the future; for now, feel free to use
the library until I sort out details.

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

This software is distributed WITHOUT WARRANTY. In no event will the
author or his institution be liable to you for damages, including
lost profits, lost monies, central processing unit meltdown, or other
special, incidental or consequential damages arising out of or in
connection with the use or inability to use (including but not
limited to loss of data or data being rendered inaccurate or
losses sustained by third parties or a failure of the software
to operate as documented) the software, even if you have been
advised of the possibility of such damages, or for any claim
by any other party, whether in an action of contract,
negligence, or other tortious action.

Todd Veldhuizen,
Dept. of Systems Design Engineering,
University of Waterloo, Canada