[vsipl++] ATLAS Patch

Assem Salama assem at codesourcery.com
Mon Jun 5 17:31:20 UTC 2006


Jules,
  The reason that I had to change the lib names to lib... is because 
when I do a make check and try link with -llapack and -lcblas, it can't 
find them because they are called lapack.a and cblas.a instead of 
liblapack.a and libcblas.a.

Assem

Jules Bergmann wrote:
> Assem Salama wrote:
>> Everyone,
>>  This patch use the BLAS that comes with LAPACK. This allows us to 
>> not have to deal with ATLAS at all.
>>
>> Thanks,
>> Assem Salama
>>
> -------------------------------------------------------------------
>>
>> Index: configure.ac
>> ===================================================================
>> RCS file: /home/cvs/Repository/vpp/configure.ac,v
>> retrieving revision 1.105
>> diff -u -r1.105 configure.ac
>> --- configure.ac    14 May 2006 20:57:05 -0000    1.105
>> +++ configure.ac    3 Jun 2006 10:40:47 -0000
>> @@ -175,8 +175,9 @@
>>            Library), acml (AMD Core Math Library), atlas (system
>>            ATLAS/LAPACK installation), generic (system generic
>>            LAPACK installation), builtin (Sourcery VSIPL++'s
>> -          builtin ATLAS/C-LAPACK), and fortran-builtin (Sourcery
>> -          VSIPL++'s builtin ATLAS/Fortran-LAPACK). +          
>> builtin ATLAS/C-LAPACK), fortran-builtin (Sourcery
>> +          VSIPL++'s builtin ATLAS/Fortran-LAPACK, and a simple (Lapack
>> +                  that doesn't require atlas).).            
>> Specifying 'no' disables search for a LAPACK library.]),,
>>    [with_lapack=probe])
>
> Instead of "simple", let's call this "simple-builtin" to be consistent 
> with the other builtin options.
>
>>  
>> @@ -492,6 +493,9 @@
>>  #endif])
>>  vsip_impl_avoid_posix_memalign=
>>  
>> +AC_CHECK_HEADERS([png.h], +                 [AC_SUBST(HAVE_PNG_H, 
>> 1)], +                 [], [// no prerequisites])
>
> What is this doing here?
>
>>  
>>  #
>>  # Find the FFT backends.
>> @@ -1275,6 +1279,8 @@
>>      lapack_packages="atlas generic1 generic2 builtin"
>>    elif test "$with_lapack" == "generic"; then
>>      lapack_packages="generic1 generic2"
>> +  elif test "$with_lapack" == "simple"; then
>> +    lapack_packages="simple";
>>    else
>>      lapack_packages="$with_lapack"
>>    fi
>> @@ -1515,6 +1521,19 @@
>>          AC_MSG_RESULT([not present])
>>      continue
>>        fi
>> +    elif test "$trypkg" == "simple"; then
>> +
>> +      curdir=`pwd`
>
> Because this library is builtin, we need to handle CPPFLAGS and 
> LDFLAGS differently than normal.
>
> For a normal library, such a math library that is already installed on 
> the system, for example MKL, we would add -I and -L options to 
> CPPFLAGS and LDFLAGS.  The CPPFLAGS/LDFLAGS would get used both for 
> building VSIPL++ and they would get put into the .pc file so that 
> applications built with VSIPL++ would know where to find MKL.
>
> For a builtin library, such as LAPACK and BLAS in this case, the 
> library is not already installed on the system (we are doing that as 
> part of making VSIPL++).  This creates a problem.  When building the 
> VSIPL++ library proper (i.e. doing a 'make' or 'make check'), we need 
> to refer to the builtin library in its source tree location (it won't 
> be installed in its final location until 'make install').  However, 
> the -I and -L options that go into the .pc file should reflect its 
> installed location, not its source tree location.
>
> To handle this, we do the following for builtin libraries:
>  - -I and -L options that are to be used while building VSIPL++ go into
>    INT_CPPFLAGS and INT_LDFLAGS.
>  - -I and -L options that are to be used by applications once VSIPL++
>    has been installed should go into CPPFLAGS and LDFLAGS.
>  - libraries that will be built go into LATE_LIBS.  Putting them
>    into LIBS will break subsequent AC_LINK_IFELSE's in the
>    configure file.
>
> So you should do:
>
>     INT_CPPFLAGS="$INT_CPPFLAGS -I$srcdir/vendor/clapack/SRC"
>     INT_LDFLAGS="$INT_LDFLAGS -L$curdir/vendor/clapack"
>     LATE_LIBS="$LATE_LIBS -llapack -lcblas"
>     CPPFLAGS="$keep_CPPFLAGS -I$includedir/lapack"
>     LDFLAGS="$keep_LDFLAGS -L$libdir/lapack"
>
>
>> +      CPPFLAGS="$keep_CPPFLAGS -I$srcdir/vendor/clapack/SRC"
>
> Are there include files in clapack/SRC that are necessary for building 
> other files in the library?
>
>> +      LDFLAGS="$keep_LDFLAGS -L$curdir/vendor/clapack"
>> +      LIBS="$keep_LIBS -llapack -lcblas"
>> +
>> +      AC_SUBST(USE_SIMPLE_LAPACK, 1)
>> +      +      lapack_use_ilaenv=0
>> +      lapack_found="simple"
>> +      break
>>      fi
>>  
>> Index: vendor/GNUmakefile.inc.in
>> ===================================================================
>> RCS file: /home/cvs/Repository/vpp/vendor/GNUmakefile.inc.in,v
>> retrieving revision 1.15
>> diff -u -r1.15 GNUmakefile.inc.in
>> --- vendor/GNUmakefile.inc.in    11 May 2006 11:29:04 -0000    1.15
>> +++ vendor/GNUmakefile.inc.in    3 Jun 2006 10:41:15 -0000
>> @@ -12,6 +12,7 @@
>>  # Variables
>>  ######################################################################## 
>>
>>  
>> +USE_SIMPLE_LAPACK  := @USE_SIMPLE_LAPACK@
>>  USE_BUILTIN_ATLAS  := @USE_BUILTIN_ATLAS@
>>  USE_FORTRAN_LAPACK := @USE_FORTRAN_LAPACK@
>>  USE_BUILTIN_LIBF77 := @USE_BUILTIN_LIBF77@
>> @@ -20,7 +21,7 @@
>>  USE_BUILTIN_FFTW_DOUBLE := @USE_BUILTIN_FFTW_DOUBLE@
>>  USE_BUILTIN_FFTW_LONG_DOUBLE := @USE_BUILTIN_FFTW_LONG_DOUBLE@
>>  
>> -vendor_CLAPACK    = vendor/clapack/lapack.a
>> +vendor_CLAPACK    = vendor/clapack/liblapack.a
>
> Let's keep the name as lapack.a, so that it is consitent with the 
> Fortran lapack.a.
>
>>  vendor_FLAPACK    = vendor/lapack/lapack.a
>>  vendor_PRE_LAPACK = vendor/atlas/lib/libprelapack.a
>>  vendor_USE_LAPACK = vendor/atlas/lib/liblapack.a
>> @@ -33,6 +34,7 @@
>>  endif
>>  
>>  vendor_LIBF77      = vendor/clapack/F2CLIBS/libF77/libF77.a
>> +vendor_SIMPLE_BLAS = vendor/clapack/libcblas.a
>>  
>>  
>>  vendor_ATLAS_LIBS :=                \
>> @@ -104,7 +106,6 @@
>>      @$(MAKE) -C vendor/clapack/F2CLIBS/libF77 clean > 
>> libF77.clean.log 2>&1
>>  endif
>>  
>> -
>>  clean::
>>      @echo "Cleaning ATLAS (see atlas.clean.log)"
>>      @$(MAKE) -C vendor/atlas clean > atlas.clean.log 2>&1
>> @@ -123,6 +124,53 @@
>>  endif # USE_FORTRAN_LAPACK
>>  
>>  endif # USE_BUILTIN_ATLAS
>> +################################################################################ 
>>
>> +
>> +ifdef USE_SIMPLE_LAPACK
>> +all:: $(vendor_SIMPLE_BLAS) $(vendor_REF_LAPACK)
>> +
>> +libs += $(vendor_F77BLAS) $(vendor_REF_LAPACK)
>> +
>> +$(vendor_SIMPLE_BLAS):
>> +    @echo "Building simple BLAS (see simpleBLAS.build.log)"
>> +    @$(MAKE) -C vendor/clapack/blas/SRC all > simpleBLAS.build.log 2>&1
>> +
>> +ifdef USE_FORTRAN_LAPACK
>> +$(vendor_FLAPACK):
>> +    @echo "Building LAPACK (see lapack.build.log)"
>> +    @$(MAKE) -C vendor/lapack/SRC all > lapack.build.log 2>&1
>> +
>> +clean::
>> +    @echo "Cleaning LAPACK (see lapack.clean.log)"
>> +    @$(MAKE) -C vendor/lapack/SRC clean > lapack.clean.log 2>&1
>> +else
>> +$(vendor_CLAPACK):
>> +    @echo "Building CLAPACK (see clapack.build.log)"
>> +    @$(MAKE) -C vendor/clapack/SRC all > clapack.build.log 2>&1
>> +
>> +clean::
>> +    @echo "Cleaning CLAPACK (see clapack.clean.log)"
>> +    @$(MAKE) -C vendor/clapack/SRC clean > clapack.clean.log 2>&1
>> +endif # USE_FORTRAN_LAPACK
>> +
>> +ifdef USE_BUILTIN_LIBF77
>> +all:: $(vendor_LIBF77)
>> +
>> +libs += $(vendor_LIBF77)
>> +
>> +$(vendor_LIBF77):
>> +    @echo "Building libF77 (see libF77.build.log)"
>> +    @$(MAKE) -C vendor/clapack/F2CLIBS/libF77 all > libF77.build.log 
>> 2>&1
>> +
>> +install:: $(vendor_LIBF77)
>> +    $(INSTALL_DATA) $(vendor_LIBF77) $(DESTDIR)$(libdir)
>> +
>> +clean::
>> +    @echo "Cleaning libF77 (see libF77.clean.log)"
>> +    @$(MAKE) -C vendor/clapack/F2CLIBS/libF77 clean > 
>> libF77.clean.log 2>&1
>> +endif # USE_BUILTIN_LIBF77
>> +
>> +endif # USE_SIMPLE_LAPACK
>
> We should be able to reorganize USE_BUILTIN_ATLAS and USE_SIMPL_LAPACK 
> so that they share common rules (such as the rules for building 
> LAPACK, LIBF77, etc).  However, let's get this working and checked in 
> first, then we can fix this later.
>>  
>>  
>>  
>> Index: vendor/clapack/blas/SRC/GNUmakefile.in
>> ===================================================================
>
> Looks OK.
>
>> Index: vendor/clapack/blas/SRC/Makefile
>> ===================================================================
>
> Looks OK.
>
>> Index: vendor/clapack/SRC/make.inc.in
>> ===================================================================
>> RCS file: /home/cvs/Repository/clapack/SRC/make.inc.in,v
>> retrieving revision 1.4
>> diff -u -r1.4 make.inc.in
>> --- vendor/clapack/SRC/make.inc.in    29 Mar 2006 16:07:54 -0000    1.4
>> +++ vendor/clapack/SRC/make.inc.in    3 Jun 2006 12:23:42 -0000
>> @@ -45,8 +45,8 @@
>>  #  machine-specific, optimized BLAS library should be used whenever
>>  #  possible.)
>>  #
>> -BLASLIB      = ../../blas$(PLAT).a
>> -LAPACKLIB    = lapack$(PLAT).a
>> +BLASLIB      = ../../libcblas$(PLAT).a
>
> Let's call this libblas because it is a Fortran BLAS API, not a CBLAS 
> API.
>
>> +LAPACKLIB    = liblapack$(PLAT).a
>
> Let's leave this name unchanged so that it stays consistent with 
> Fortran Lapack.
>
>>  F2CLIB       = ../../F2CLIBS/libF77.a ../../F2CLIBS/libI77.a
>>  TMGLIB       = tmglib$(PLAT).a
>>  EIGSRCLIB    = eigsrc$(PLAT).a
>
>




More information about the vsipl++ mailing list