MTL: A patch for mtl-2.1.2-23.tentative

View: New views
2 Messages — Rating Filter:   Alert me  

MTL: A patch for mtl-2.1.2-23.tentative

by Rene van Paassen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        Hello,

I had to fix some stuff in the configure.in to get mtl to recognize
gfortran, blas and lapack on Fedora Core 6. I basically allowed the
environment variables F77 and FORTLIBS to override the automatically
fixed/detected variables for the linux and gnu platforms.

Also, unrelated, found a small error in mtl2lapack.h, with the orgqr
routines, which failed on my compiler.

I am also attaching the rpm spec file I am using to build an mtl
package.

Greetings,
        RenĂ©
--
M.M. (RenĂ©) van Paassen    | ______o____/_|     M.M.vanPaassen@...
Associate Professor       <[___\_\_-----<      t/f: +31 15 27 85370/86480
Aerospace Engineering      |  o'              http://www.cs.lr.tudelft.nl
Delft University of Technology           Kluijverweg 1, NL-2629 HS  Delft
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/
[mtl-fc6-070717.patch]

diff -Nur mtl-2.1.2-23.orig/configure.in mtl-2.1.2-23/configure.in
--- mtl-2.1.2-23.orig/configure.in 2007-04-05 21:36:21.000000000 +0200
+++ mtl-2.1.2-23/configure.in 2007-07-17 14:25:54.000000000 +0200
@@ -56,7 +56,7 @@
 BACKEND=""
 MATHLIB=""
 LDOUT="-o "
-FORTLIBS=""
+# FORTLIBS=""
 
 case "$compiler" in
      kai*)               # KAI C++  http://www.kai.com/
@@ -84,15 +84,15 @@
        echo "Configuring for GNU C++"
        CXX_PICKY_FLAGS="-Wall"
        # BZ_SET_COMPILER($withval,"g++","-ftemplate-depth-30 $CXX_PICKY_FLAGS")
-       CXX="g++"
-       CXXFLAGS="-ftemplate-depth-30 $CXX_PICKY_FLAGS"
-       CXX_OPTIMIZE_FLAGS="-O2 -funroll-loops -fstrict-aliasing -fno-gcse"
-       CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
-       CXXLD="$CXX"
-       F77=g77
-       F77_OPTIMIZE_FLAGS="-O2 -funroll-loops"
-       FORTLIBS=-lg2c
-       CXXFFLAGS="-DMTL_FORTRAN_SYMBOLS_WITH_DOUBLE_TRAILING_UNDERSCORES"
+       CXX=${CXX:-"g++"}
+       CXXFLAGS=${CXXFLAGS:-"-ftemplate-depth-30 $CXX_PICKY_FLAGS"}
+       CXX_OPTIMIZE_FLAGS=${CXX_OPTIMIZE_FLAGS=$:-"-O2 -funroll-loops -fstrict-aliasing -fno-gcse"}
+       CXX_DEBUG_FLAGS=${CXX_DEBUG_FLAGS=$:-"-g -DBZ_DEBUG"}
+       CXXLD=${CXXLD:-"$CXX"}
+       F77=${F77:-g77}
+       F77_OPTIMIZE_FLAGS=${F77_OPTIMIZE_FLAGS:-"-O2 -funroll-loops"}
+       FORTLIBS=${FORTLIBS:-"-lg2c"}
+       CXXFFLAGS=${CXXFFLAGS:-"-DMTL_FORTRAN_SYMBOLS_WITH_DOUBLE_TRAILING_UNDERSCORES"}
      ;;
      msvc*) # Microsoft Visual C++
        echo "Configuring for Microsoft Visual C++"
@@ -126,18 +126,18 @@
 # Set platform-specific fortran compilers and optimization settings
 
 if test "$GXX" = "yes"; then
-    F77=g77
-    F77_OPTIMIZE_FLAGS="-O2 -funroll-loops"
-    FORTLIBS=-lg2c
-    MATHLIB="-lm"
+    F77=${F77:-g77}
+    F77_OPTIMIZE_FLAGS=${F77_OPTIMIZE_FLAGS:-"-O2 -funroll-loops"}
+    FORTLIBS=${FORTLIBS:-"-lg2c"}
+    MATHLIB=${MATHLIB:-"-lm"}
 else
 case "$target" in
   *linux*)
     echo "Linux: assuming g77 fortran compiler"
-    F77=g77
-    F77_OPTIMIZE_FLAGS="-O2 -funroll-loops"
-    FORTLIBS=-lg2c
-    MATHLIB="-lm"
+    F77=${F77:-g77}
+    F77_OPTIMIZE_FLAGS=${F77_OPTIMIZE_FLAGS:-"-O2 -funroll-loops"}
+    FORTLIBS=${FORTLIBS:-"-lg2c"}
+    MATHLIB=${MATHLIB:-"-lm"}
   ;;
   *aix*)
     echo "AIX: assuming f77 and xlf90"
@@ -389,14 +389,13 @@
 # currently defined fortran compiler
 
 # Check how to link to fortran -- will require calling fortran
-MTL_PROG_F77
+AC_PROG_F77
 AC_F77_LIBRARY_LDFLAGS
 
 # AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
 #          ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
 # AC_SEARCH_LIBS
 
-
 AC_CHECK_LIB(blas, main,
   [ AC_MSG_RESULT(BLAS found)
     CXXFFLAGS="$CXXFLAGS -DMTL_USE_BLAS"
diff -Nur mtl-2.1.2-23.orig/mtl/lapack_interface.h mtl-2.1.2-23/mtl/lapack_interface.h
--- mtl-2.1.2-23.orig/mtl/lapack_interface.h 2007-04-10 22:03:10.000000000 +0200
+++ mtl-2.1.2-23/mtl/lapack_interface.h 2007-07-17 14:26:27.000000000 +0200
@@ -313,11 +313,11 @@
 
 
 void dorgqr_(const int& m, const int& n, const int& k,
-     double da[], const int& lda, double dtau[],
+     double da[], const int& lda, const double dtau[],
      double dwork[], const int& ldwork, int& info);
 
 void sorgqr_(const int& m, const int& n, const int& k,
-     float da[], const int& lda, float dtau[],
+     float da[], const int& lda, const float dtau[],
      float dwork[], const int& ldwork, int& info);
 
 void dgesvd_(const char& jobu, const char& jobvt, const int& m, const int& n,
diff -Nur mtl-2.1.2-23.orig/mtl/mtl2lapack.h mtl-2.1.2-23/mtl/mtl2lapack.h
--- mtl-2.1.2-23.orig/mtl/mtl2lapack.h 2007-04-10 22:03:10.000000000 +0200
+++ mtl-2.1.2-23/mtl/mtl2lapack.h 2007-07-17 14:26:16.000000000 +0200
@@ -482,7 +482,7 @@
   }
 
   inline void orgqr(const int& m, const int& n, const int& k,
-    double da[], int& lda, double dtau[], int& info)
+    double da[], int& lda, const double dtau[], int& info)
   {
     int ldwork = 2*m;
     double* work = new double[ldwork];
@@ -491,7 +491,7 @@
   }
 
   inline void orgqr(const int& m, const int& n, const int& k,
-    float da[], int& lda, float dtau[], int& info)
+    float da[], int& lda, const float dtau[], int& info)
   {
     int ldwork = 2*m;
     float* work = new float[ldwork];
@@ -1111,8 +1111,7 @@
     int m = a.nrows();
     int n = a.ncols();
     int info;
-    mtl_lapack_dispatch::orgqr(m, n, tau.size(), a.data(), lda,
-       tau.data(), info);
+    mtl_lapack_dispatch::orgqr(m, n, tau.size(), a.data(), lda, tau.data(), info);
     return info;
   }
 


Prefix: /usr
Name: mtl
Summary: Matrix Template Library
Version: 2.1.2.23.tentative
Release: 2
Source0: mtl-2.1.2-23.tentative.tar.gz
Source1: mtl_reference.tar.gz
Patch0: mtl-fc6-070717.patch
Group: Development
BuildRoot: /var/tmp/%{name}-buildroot
BuildArch: noarch
License: Artistic
Requires: blas, lapack
Buildrequires: automake, lapack-devel, blas-devel

%description
MTL is a template-based library for linear algebra

%prep
rm -rf $RPM_BUILD_ROOT


%setup -q -T -D -b 1 -n mtl_reference
%setup -q -n mtl-2.1.2-23
%patch0 -p1

# version file is incorrect.
cat >VERSION <<EOF
MTLVERSION=2.1.2
MTLRELEASE=23
EOF

aclocal
autoconf
automake --add-missing
autoconf

export F77=gfortran
export FORTLIBS=-lgfortran
./configure --prefix=$RPM_BUILD_ROOT%{prefix} \
        --enable-exceptions --with-lapack

%build

%install
make install DESTDIR=$RPM_BUILD_ROOT

cd $RPM_BUILD_ROOT
find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > \
        $RPM_BUILD_DIR/file.list.%{name}

find . -type f | sed -e 's,^\.,\%attr(-\,root\,root) ,' \
        -e '/\/config\//s|^|%config|' >> \
        $RPM_BUILD_DIR/file.list.%{name}

find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> \
        $RPM_BUILD_DIR/file.list.%{name}

#echo "%docdir %{prefix}/doc/kde" >> $RPM_BUILD_DIR/file.list.%{name}


%clean
rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/file.list.%{name}

%files -f ../file.list.%{name}
%doc $RPM_BUILD_DIR/mtl_reference
%doc license.mtl.txt
%doc contrib/examples

%changelog
* Wed Feb 21 2007 Rene van Paassen <repa@...> - 2.1.2.22-4
- for FC6 and x86_64

* Fri Apr  7 2006 Rene van Paassen <repa@...> - 2.1.2.22-1
- Adapted to FC5

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/

Re: MTL: A patch for mtl-2.1.2-23.tentative

by Peter J. Stieber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

RvP = Rene van Paassen
RvP> Hello,
RvP>
RvP> I had to fix some stuff in the configure.in to
RvP> get mtl to recognize gfortran, blas and lapack
RvP> on Fedora Core 6. I basically allowed the
RvP> environment variables F77 and FORTLIBS to
RvP> override the automatically fixed/detected variables
RvP> for the linux and gnu platforms.

I'm using the tentative release on a Fedora Core 7 box with all of the
latest updates.  Since this box has GNU Autoconf 2.61 and aclocal 1.10
installed and the supplied configure didn't work OTB, I simply ran

autoreconf --install --verbose

to regenerate configure and the related files and this worked for me.

Maybe it's time to add this as a build step and remove configure and
other autoreconf generated files from the distribution.

Pete

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/