1. petsc
  2. PETSc
  3. petsc

Commits

Satish Balay  committed 3d838d8

f2cblaslapack: fix quad version of ila*l[rc] i*max1 functions

Fixed-by: Eloy Romero Alcalde <elroal@upvnet.upv.es>

Reported-by: Barry Smith <bsmith@mcs.anl.gov>

I stumbled across bugs in f2cblaslapack-3.4.2.q/ for quad/__float128 precision that need fixing.

In the Lapack directory ila*lc.c ila*lr.c are single/double real/complex versions but the toclapack.sh
(or whatever generates the quad precision files) does not generate the needed ilaqlc.c ilaqlr.c and ilawlc.c
ilawlr.c files. In addition, calls to iladlc_ and iladlr_ (same for z) in the q/w source files are not
correctly mapped to the q (same for w) versions instead they are left as is (in for example qlarf.c)

extern integer iladlc_(integer *, integer *, quadreal *, integer *),
iladlr_(integer *, integer *, quadreal *, integer *);

/* Scan for the last non-zero column in C(1:lastv,:). */
lastc = iladlc_(&lastv, n, &c__[c_offset], ldc);
} else {
/* Scan for the last non-zero row in C(:,1:lastv). */
lastc = iladlr_(m, &lastv, &c__[c_offset], ldc);
}

Thus when compiling qlarf.c the C compiler thinks iladlc_ takes a quadreal when in fact it takes a double and
errors occur at runtime in the call.

The fix would be to have the script generate the q and w versions of ila*lc.c ila*lr.c and when generating
the quad q*.c and w*.c files, replace the calls to iladlc_ iladlr_ (and z version) with ilqdlc_ ilqdlr_ (and
z versions)

  • Participants
  • Parent commits 81906eb
  • Branches master

Comments (0)

Files changed (2)

File bin/maint/toclapack.sh

View file
 TAR=tar
 
 # Some vars
-FBLASLAPACK=f2cblaslapack-3.4.2.q
+FBLASLAPACK=f2cblaslapack-3.4.2.q1
 BIN=${TMP}/bin
 PAC=${TMP}/${FBLASLAPACK}
 BLASDIR=${PAC}/blas
 LAPACKDIR=${PAC}/lapack
 BLASSRC="$1"
 LAPACKSRC="$2"
-ORIG=$PWD
+ORIG="$PWD"
 MAXPROCS="16"
 TESTING="0"   # 0: don't include second, dsecnd and qsecnd
 
 for p in blas qblas lapack qlapack; do
 	case $p in
 	blas) 
-		SRC=$BLASSRC
-		DES=$BLASDIR
+		SRC="$BLASSRC"
+		DES="$BLASDIR"
 		NOOP=""
 		echo "pow_ii" > ${TMP}/AUX.list
 		echo $'pow_si\nsmaxloc\nsf__cabs' > ${TMP}/SINGLE.list
 		cd -
 		;;
 	qblas) 
-		SRC=$TMP
-		DES=$BLASDIR
+		SRC="$TMP"
+		DES="$BLASDIR"
 		NOOP=""
 		echo $'pow_qi\nqmaxloc\nqf__cabs' > ${TMP}/QUAD.list
 		files="`cat ${TMP}/ql.list`"
 		;;
 
 	lapack)
-		SRC=$LAPACKSRC
-		DES=$LAPACKDIR
+		SRC="$LAPACKSRC"
+		DES="$LAPACKDIR"
 		NOOP="slaruv dlaruv slamch dlamch"
 		rm ${TMP}/AUX.list
 		echo 'slamch' > ${TMP}/SINGLE.list
 	qlapack)
 		NOOP="qlaruv qlamch"
 		echo $'qlamch' > ${TMP}/QUAD.list
-		SRC=$TMP
-		DES=$LAPACKDIR
+		SRC="$TMP"
+		DES="$LAPACKDIR"
 		files="`cat ${TMP}/ql.list`"
 	esac
 
 	# Transform sources
-	BACK=${PWD}
+	BACK="${PWD}"
 	cd $SRC
 	NPROC="0"
 	for file in $files; do
 		[sc]*)		PR="SINGLE";;
 		[dz]*)		PR="DOUBLE";;
 		[qw]*)		PR="QUAD";;
+		icmax1)		PR="SINGLE";;
+		izmax1)		PR="DOUBLE";;
+		iwmax1)		PR="QUAD";;
+		ila[sc]l[rc])	PR="SINGLE";;
+		ila[dz]l[rc])	PR="DOUBLE";;
+		ila[qw]l[rc])	PR="QUAD";;
 		*)		PR="AUX";;
 		esac
 
 				/^i?d[^z]/ { s/d/q/ }
 				s/^zd/wq/
 				/^i?z[^d]/ { s/z/w/ }
-				s/^sdsdot/dqddot/ ' )";
+				s/^sdsdot/dqddot/
+				/^ila[dz]l[rc]/ { y/dz/qw/; }' )";
 			echo "s/([^a-zA-Z_1-9]+)${base}_([^a-zA-Z_1-9]+)/\\1${qbase}_\\2/g;" >> $QL
 			cp $base.f ${TMP}/${qbase}.f
 			echo ${qbase}.f >> ${TMP}/ql.list

File config/BuildSystem/config/packages/f2cblaslapack.py

View file
 class Configure(config.package.Package):
   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
-    self.download         = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/f2cblaslapack-3.4.2.q.tar.gz']
+    self.download         = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/f2cblaslapack-3.4.2.q1.tar.gz']
     self.double           = 0
     self.worksonWindows   = 1
     self.downloadonWindows= 1