[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 8. Parallel Computing with Blitz++

While Blitz++ can be used for parallel computing, it was not designed primarily for this purpose. For this reason, you may want to investigate some other available libraries, such as POOMA, before choosing to implement a parallel code using Blitz++.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 8.1 Blitz++ and thread safety

To enable thread-safety in Blitz++, you need to do one of these things:

- Compile with `gcc -pthread`, or `CC -mt` under Solaris. (These options define `_REENTRANT`, which tells Blitz++ to generate thread-safe code).

- Compile with `-DBZ_THREADSAFE`, or `#define BZ_THREADSAFE` before including any Blitz++ headers.

In threadsafe mode, Blitz++ array reference counts are safeguarded by a mutex. By default, pthread mutexes are used. If you would prefer a different mutex implementation, add the appropriate `BZ_MUTEX` macros to `<blitz/blitz.h>` and send them to `blitz-dev@oonumerics.org` for incorporation.

Blitz++ does not do locking for every array element access; this would result in terrible performance. It is the job of the library user to ensure that appropriate synchronization is used.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Julian Cummings on October, 14 2005 using texi2html