diff options
author | jofret | 2008-06-16 08:23:08 +0000 |
---|---|---|
committer | jofret | 2008-06-16 08:23:08 +0000 |
commit | 58f53a3783880802f8c892be70624fc39714a8e9 (patch) | |
tree | e40bf217511cb130879e9a4ed1d09bf0d9b914ca | |
parent | 1d36c0aa8732781ed81e72d5b9fe694dc312807b (diff) | |
download | scilab2c-58f53a3783880802f8c892be70624fc39714a8e9.tar.gz scilab2c-58f53a3783880802f8c892be70624fc39714a8e9.tar.bz2 scilab2c-58f53a3783880802f8c892be70624fc39714a8e9.zip |
* Add --without-blas compilation option
* Add blas header for multiplication
-rw-r--r-- | src/Makefile.in | 2 | ||||
-rwxr-xr-x | src/configure | 58 | ||||
-rw-r--r-- | src/configure.ac | 6 | ||||
-rw-r--r-- | src/includes/blas.h | 148 |
4 files changed, 190 insertions, 24 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index e2d7263b..1b685eee 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -34,7 +34,7 @@ host_triplet = @host@ subdir = . DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure \ - $(top_srcdir)/includes/machine.h.in TODO config/compile \ + $(top_srcdir)/includes/machine.h.in config/compile \ config/config.guess config/config.sub config/depcomp \ config/install-sh config/ltmain.sh config/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 diff --git a/src/configure b/src/configure index 5007c55a..6a7712d1 100755 --- a/src/configure +++ b/src/configure @@ -1493,6 +1493,8 @@ Optional Packages: both] --with-tags[=TAGS] include additional configurations [automatic] --with-stdc99 Enable standard C99 (Used in complex implementation) + --with-blas Enable call to blas library (Used in matrix + operations) --with-fftw compile with the FFTW 3 library --with-atlas-library=DIR Atlas library files are in DIR and we use Atlas @@ -4464,7 +4466,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4467 "configure"' > conftest.$ac_ext + echo '#line 4469 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7516,11 +7518,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7519: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7521: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7523: \$? = $ac_status" >&5 + echo "$as_me:7525: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7806,11 +7808,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7809: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7811: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7813: \$? = $ac_status" >&5 + echo "$as_me:7815: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7910,11 +7912,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7913: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7915: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7917: \$? = $ac_status" >&5 + echo "$as_me:7919: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10287,7 +10289,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10290 "configure" +#line 10292 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10387,7 +10389,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10390 "configure" +#line 10392 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12788,11 +12790,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12791: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12793: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12795: \$? = $ac_status" >&5 + echo "$as_me:12797: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12892,11 +12894,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12895: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12897: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12899: \$? = $ac_status" >&5 + echo "$as_me:12901: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14490,11 +14492,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14493: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14495: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14497: \$? = $ac_status" >&5 + echo "$as_me:14499: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14594,11 +14596,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14597: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14599: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14601: \$? = $ac_status" >&5 + echo "$as_me:14603: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16814,11 +16816,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16817: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16819: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16821: \$? = $ac_status" >&5 + echo "$as_me:16823: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17104,11 +17106,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17107: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17109: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17111: \$? = $ac_status" >&5 + echo "$as_me:17113: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17208,11 +17210,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17211: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17213: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17215: \$? = $ac_status" >&5 + echo "$as_me:17217: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21845,6 +21847,16 @@ done CFLAGS="$CFLAGS -std=c99" fi + +# Check whether --with-blas was given. +if test "${with_blas+set}" = set; then + withval=$with_blas; +fi + +if test "$with_blas" = no; then + CFLAGS="$CFLAGS -DWITHOUT_BLAS" +fi + # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; diff --git a/src/configure.ac b/src/configure.ac index 1d763d18..a3d4ee1f 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -58,6 +58,12 @@ if test "$with_stdc99" = yes; then CFLAGS="$CFLAGS -std=c99" fi +AC_ARG_WITH(blas, + AC_HELP_STRING([--with-blas],[Enable call to blas library (Used in matrix operations)])) +if test "$with_blas" = no; then + CFLAGS="$CFLAGS -DWITHOUT_BLAS" +fi + AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[Use verbose messages through compilation process])) if test "$enable_debug" = yes; then diff --git a/src/includes/blas.h b/src/includes/blas.h new file mode 100644 index 00000000..fc12ac17 --- /dev/null +++ b/src/includes/blas.h @@ -0,0 +1,148 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __BLAS_H__ +#define __BLAS_H__ + +/* + SUBROUTINE DGEMM ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, + $ BETA, C, LDC ) +* .. Scalar Arguments .. + CHARACTER*1 TRANSA, TRANSB + INTEGER M, N, K, LDA, LDB, LDC + DOUBLE PRECISION ALPHA, BETA +* .. Array Arguments .. + DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ) +* .. +C WARNING : this routine has been modified for Scilab (see comments +C Cscilab) because algorithm is not ok if A matrix contains NaN +C (NaN*0 should be NaN, not 0) +* Purpose +* ======= +* +* DGEMM performs one of the matrix-matrix operations +* +* C := alpha*op( A )*op( B ) + beta*C, +* +* where op( X ) is one of +* +* op( X ) = X or op( X ) = X', +* +* alpha and beta are scalars, and A, B and C are matrices, with op( A ) +* an m by k matrix, op( B ) a k by n matrix and C an m by n matrix. +* +* Parameters +* ========== +* +* TRANSA - CHARACTER*1. +* On entry, TRANSA specifies the form of op( A ) to be used in +* the matrix multiplication as follows: +* +* TRANSA = 'N' or 'n', op( A ) = A. +* +* TRANSA = 'T' or 't', op( A ) = A'. +* +* TRANSA = 'C' or 'c', op( A ) = A'. +* +* Unchanged on exit. +* +* TRANSB - CHARACTER*1. +* On entry, TRANSB specifies the form of op( B ) to be used in +* the matrix multiplication as follows: +* +* TRANSB = 'N' or 'n', op( B ) = B. +* +* TRANSB = 'T' or 't', op( B ) = B'. +* +* TRANSB = 'C' or 'c', op( B ) = B'. +* +* Unchanged on exit. +* +* M - INTEGER. +* On entry, M specifies the number of rows of the matrix +* op( A ) and of the matrix C. M must be at least zero. +* Unchanged on exit. +* +* N - INTEGER. +* On entry, N specifies the number of columns of the matrix +* op( B ) and the number of columns of the matrix C. N must be +* at least zero. +* Unchanged on exit. +* +* K - INTEGER. +* On entry, K specifies the number of columns of the matrix +* op( A ) and the number of rows of the matrix op( B ). K must +* be at least zero. +* Unchanged on exit. +* +* ALPHA - DOUBLE PRECISION. +* On entry, ALPHA specifies the scalar alpha. +* Unchanged on exit. +* +* A - DOUBLE PRECISION array of DIMENSION ( LDA, ka ), where ka is +* k when TRANSA = 'N' or 'n', and is m otherwise. +* Before entry with TRANSA = 'N' or 'n', the leading m by k +* part of the array A must contain the matrix A, otherwise +* the leading k by m part of the array A must contain the +* matrix A. +* Unchanged on exit. +* +* LDA - INTEGER. +* On entry, LDA specifies the first dimension of A as declared +* in the calling (sub) program. When TRANSA = 'N' or 'n' then +* LDA must be at least max( 1, m ), otherwise LDA must be at +* least max( 1, k ). +* Unchanged on exit. +* +* B - DOUBLE PRECISION array of DIMENSION ( LDB, kb ), where kb is +* n when TRANSB = 'N' or 'n', and is k otherwise. +* Before entry with TRANSB = 'N' or 'n', the leading k by n +* part of the array B must contain the matrix B, otherwise +* the leading n by k part of the array B must contain the +* matrix B. +* Unchanged on exit. +* +* LDB - INTEGER. +* On entry, LDB specifies the first dimension of B as declared +* in the calling (sub) program. When TRANSB = 'N' or 'n' then +* LDB must be at least max( 1, k ), otherwise LDB must be at +* least max( 1, n ). +* Unchanged on exit. +* +* BETA - DOUBLE PRECISION. +* On entry, BETA specifies the scalar beta. When BETA is +* supplied as zero then C need not be set on input. +* Unchanged on exit. +* +* C - DOUBLE PRECISION array of DIMENSION ( LDC, n ). +* Before entry, the leading m by n part of the array C must +* contain the matrix C, except when beta is zero, in which +* case C need not be set on entry. +* On exit, the array C is overwritten by the m by n matrix +* ( alpha*op( A )*op( B ) + beta*C ). +* +* LDC - INTEGER. +* On entry, LDC specifies the first dimension of C as declared +* in the calling (sub) program. LDC must be at least +* max( 1, m ). +* Unchanged on exit. +* +* +* Level 3 Blas routine. +*/ + +void dgemm_(char *TRANSA, char* TRANSB, int *M, int *N, int *K, + double *ALPHA, double *A, int *LDA, + double *B, int *LDB, double *BETA, + double *C, int *LDC); + +#endif /* !__BLAS_H__ */ |