this code will be compiled for a hypre blas library to enhance portability of

IJ_matrix_vector.  This will automatically be sued unless the configure
--with-blas option is used, which looks for the blas library elsewhere
This commit is contained in:
dwalker 1999-09-15 22:57:11 +00:00
parent 7a043cae48
commit 2a0573d712
7 changed files with 796 additions and 0 deletions

82
blas/Makefile Normal file
View File

@ -0,0 +1,82 @@
# Generated automatically from Makefile.in by configure.
#BHEADER***********************************************************************
# (c) 1997 The Regents of the University of California
#
# See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
# notice, contact person, and disclaimer.
#
# $Revision$
#EHEADER***********************************************************************
.SUFFIXES:
.SUFFIXES: .c .f .o
srcdir = .
CC = mpicc
C_COMPILE_FLAGS= -O
CXX_COMPILE_FLAGS= -O
F77_COMPILE_FLAGS= -O -silent
CINCLUDES=
CDEFS = -DHYPRE_NO_PTHREAD_MANGLING
CFLAGS =\
-I.\
${C_COMPILE_FLAGS}\
${CINCLUDES}\
${CDEFS}
RANLIB= ranlib
LIBFLAGS = -lm
LDLIBFLAGS =
HEADERS =\
f2c.h
FILES =\
dcopy.c \
ddot.c \
dnrm2.c
OBJS = ${FILES:.c=.o}
##################################################################
# Targets
##################################################################
all: libHYPRE_blas.a
install: all
@cp -f f2c.h $$HYPRE_INSTALL_DIR/include/.
@cp -f libHYPRE_*.a $$HYPRE_INSTALL_DIR/lib/.
clean:
@rm -f *.o
veryclean: clean
@rm -f libHYPRE_*.a
##################################################################
# Rules
##################################################################
libHYPRE_blas.a: ${OBJS}
@echo "Building $@ ... "
ar -rcu $@ ${OBJS}
${RANLIB} $@
${OBJS}: ${HEADERS}
##################################################################
# Generic rules
##################################################################
.c.o:
${CC} -o $@ -c ${CFLAGS} $<
.f.o:
${F77} -o $@ -c ${FFLAGS} $<

82
blas/Makefile.in Normal file
View File

@ -0,0 +1,82 @@
#BHEADER***********************************************************************
# (c) 1997 The Regents of the University of California
#
# See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
# notice, contact person, and disclaimer.
#
# $Revision$
#EHEADER***********************************************************************
.SUFFIXES:
.SUFFIXES: .c .f .o
srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
C_COMPILE_FLAGS=@CFLAGS@
CXX_COMPILE_FLAGS=@CXXFLAGS@
F77_COMPILE_FLAGS=@F77FLAGS@
CINCLUDES=@INCLUDES@
CDEFS = -DHYPRE_NO_PTHREAD_MANGLING
CFLAGS =\
-I.\
${C_COMPILE_FLAGS}\
${CINCLUDES}\
${CDEFS}
RANLIB= @RANLIB@
LIBFLAGS = @LIBDIRS@ @LIBS@
LDLIBFLAGS = @LDLIBDIRS@ @LDLIBS@
HEADERS =\
f2c.h
FILES =\
dcopy.c \
ddot.c \
dnrm2.c
OBJS = ${FILES:.c=.o}
##################################################################
# Targets
##################################################################
all: libHYPRE_blas.a
install: all
@cp -f f2c.h $$HYPRE_INSTALL_DIR/include/.
@cp -f libHYPRE_*.a $$HYPRE_INSTALL_DIR/lib/.
clean:
@rm -f *.o
veryclean: clean
@rm -f libHYPRE_*.a
##################################################################
# Rules
##################################################################
libHYPRE_blas.a: ${OBJS}
@echo "Building $@ ... "
ar -rcu $@ ${OBJS}
${RANLIB} $@
${OBJS}: ${HEADERS}
##################################################################
# Generic rules
##################################################################
.c.o:
${CC} -o $@ -c ${CFLAGS} $<
.f.o:
${F77} -o $@ -c ${FFLAGS} $<

92
blas/dcopy.c Normal file
View File

@ -0,0 +1,92 @@
/* dcopy.f -- translated by f2c (version 19960315).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
/* Subroutine */ int dcopy_(n, dx, incx, dy, incy)
integer *n;
doublereal *dx;
integer *incx;
doublereal *dy;
integer *incy;
{
/* System generated locals */
integer i__1;
/* Local variables */
static integer i__, m, ix, iy, mp1;
/* copies a vector, x, to a vector, y. */
/* uses unrolled loops for increments equal to one. */
/* jack dongarra, linpack, 3/11/78. */
/* Parameter adjustments */
--dy;
--dx;
/* Function Body */
if (*n <= 0) {
return 0;
}
if (*incx == 1 && *incy == 1) {
goto L20;
}
/* code for unequal increments or equal increments */
/* not equal to 1 */
ix = 1;
iy = 1;
if (*incx < 0) {
ix = (-(*n) + 1) * *incx + 1;
}
if (*incy < 0) {
iy = (-(*n) + 1) * *incy + 1;
}
i__1 = *n;
for (i__ = 1; i__ <= i__1; ++i__) {
dy[iy] = dx[ix];
ix += *incx;
iy += *incy;
/* L10: */
}
return 0;
/* code for both increments equal to 1 */
/* clean-up loop */
L20:
m = *n % 7;
if (m == 0) {
goto L40;
}
i__1 = m;
for (i__ = 1; i__ <= i__1; ++i__) {
dy[i__] = dx[i__];
/* L30: */
}
if (*n < 7) {
return 0;
}
L40:
mp1 = m + 1;
i__1 = *n;
for (i__ = mp1; i__ <= i__1; i__ += 7) {
dy[i__] = dx[i__];
dy[i__ + 1] = dx[i__ + 1];
dy[i__ + 2] = dx[i__ + 2];
dy[i__ + 3] = dx[i__ + 3];
dy[i__ + 4] = dx[i__ + 4];
dy[i__ + 5] = dx[i__ + 5];
dy[i__ + 6] = dx[i__ + 6];
/* L50: */
}
return 0;
} /* dcopy_ */

96
blas/ddot.c Normal file
View File

@ -0,0 +1,96 @@
/* ddot.f -- translated by f2c (version 19960315).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
doublereal ddot_(n, dx, incx, dy, incy)
integer *n;
doublereal *dx;
integer *incx;
doublereal *dy;
integer *incy;
{
/* System generated locals */
integer i__1;
doublereal ret_val;
/* Local variables */
static integer i__, m;
static doublereal dtemp;
static integer ix, iy, mp1;
/* forms the dot product of two vectors. */
/* uses unrolled loops for increments equal to one. */
/* jack dongarra, linpack, 3/11/78. */
/* Parameter adjustments */
--dy;
--dx;
/* Function Body */
ret_val = 0.;
dtemp = 0.;
if (*n <= 0) {
return ret_val;
}
if (*incx == 1 && *incy == 1) {
goto L20;
}
/* code for unequal increments or equal increments */
/* not equal to 1 */
ix = 1;
iy = 1;
if (*incx < 0) {
ix = (-(*n) + 1) * *incx + 1;
}
if (*incy < 0) {
iy = (-(*n) + 1) * *incy + 1;
}
i__1 = *n;
for (i__ = 1; i__ <= i__1; ++i__) {
dtemp += dx[ix] * dy[iy];
ix += *incx;
iy += *incy;
/* L10: */
}
ret_val = dtemp;
return ret_val;
/* code for both increments equal to 1 */
/* clean-up loop */
L20:
m = *n % 5;
if (m == 0) {
goto L40;
}
i__1 = m;
for (i__ = 1; i__ <= i__1; ++i__) {
dtemp += dx[i__] * dy[i__];
/* L30: */
}
if (*n < 5) {
goto L60;
}
L40:
mp1 = m + 1;
i__1 = *n;
for (i__ = mp1; i__ <= i__1; i__ += 5) {
dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1] + dx[
i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] + dx[i__ +
4] * dy[i__ + 4];
/* L50: */
}
L60:
ret_val = dtemp;
return ret_val;
} /* ddot_ */

213
blas/dnrm2.c Normal file
View File

@ -0,0 +1,213 @@
/* dnrm2.f -- translated by f2c (version 19960315).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
doublereal dnrm2_(n, dx, incx)
integer *n;
doublereal *dx;
integer *incx;
{
/* Initialized data */
static doublereal zero = 0.;
static doublereal one = 1.;
static doublereal cutlo = 8.232e-11;
static doublereal cuthi = 1.304e19;
/* Format strings */
static char fmt_30[] = "";
static char fmt_50[] = "";
static char fmt_70[] = "";
static char fmt_110[] = "";
/* System generated locals */
integer i__1;
doublereal ret_val, d__1;
/* Builtin functions */
double sqrt();
/* Local variables */
static doublereal xmax;
static integer next, i__, j, ix;
static doublereal hitest, sum;
/* Assigned format variables */
static char *next_fmt;
/* Parameter adjustments */
--dx;
/* Function Body */
/* euclidean norm of the n-vector stored in dx() with storage */
/* increment incx . */
/* if n .le. 0 return with result = 0. */
/* if n .ge. 1 then incx must be .ge. 1 */
/* c.l.lawson, 1978 jan 08 */
/* modified to correct failure to update ix, 1/25/92. */
/* modified 3/93 to return if incx .le. 0. */
/* four phase method using two built-in constants that are */
/* hopefully applicable to all machines. */
/* cutlo = maximum of dsqrt(u/eps) over all known machines. */
/* cuthi = minimum of dsqrt(v) over all known machines. */
/* where */
/* eps = smallest no. such that eps + 1. .gt. 1. */
/* u = smallest positive no. (underflow limit) */
/* v = largest no. (overflow limit) */
/* brief outline of algorithm.. */
/* phase 1 scans zero components. */
/* move to phase 2 when a component is nonzero and .le. cutlo */
/* move to phase 3 when a component is .gt. cutlo */
/* move to phase 4 when a component is .ge. cuthi/m */
/* where m = n for x() real and m = 2*n for complex. */
/* values for cutlo and cuthi.. */
/* from the environmental parameters listed in the imsl converter */
/* document the limiting values are as follows.. */
/* cutlo, s.p. u/eps = 2**(-102) for honeywell. close seconds are
*/
/* univac and dec at 2**(-103) */
/* thus cutlo = 2**(-51) = 4.44089e-16 */
/* cuthi, s.p. v = 2**127 for univac, honeywell, and dec. */
/* thus cuthi = 2**(63.5) = 1.30438e19 */
/* cutlo, d.p. u/eps = 2**(-67) for honeywell and dec. */
/* thus cutlo = 2**(-33.5) = 8.23181d-11 */
/* cuthi, d.p. same as s.p. cuthi = 1.30438d19 */
/* data cutlo, cuthi / 8.232d-11, 1.304d19 / */
/* data cutlo, cuthi / 4.441e-16, 1.304e19 / */
if (*n > 0 && *incx > 0) {
goto L10;
}
ret_val = zero;
goto L300;
L10:
next = 0;
next_fmt = fmt_30;
sum = zero;
i__ = 1;
ix = 1;
/* begin main loop */
L20:
switch ((int)next) {
case 0: goto L30;
case 1: goto L50;
case 2: goto L70;
case 3: goto L110;
}
L30:
if ((d__1 = dx[i__], abs(d__1)) > cutlo) {
goto L85;
}
next = 1;
next_fmt = fmt_50;
xmax = zero;
/* phase 1. sum is zero */
L50:
if (dx[i__] == zero) {
goto L200;
}
if ((d__1 = dx[i__], abs(d__1)) > cutlo) {
goto L85;
}
/* prepare for phase 2. */
next = 2;
next_fmt = fmt_70;
goto L105;
/* prepare for phase 4. */
L100:
ix = j;
next = 3;
next_fmt = fmt_110;
sum = sum / dx[i__] / dx[i__];
L105:
xmax = (d__1 = dx[i__], abs(d__1));
goto L115;
/* phase 2. sum is small. */
/* scale to avoid destructive underflow. */
L70:
if ((d__1 = dx[i__], abs(d__1)) > cutlo) {
goto L75;
}
/* common code for phases 2 and 4. */
/* in phase 4 sum is large. scale to avoid overflow.
*/
L110:
if ((d__1 = dx[i__], abs(d__1)) <= xmax) {
goto L115;
}
/* Computing 2nd power */
d__1 = xmax / dx[i__];
sum = one + sum * (d__1 * d__1);
xmax = (d__1 = dx[i__], abs(d__1));
goto L200;
L115:
/* Computing 2nd power */
d__1 = dx[i__] / xmax;
sum += d__1 * d__1;
goto L200;
/* prepare for phase 3. */
L75:
sum = sum * xmax * xmax;
/* for real or d.p. set hitest = cuthi/n */
/* for complex set hitest = cuthi/(2*n) */
L85:
hitest = cuthi / (real) (*n);
/* phase 3. sum is mid-range. no scaling. */
i__1 = *n;
for (j = ix; j <= i__1; ++j) {
if ((d__1 = dx[i__], abs(d__1)) >= hitest) {
goto L100;
}
/* Computing 2nd power */
d__1 = dx[i__];
sum += d__1 * d__1;
i__ += *incx;
/* L95: */
}
ret_val = sqrt(sum);
goto L300;
L200:
++ix;
i__ += *incx;
if (ix <= *n) {
goto L20;
}
/* end of main loop. */
/* compute square root and adjust for scaling. */
ret_val = xmax * sqrt(sum);
L300:
return ret_val;
} /* dnrm2_ */

231
blas/f2c.h Normal file
View File

@ -0,0 +1,231 @@
/* f2c.h -- Standard Fortran to C header file */
/** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
- From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
#ifndef F2C_INCLUDE
#define F2C_INCLUDE
/* F2C_INTEGER will normally be `int' but would be `long' on 16-bit systems */
/* we assume short, float are OK */
typedef long int /* long int */ integer;
typedef unsigned long int /* long */ uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
typedef long int /* long int */ logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
/* integer*8 support from f2c not currently supported: */
#if 0
typedef @F2C_LONGINT@ /* long long */ longint; /* system-dependent */
typedef unsigned @F2C_LONGINT@ ulongint; /* system-dependent */
#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b)))
#define qbit_set(a,b) ((a) | ((ulongint)1 << (b)))
#endif
typedef long long int longint;
#define TRUE_ (1)
#define FALSE_ (0)
/* Extern is for use with -E */
#ifndef Extern
#define Extern extern
#endif
/* I/O stuff */
#ifdef f2c_i2
#error f2c_i2 will not work with g77!!!!
/* for -i2 */
typedef short flag;
typedef short ftnlen;
typedef short ftnint;
#else
typedef long int /* int or long int */ flag;
typedef long int /* int or long int */ ftnlen;
typedef long int /* int or long int */ ftnint;
#endif
/*external read, write*/
typedef struct
{ flag cierr;
ftnint ciunit;
flag ciend;
char *cifmt;
ftnint cirec;
} cilist;
/*internal read, write*/
typedef struct
{ flag icierr;
char *iciunit;
flag iciend;
char *icifmt;
ftnint icirlen;
ftnint icirnum;
} icilist;
/*open*/
typedef struct
{ flag oerr;
ftnint ounit;
char *ofnm;
ftnlen ofnmlen;
char *osta;
char *oacc;
char *ofm;
ftnint orl;
char *oblnk;
} olist;
/*close*/
typedef struct
{ flag cerr;
ftnint cunit;
char *csta;
} cllist;
/*rewind, backspace, endfile*/
typedef struct
{ flag aerr;
ftnint aunit;
} alist;
/* inquire */
typedef struct
{ flag inerr;
ftnint inunit;
char *infile;
ftnlen infilen;
ftnint *inex; /*parameters in standard's order*/
ftnint *inopen;
ftnint *innum;
ftnint *innamed;
char *inname;
ftnlen innamlen;
char *inacc;
ftnlen inacclen;
char *inseq;
ftnlen inseqlen;
char *indir;
ftnlen indirlen;
char *infmt;
ftnlen infmtlen;
char *inform;
ftnint informlen;
char *inunf;
ftnlen inunflen;
ftnint *inrecl;
ftnint *innrec;
char *inblank;
ftnlen inblanklen;
} inlist;
#define VOID void
union Multitype { /* for multiple entry points */
integer1 g;
shortint h;
integer i;
/* longint j; */
real r;
doublereal d;
complex c;
doublecomplex z;
};
typedef union Multitype Multitype;
/*typedef long int Long;*/ /* No longer used; formerly in Namelist */
struct Vardesc { /* for Namelist */
char *name;
char *addr;
ftnlen *dims;
int type;
};
typedef struct Vardesc Vardesc;
struct Namelist {
char *name;
Vardesc **vars;
int nvars;
};
typedef struct Namelist Namelist;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (doublereal)abs(x)
#define min(a,b) ((a) <= (b) ? (a) : (b))
#define max(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (doublereal)min(a,b)
#define dmax(a,b) (doublereal)max(a,b)
#define bit_test(a,b) ((a) >> (b) & 1)
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
/* procedure parameter types for -A and -C++ */
#define F2C_proc_par_types 1
#ifdef __cplusplus
typedef int /* Unknown procedure type */ (*U_fp)(...);
typedef shortint (*J_fp)(...);
typedef integer (*I_fp)(...);
typedef real (*R_fp)(...);
typedef doublereal (*D_fp)(...), (*E_fp)(...);
typedef /* Complex */ VOID (*C_fp)(...);
typedef /* Double Complex */ VOID (*Z_fp)(...);
typedef logical (*L_fp)(...);
typedef shortlogical (*K_fp)(...);
typedef /* Character */ VOID (*H_fp)(...);
typedef /* Subroutine */ int (*S_fp)(...);
#else
typedef int /* Unknown procedure type */ (*U_fp)();
typedef shortint (*J_fp)();
typedef integer (*I_fp)();
typedef real (*R_fp)();
typedef doublereal (*D_fp)(), (*E_fp)();
typedef /* Complex */ VOID (*C_fp)();
typedef /* Double Complex */ VOID (*Z_fp)();
typedef logical (*L_fp)();
typedef shortlogical (*K_fp)();
typedef /* Character */ VOID (*H_fp)();
typedef /* Subroutine */ int (*S_fp)();
#endif
/* E_fp is for real functions when -R is not specified */
typedef VOID C_f; /* complex function */
typedef VOID H_f; /* character function */
typedef VOID Z_f; /* double complex function */
typedef doublereal E_f; /* real function with -R not specified */
/* undef any lower-case symbols that your C compiler predefines, e.g.: */
#ifndef Skip_f2c_Undefs
/* (No such symbols should be defined in a strict ANSI C compiler.
We can avoid trouble with f2c-translated code by using
gcc -ansi [-traditional].) */
#undef cray
#undef gcos
#undef mc68010
#undef mc68020
#undef mips
#undef pdp11
#undef sgi
#undef sparc
#undef sun
#undef sun2
#undef sun3
#undef sun4
#undef u370
#undef u3b
#undef u3b2
#undef u3b5
#undef unix
#undef vax
#endif
#endif

BIN
blas/libf2c.a Normal file

Binary file not shown.