Skip to content

Latest commit

 

History

History
202 lines (152 loc) · 8.27 KB

INSTALL.md

File metadata and controls

202 lines (152 loc) · 8.27 KB

Basic steps to install PRESTO:

(Note: For Mac users, please see the bottom of the document!)

  1. Install FFTW3.X http://www.fftw.org

    You need to compile FFTW for single precision (see the config flags I recommend below).

    For all architectures I recommend the following configuration: ./configure --enable-shared --enable-single

    Use the --prefix=SOME_PATH option to install the library and its related files to SOME_PATH. If you have admin access to your machine, --prefix=/usr/local is the default for FFTW and is a safe bet.

    If you are on a modern Intel processor and have a recent version of GCC, you can get much improved performance by adding: --enable-sse --enable-sse2 --enable-avx --enable-avx2 --enable-fma

    Ubuntu has good FFTW packages: libfftw3-bin and libfftw3-dev

    Note that if you install to a non-default directory, you will likely need to edit setup.py for the python install to add the locations of the include files (in the include_dirs variable) as well as the path to the libraries (in presto_library_dirs).

  2. Install PGPLOT http://www.astro.caltech.edu/~tjp/pgplot/

    You need the X-windows and postscript drivers at a minimum. Note that on 64-bit systems, compiling and linking PGPLOT can be tricky!

    It is very likely that you will need to have the PGPLOT_DIR environment variable specified to allow the programs to link and to allow PGPLOT to find its important files.

    Ubuntu has a good PGPLOT package: pgplot5 And on Ubuntu, I have PGPLOT_DIR=/usr/lib/pgplot5

    If you install to a non-standard location, see the note in #1 about editing the setup.py file for the python install!

  3. Install TEMPO http://tempo.sourceforge.net/

    Make sure to set the TEMPO environment variable.

  4. Install GLIB (v2.X) http://library.gnome.org/devel/glib/

    On Linux machines this is almost certainly already on your system (check in /usr/lib and /usr/include/glib*). Although you may need to install a glib development package in order to have the required include files...

    On Ubuntu, the package you need is: libglib2.0-dev

  5. Install CFITSIO http://heasarc.gsfc.nasa.gov/fitsio/

    This is a very easy install and is needed since PSRFITS is now being written by several pulsar instruments.

    Ubuntu has CFITSIO packages: libcfitsio-bin and libcfitsio-dev

    If you install to a non-standard location, see the note in #1 about editing the setup.py file for the python install!

  6. Define the PRESTO environment variable to the top level directory of the PRESTO distribution (i.e. this directory).

  7. cd to $PRESTO/src. Check and modify the Makefile for your machine of choice. Ensure that the library and include file directories are correct for FFTW, PGPLOT, GLIB, CFITSIO, and TEMPO.

  8. If you are using FFTW, do a make makewisdom. This gets FFTW acquainted with your system. It is best if you are the only user on the machine when you run this, as it is very computation intensive and may take a while.

  9. Just for safety's sake, do a make prep. That will make sure that make does not try to run Clig to re-generate all of the command line interface files.

  10. Do a make. This will make all of the executables. If you want mpiprepsubband (for parallel de-dispersion on clusters) you will need to do a make mpi as well (and for that, you will need to have OpenMPI installed!)

  11. The required libraries and miscellaneous files will be located in $PRESTO/lib. The executables will be in $PRESTO/bin. You may copy or move the executables wherever you like, but the library files should stay put. (That's why you define the PRESTO variable -- so the routines can find them).

    Given the new use of -Wl,-rpath,$(PRESTO)/lib during linking (thanks to Mike Keith for the tip!), you no longer need $PRESTO/lib in your LD_LIBRARY_PATH environment variable. However, you do still need $PRESTO/bin in your PATH, or else you can copy/link all of the files that are in $PRESTO/bin to somewhere that is in your path.

  12. If you want to save some disk space, do a make clean in the 'src' directory. This will leave the libraries and binaries in their respective directories but will get rid of all the extra stuff in the 'src' directory.

  13. If you want to use all the python routines (which if you are doing anything but the most rudimentary analyses you will want to), you need Python >= version 3.7, and NumPy and SciPy

    In general, the following should work: cd $PRESTO ; pip install . if you are using a virtual environment or have permissions for installing normal Python packages. If not, you may need to install as an administrator or with the --user flag. With this new and better Python installation you do not need to set the PYTHONPATH environment variable anymore and so you should ensure that it doesn't contain $PRESTO/lib/python as in the past.

  14. It is highly recommended that you test some of the Python code that wraps parts of the PRESTO C library. Once you have installed the python modules, you should run: python tests/test_presto_python.py. If all is well, you will get a bunch of tests and a bunch of successes.

  15. Go find pulsars!

Scott Ransom Updated May 2021


TROUBLE SHOOTING


Couple quick trouble-shooting tips if you are having problems compiling and running:

  1. Environment variables!

    • Is PRESTO set to the top-level PRESTO source directory?
    • Is TEMPO set to the top-level TEMPO source directory?
    • Is PGPLOT_DIR set to the location of the PGPLOT utility files? (Note: On Ubuntu, that should be /usr/lib/pgplot5)
    • Is $PRESTO/bin in your PATH? (It should be!)
    • Is $PRESTO/lib/python in your PYTHONPATH? (It shouldn't be now!)
  2. Have you have installed the relevant -dev packages for glib2, FFTW and CFITSIO if you are using a Debian-based Linux distribution? Here are the required packages on a clean Ubuntu:

    • build-essential
    • libfftw3-bin
    • libfftw3-dev
    • pgplot5
    • libglib2.0-dev
    • libcfitsio-bin
    • libcfitsio-dev
    • libpng-dev
    • gfortran
    • tcsh
    • autoconf
    • libx11-dev
    • python3-dev
    • python3-numpy
    • python3-pip

    And the following command should get all of them: apt install git build-essential libfftw3-bin libfftw3-dev pgplot5 libglib2.0-dev libcfitsio-bin libcfitsio-dev libpng-dev gfortran tcsh autoconf libx11-dev python3-dev python3-numpy python3-pip

  3. After the Python modules are built and installed, and you run python tests/test_presto_python.py, if you get a memory error, there are instructions for making a minor change to the Makefile. If you make that change, you should re-run make, and re-build and install the Python modules. Re-running the test should then work.

  4. If you are having trouble with PRESTO creating polycos, you can use prepfold with the -debug option when folding using -timing. That will show you the TEMPO call and keep all of the (usually) temporary output files.

  5. If you are using a Mac, Paul Ray has been running PRESTO a lot and knows several tricks to get it working:

    PRESTO should build almost "out of the box" on a Mac. I have had success using MacPorts to install the necessary dependencies. You will need MacPorts packages: pgplot, cfitsio, glib2, fftw-3, fftw-3-single, and gcc5 You can probably use a more recent gcc instead, if you prefer (e.g. gcc8). It just needs to provide gfortran.

    TEMPO should build easily with gfortran. I did not make any changes to the distro.

    Also you need to delete the line #include "error.h" from src/backend_common.c

    For python, you will need to install numpy, scipy, etc. using MacPorts or pip, as you prefer.

    Finally, in $PRESTO/setup.py you might need to add /opt/local/include to the include_dirs.

    Then, just follow the PRESTO installation instructions: cd src; make; make makewisdom; cd .. ; pip install .