Next: Compability with HEALPix    Previous: Data distribution


Compilation

As of now no general configure nor Makefile are provided for the compilation. This deficiency is planned to be alleviated in the future. The package can be however straightforwardly compiled by adapting a procedure detailed below.

The example scripts can be viewed here for IBM SP, here for PGI compilers, here for GNU compilers, and here for Intel ones (from Sam Leach).

Since version 2.5 to compile the S2HAT package you will just need an FFT library. At this time the supported choices include: HEALPix FFT routines, FFTW and AMCL. (Hereafter, $LIBFFT and $INCFFT denote the relevant paths to the FFT library - lib and include, respectively.) The compilation proceeds as follows:

  • $mpif90 $FFLAGS s2hat_defs.f90
  • $mpif90 $DFLAGS $FFLAGS $INCFFT s2hat_types_internal.F90
  • $mpif90 $FFLAGS s2hat_pixelization.f90
  • $mpif90 $DFLAGS $FFLAGS $INCFFT s2hat_toolbox.F90
  • $mpif90 $FFLAGS s2hat_alm2map.f90
  • $mpif90 $FFLAGS s2hat_map2alm.F90
  • $mpif90 $FFLAGS s2hat_c_interface.f90

  • $mpicc $CFLAGS s2hat_c_wrappers.c

    and finally,

  • ar $XFLAG rv libs2hat.a s2hat_defs.o s2hat_types_internal.o s2hat_pixelization.o s2hat_toolbox.o s2hat_alm2map.o s2hat_map2alm.o s2hat_c_interface.o s2hat_c_wrappers.o

  • where,

  • $mpif90 stands for an mpi enabled f90 compiler;
  • $mpicc - the same for C;
  • $FFLAGS denote the relavant compiler flags including the optimization (e.g., -On, n=1,2,3) or debugger (-g) flag, the flags recognizing "F90" and "f90" as a legitimate Fortran90 extension, with and without preprocessor commands, and either 32 or 64 bit flags (in agreement with the FFT library - the latter are recommended). In addition you should add all the flags relevant to your system and compiler.
    N.B., if you use HEALPix library for FFTs then $FFLAGS will also need to include a path to the HEALPix mod files (as in this case the HEALPix type definitions will be used rather than the S2HAT native ones);
  • $CFLAGS as above but for the C compiler. Note that these need to link/include libraries, which may be needed to permit calling Fortran from C;
  • $DFLAGS define the computer platform, the choice of the FFT package, and the optimization approach,
    i.e.,

    $DFLAGS = -Dplatform -Dfftpackage [-Dmpiversion] [-Doptimization]

    and the accepted values of those are:

    • platform = SP3, T3E, SX5, O2K, opteron, powermac, x86_32, x86_64;
    • fftpackage = ACML_fft, HEALPIX_fft, FFTW3_HC2R, FFTW3_C2R;
    • mpiversion = MPICH, OPEN_MPI, LAM_MPI (optional);
    • optimization = SP3OPT, OPTERONOPT (optional);
    • Optionally one can also use a -D flag define the value of the global parameter MAXCHK, which allows the library to use better the cache, resulting in the performance improvements of up to 10-20%. The value of the parameter (an integer, > 50) can be tuned for different platforms by timing the transform routines. The default value is 1500 corresponding to setting the flag -DMAXCHK=1500.


  • Note that the platform definition is only needed to define the convention for the F90 routines when called from C (i.e., underscores, capitalization, etc). If your particular computer system does not appear explicitly, some other should be a good substitute. Check the header file: s2hat_f2c.h for details then.

  • The default value for the mpiversion flag is OPEN_MPI. This is usually OK for **all** the implementation of MPI. If something goes wrong you can try however to set this flag manually to MPICH. (Note that OPEN_MPI and LAM_MPI are equivalent.)

  • If no optimization flag is set, it is by default assumed to be SP3OPT if the platform flag is set to SP3, and to be equal to OPTERONOPT otherwise.

  • $XFLAG is needed (and allowed) only on some platforms, e.g., AIX, and then it is either X32 or X64 depending on your choice of a bit number flag above.


  • Subsequently, put all the produced *.mod and provided *.h files into the include directory for the s2hat library and the produced libs2hat.a file into a corresponding lib directory. Let us call them $INCS2HAT and $LIBS2HAT, respectively. To compile your code using the S2HAT routines you need to link both FFT and S2HAT packages, i.e.,

    $mpicompiler $FLAGS -L$LIBFFT -I$INCFFT -L$LIBS2HAT -I$INCS2HAT ... mycode -lfftlib -ls2hat -l...
    where,

  • $mpicompiler - an mpi enabled compiler (C or F90);
  • $FLAGS - usual compilation flags;

  • Check here for some simple examples.



    Next: Compability with HEALPix    Previous: Data distribution

    radek stompor 2009-10-15