# Installation for parallel processing using OpenMP (Unix only)

## Compiling and installing FFTW3

Version 3.3.3 or later of FFTW3 can be obtained from http://www.fftw.org

For gcc, this requires version 4.2 or later (note that LLVM on Mac OS X 10.7+ does not support OpenMP). FFTW version 3.3.3 or later need to be installed with single precision and OpenMP enabled, preferably in its default location (/usr/local):

./configure --enable-float --enable-openmp --enable-shared --disable-fortran --with-pic

On Mac OS X before 10.8, a universal library should be compiled by explicitly specifying the architectures (note on 10.6+ the ppc versions won't compile):

./configure --enable-float --enable-openmp --enable-shared --disable-fortran CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" CPP="gcc -E" CXXCPP="g++ -E"

See the note on the configure script for Mac OSX at the bottom

The compilation and installation should then be simply:

make

sudo make install

## Compiling parallel Bsoft with OpenMP

As for the serial version of Bsoft, the recommended location for Bsoft is in /usr/local. Most of the instructions for the serial version also applies here. For parallel processing, Bsoft uses OpenMP for Linux and Mac OS X prior to 10.7, and Grand Central Dispatch for Mac OS X 10.7+. The compilation requires two additional flags:

bmake omp fftw3

A custom location for FFTW3 can also be specified:

bmake omp fftw3=/somedisk/mydirectory

## Fixing the configure script for Mac OSX and OpenMP

Note: On Mac OS X the configure script exit with an error. To have it behave, replace to following section:

    char omp_set_num_threads ();
    #ifdef F77_DUMMY_MAIN

    #  ifdef __cplusplus
         extern "C"
    #  endif
       int F77_DUMMY_MAIN() { return 1; }

    #endif
    int
    main ()
    {
    return omp_set_num_threads ();
      ;
      return 0;
    }

with the following:

    char omp_set_num_threads ();
    int opm_get_thread_num();
    #ifdef F77_DUMMY_MAIN

    #  ifdef __cplusplus
         extern "C"
    #  endif
       int F77_DUMMY_MAIN() { return 1; }

    #endif
    int
    main ()
    {
            int     tid;
            omp_set_num_threads(2);
            tid = omp_get_thread_num();
      return 0;
    }