help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compiling SuiteSparse


From: Sergei Steshenko
Subject: compiling SuiteSparse
Date: Sat, 26 May 2012 18:46:08 -0700 (PDT)

Hello,

compiling SuiteSparse happens to be tricky, and I think I've done it 
successfully, so I want to share my findings.

These findings apply to both SuiteSparse-3.7.0, SuiteSparse-3.7.1; Octave 'make 
check' completes successfully (if it matters). Also, TBB is used during 
compilation and linking.

As you probably know, in order to compile SuiteSparse one has to edit 
'UFconfig/UFconfig.mk' file.


Reading comments in this file one can see:

     98 # UMFPACK and CHOLMOD both require the BLAS.  CHOLMOD also requires 
LAPACK.
     99 # See Kazushige Goto's BLAS at 
http://www.cs.utexas.edu/users/flame/goto/ or
    100 # http://www.tacc.utexas.edu/~kgoto/ for the best BLAS to use with 
CHOLMOD.
    101 # LAPACK is at http://www.netlib.org/lapack/ .  You can use the standard
    102 # Fortran LAPACK along with Goto's BLAS to obtain very good performance.
    103 # CHOLMOD gets a peak numeric factorization rate of 3.6 Gflops on a 3.2 
GHz
    104 # Pentium 4 (512K cache, 4GB main memory) with the Goto BLAS, and 6 
Gflops
    105 # on a 2.5Ghz dual-core AMD Opteron.
    106
    107 # These settings will probably not work, since there is no fixed 
convention for
    108 # naming the BLAS and LAPACK library (*.a or *.so) files.
    109
    110 # This is probably slow ... it might connect to the Standard Reference 
BLAS:
    111 BLAS = -lblas -lgfortran
    112 LAPACK = -llapack
.

Well, what is tricky is to make this fast.

Since I am (still) using 'atlas', linking with it happened to be tricky.

I am about to show how I am doing this. Since I am building using my 
AppsFromScratch, it's easier in this case to simply create the needed 
'UFconfig/UFconfig.mk' file "from scratch" rather than parse and edit the 
existing one.

The piece of Perl code creating the file contents is:

"

                  print $fh <<EOD

CF = \$(CFLAGS) \$(CPPFLAGS) \$(TARGET_ARCH) -O3 -fexceptions -fPIC
RANLIB = ranlib
ARCHIVE = \$(AR) \$(ARFLAGS)
CP = cp -f
MV = mv -f
F77 = gfortran
F77FLAGS = \$(FFLAGS) -O
F77LIB =
LIB = -lm
INSTALL_LIB = $this_sub_args{install_prefix}/lib
INSTALL_INCLUDE = $this_sub_args{install_prefix}/include
MEX = mex -O -largeArrayDims -lmwlapack -lmwblas


BLAS = $this_sub_args{LDFLAGS} -lblas -lgfortran -lgcc_s
LAPACK = $this_sub_args{LDFLAGS} -llapack -lcblas -latlas

XERBLA =

METIS_PATH = ../../$metis_versioned_target
METIS = ../../$metis_versioned_target/libmetis.a

UMFPACK_CONFIG =
CHOLMOD_CONFIG =

TBB = $this_sub_args{LDFLAGS} -ltbb

RTLIB = -lrt

CC = gcc
CFLAGS = $this_sub_args{CPPFLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes 
-Wstrict-prototypes -Wredundant-decls -Wnested-externs -Wdisabled-optimization 
-O3 -fexceptions


CLEAN = *.o *.obj *.ln *.bb *.bbg *.da *.tcov *.gcov gmon.out *.bak *.d *.gcda 
*.gcno
EOD

"

The tricky part was:

"

BLAS = $this_sub_args{LDFLAGS} -lblas -lgfortran -lgcc_s
LAPACK = $this_sub_args{LDFLAGS} -llapack -lcblas -latlas

",

and the trickiest part was getting rid of "hidden symbol `__powidf2' in ..." 
message during linking.

Doing web search I've found this: http://wiki.sagemath.org/freebsd/sage-4.5 and 
there:

"The fix is to add a dependency on libgcc_s.so when (re-)building liblapack.so 
in make_correct_shared.sh.".

So, that's why one can see '-lgcc_s' above.

A couple of minor things - in both 'CSparse3/Lib/Makefile', 
'SPQR/Demo/Makefile' I added

CC = gcc

line in the very beginning - otherwise 'cc' compiler is used.

My actual 'UFconfig/UFconfig.mk' file is attached.

Regards,
  Sergei.

Attachment: UFconfig.mk
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]