Compiling ARPACK++

I have had difficulties in compiling the examples code provided by ARPACK++. After some googling, it turns out that ARPACK++ is not compatible with newer version of GCC. Luckily, I found a page that provide a patch. So let me provide the steps to compile ARPACK++ .

1. First you have to install ARPACK, UMFPACK, and SuperLU.

2. To install ARPACK, download the files from (http://www.caam.rice.edu/software/ARPACK/) make sure to download the “patch” file as well. Then simply extract the two files:

        zcat arpack96.tar.gz | tar -xvf -
        zcat patch.tar.gz    | tar -xvf -
3. In the ARPACK folder, modify ARmake.inc. It is better to use the BLAS and LAPACK provided by ARPACK. Sometimes using other libraries creates problem. And for my case, I need to modify the location of the ARPACK source tree and the location for "make" program.
4. type make lib. This should compile arpack for your platform, copy the library to your local library locations. You should test also the EXAMPLES codes provided to make sure everything went well.
5. Now install SuperLU, downlaod the source code from (http://crd.lbl.gov/~xiaoye/SuperLU/#superlu).
6. Modify make.inc. This is the one that I use:
SuperLUroot     = /scratch/kurniawano/Download/SuperLU_3.1
SUPERLULIB      = $(SuperLUroot)/lib/libsuperlu_3.1.a
BLASDEF         = -DUSE_VENDOR_BLAS
BLASLIB         = /usr/lib64/libblas.a
TMGLIB          = libtmglib.a
LIBS            = $(SUPERLULIB) $(BLASLIB)
and
CDEFS        = -DAdd_
with "one" underscore after "-DAdd"
7. Then type make, if there is an error due to the timer, just type make again and it will continue compiling.
8. Now UMFPACK is installed from the SuiteSparse package. I have written some other posts on this package installation. Just search on this blog.
9. So now download Arpack++ from (http://www.ime.unicamp.br/~chico/arpack++/), and its patch from (http://reuter.mit.edu/index.php/software/arpackpatch/).
10. extract Arpack++ and copy the patch file to the arpack++ folder, and type 
patch -p1 < arpack++1.2.patch.diff
11. After that modify Makefile.inc, especially the path to the Arpack++ and the following libraries:

ARPACK_LIB   = /scratch/kurniawano/local/lib/libarpack.a
LAPACK_LIB   = -llapack
UMFPACK_LIB  = /scratch/kurniawano/local/lib/libumfpack.a
SUPERLU_LIB  = /scratch/kurniawano/local/lib/libsuperlu.a
BLAS_LIB     = -lblas
FORTRAN_LIBS = /scratch/kurniawano/local/lib/libg2c.a
Advertisements

8 Responses

  1. Hello kurniawano,

    Following your instruction, I ‘ve successfully compile the examples in folder AREIG.

    But when I run them, except acompreg, the other three all display “Segmentation fault”

    Do you have any idea how to solve this problem? Many thanks.

  2. Hi,
    the compiling went fine with the steps you gave above.But i am getting a segmentation fault with the examples in superlu directory.Could u tell me what the problem could be.

  3. […] loosely followed these helpful instructions. This also assumes that you have a universal (32-bit and 64-bit) build of f2c, if not I have […]

  4. […] follow instructions 9 through 11 of these instructions in order to patch the outdated arpack++ code. I repeat them here: 9. So now download Arpack++ from […]

  5. Hi,
    Thanks very much kurniawano for this page. I also have these Segfault with superlu, did anybody found out what is the problem?

  6. Hi,
    It seems that the segfault problems come from Superlu 4.0, I tried with Superlu 2.0 and it works now.

  7. Hi Nicolas,
    A novide here. I have this same segmentation fault problem. I followed the installation of arpack++ in:
    https://help.ubuntu.com/community/Arpack%2B%2B
    however superlu3.0 is used there, can you expand what you did using superlu2.0 in order to link the libraries.

  8. I got it to work now with superLU 2.0,
    Below is my make.inc file.
    Also replace ../ $(SUPERLULIB) <- $(SUPERLULIB)
    in SuperLU/*/Makefile

    ###########################################################################
    #
    # Program: SuperLU
    #
    # Module: make.inc
    #
    # Purpose: Top-level Definitions
    #
    # Creation date: October 2, 1995
    #
    # Modified: February 4, 1997 Version 1.0
    # November 15, 1997 Version 1.1
    # September 1, 1999 Version 2.0
    #
    ############################################################################
    #
    # The machine (platform) identifier to append to the library names
    #
    PLAT = _linux

    #
    # The name of the libraries to be created/linked to
    #
    SuperLUroot = $(HOME)/SuperLU
    SUPERLULIB = $(SuperLUroot)/libsuperlu.a
    TMGLIB = libtmglib.a

    BLASDEF = -DUSE_VENDOR_BLAS
    BLASLIB = -L/my_directory_for_blas -lblas

    LIBS = $(SUPERLULIB) $(BLASLIB)

    #
    # The archiver and the flag(s) to use when building archive (library)
    # If your system has no ranlib, set RANLIB = echo.
    #
    ARCH = ar
    ARCHFLAGS = cr
    RANLIB = ranlib

    CC = gcc
    CFLAGS = -DPRNTlevel=0 -O3
    NOOPTS =
    FORTRAN = gfortran
    FFLAGS = -lgfortran
    LOADER = $(FORTRAN)
    LOADOPTS =

    #
    # C preprocessor defs for compilation for the Fortran interface
    # (-DNoChange, -DAdd_, -DAdd__, or -DUpCase)
    #
    CDEFS = -DAdd_
    #
    # The directory in which Matlab is installed
    #
    MATLAB = /usr/sww/matlab

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: