summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorPiotr Luszczek <luszczek@icl.utk.edu>2019-12-23 14:06:29 -0500
committerAdam J. Stewart <ajstewart426@gmail.com>2019-12-23 13:06:29 -0600
commitae8a72c0da76a9dd2786cce774c3d1d5b536a628 (patch)
tree4b889acf89909478e02bd3a03d9fc60ca3b9df84 /var
parente2ec1c76cecaa2f21690994ba017fe942b37f780 (diff)
downloadspack-ae8a72c0da76a9dd2786cce774c3d1d5b536a628.tar.gz
spack-ae8a72c0da76a9dd2786cce774c3d1d5b536a628.tar.bz2
spack-ae8a72c0da76a9dd2786cce774c3d1d5b536a628.tar.xz
spack-ae8a72c0da76a9dd2786cce774c3d1d5b536a628.zip
netlib-scalapack: Add int overflow patch (#14276)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/netlib-scalapack/int_overflow.patch313
-rw-r--r--var/spack/repos/builtin/packages/netlib-scalapack/package.py2
2 files changed, 315 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/int_overflow.patch b/var/spack/repos/builtin/packages/netlib-scalapack/int_overflow.patch
new file mode 100644
index 0000000000..b407fc840f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/netlib-scalapack/int_overflow.patch
@@ -0,0 +1,313 @@
+diff --git a/PBLAS/SRC/pdamax_.c b/PBLAS/SRC/pdamax_.c
+index 3f4690a..89d8993 100644
+--- a/PBLAS/SRC/pdamax_.c
++++ b/PBLAS/SRC/pdamax_.c
+@@ -233,7 +233,7 @@ void pdamax_( N, AMAX, INDX, X, IX, JX, DESCX, INCX )
+ if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
+ ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
+ {
+- *INDX = *JX; *AMAX = X[Xii+Xjj*Xd[LLD_]];
++ *INDX = *JX; *AMAX = *Mptr(X,Xii,Xjj,Xd[LLD_],1);
+ }
+ return;
+ }
+@@ -260,9 +260,9 @@ void pdamax_( N, AMAX, INDX, X, IX, JX, DESCX, INCX )
+ {
+ Xld = Xd[LLD_];
+ Xlindx = Xjj - 1 +
+- idamax_( &Xnq, ((char*)(X+(Xii+Xjj*Xld))), &Xld );
++ idamax_( &Xnq, ((char*)Mptr(X,Xii,Xjj,Xld,1)), &Xld );
+ Mindxl2g( Xgindx, Xlindx, Xinb, Xnb, mycol, Xsrc, npcol );
+- work[0] = X[Xii+Xlindx*Xld];
++ work[0] = *Mptr(X,Xii,Xlindx,Xld,1);
+ work[1] = ((double)( Xgindx+1 ));
+ }
+ else
+@@ -343,8 +343,8 @@ l_20:
+ */
+ Xld = Xd[LLD_];
+ Xlindx = Xjj - 1 +
+- idamax_( &Xnq, ((char*)(X+(Xii+Xjj*Xld))), &Xld );
+- *AMAX = X[Xii+Xlindx*Xld];
++ idamax_( &Xnq, ((char*)Mptr(X,Xii,Xjj,Xld,1)), &Xld );
++ *AMAX = *Mptr(X,Xii,Xlindx,Xld,1);
+ }
+ else
+ {
+@@ -419,9 +419,9 @@ l_20:
+ {
+ Xld = Xd[LLD_];
+ Xlindx = Xii - 1 +
+- idamax_( &Xnp, ((char*)(X+(Xii+Xjj*Xld))), INCX );
++ idamax_( &Xnp, ((char*)Mptr(X,Xii,Xjj,Xld,1)), INCX );
+ Mindxl2g( Xgindx, Xlindx, Ximb, Xmb, myrow, Xsrc, nprow );
+- work[0] = X[Xlindx+Xjj*Xld];
++ work[0] = *Mptr(X,Xlindx,Xjj,Xld,1);
+ work[1] = ((double)( Xgindx+1 ));
+ }
+ else
+@@ -503,8 +503,8 @@ l_40:
+ */
+ Xld = Xd[LLD_];
+ Xlindx = Xii - 1 +
+- idamax_( &Xnp, ((char*)(X+(Xii+Xjj*Xld))), INCX );
+- *AMAX = X[Xlindx+Xjj*Xld];
++ idamax_( &Xnp, ((char*)Mptr(X,Xii,Xjj,Xld,1)), INCX );
++ *AMAX = *Mptr(X,Xlindx,Xjj,Xld,1);
+ }
+ else
+ {
+diff --git a/PBLAS/SRC/pdasum_.c b/PBLAS/SRC/pdasum_.c
+index 5b9ce8b..3a56c23 100644
+--- a/PBLAS/SRC/pdasum_.c
++++ b/PBLAS/SRC/pdasum_.c
+@@ -225,7 +225,7 @@ void pdasum_( N, ASUM, X, IX, JX, DESCX, INCX )
+ if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
+ ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
+ {
+- *ASUM = ABS( X[Xii+Xjj*Xd[LLD_]] );
++ *ASUM = ABS( *Mptr(X,Xii,Xjj,Xd[LLD_],1) );
+ }
+ return;
+ }
+@@ -243,7 +243,7 @@ void pdasum_( N, ASUM, X, IX, JX, DESCX, INCX )
+ if( Xnq > 0 )
+ {
+ Xld = Xd[LLD_];
+- dvasum_( &Xnq, ((char *) ASUM), ((char *)( X+(Xii+Xjj*Xld) )),
++ dvasum_( &Xnq, ((char *) ASUM), ((char *)Mptr( X,Xii,Xjj,Xld,1 )),
+ &Xld );
+ }
+ /*
+@@ -276,7 +276,7 @@ void pdasum_( N, ASUM, X, IX, JX, DESCX, INCX )
+ if( Xnp > 0 )
+ {
+ dvasum_( &Xnp, ((char *) ASUM),
+- ((char *)( X+(Xii+Xjj*Xd[LLD_]) )), INCX );
++ ((char *)Mptr( X,Xii,Xjj,Xd[LLD_],1) ), INCX );
+ }
+ /*
+ * If Xnp <= 0, ASUM is zero (see initialization above)
+diff --git a/PBLAS/SRC/pdger_.c b/PBLAS/SRC/pdger_.c
+index e84aa62..517a33c 100644
+--- a/PBLAS/SRC/pdger_.c
++++ b/PBLAS/SRC/pdger_.c
+@@ -286,7 +286,7 @@ void pdger_( M, N, ALPHA, X, IX, JX, DESCX, INCX, Y, IY, JY, DESCY,
+ if( ( Amp > 0 ) && ( Anq > 0 ) )
+ {
+ dger_( &Amp, &Anq, ((char *) ALPHA), XA, &ione, YA, &YAd[LLD_],
+- ((char *) (A+(Aii+Ajj*Ald))), &Ald );
++ ((char *)Mptr(A,Aii,Ajj,Ald,1)), &Ald );
+ }
+ if( XAfr ) free( XA );
+ if( YAfr ) free( YA );
+diff --git a/PBLAS/SRC/pdnrm2_.c b/PBLAS/SRC/pdnrm2_.c
+index f5bfb1a..8e3bab9 100644
+--- a/PBLAS/SRC/pdnrm2_.c
++++ b/PBLAS/SRC/pdnrm2_.c
+@@ -224,7 +224,7 @@ void pdnrm2_( N, NORM2, X, IX, JX, DESCX, INCX )
+ */
+ if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
+ ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
+- *NORM2 = ABS( X[Xii+Xjj*Xd[LLD_]] );
++ *NORM2 = ABS( *Mptr(X,Xii,Xjj,Xd[LLD_],1) );
+ return;
+ }
+ else if( *INCX == Xd[M_] )
+@@ -246,7 +246,7 @@ void pdnrm2_( N, NORM2, X, IX, JX, DESCX, INCX )
+ if( Xnq > 0 )
+ {
+ Xld = Xd[LLD_];
+- Xptr = X+(Xii+Xjj*Xld);
++ Xptr = Mptr(X,Xii,Xjj,Xld,1);
+
+ for( k = 0; k < Xnq; k++ )
+ {
+@@ -366,7 +366,7 @@ l_20:
+ Xnp = PB_Cnumroc( *N, Xi, Xd[IMB_], Xd[MB_], myrow, Xd[RSRC_], nprow );
+ if( Xnp > 0 )
+ {
+- Xptr = X+(Xii+Xjj*Xd[LLD_]);
++ Xptr = Mptr(X,Xii,Xjj,Xd[LLD_],1);
+
+ for( k = 0; k < Xnp; k++ )
+ {
+diff --git a/PBLAS/SRC/pdscal_.c b/PBLAS/SRC/pdscal_.c
+index 28ddc66..b7c0964 100644
+--- a/PBLAS/SRC/pdscal_.c
++++ b/PBLAS/SRC/pdscal_.c
+@@ -210,12 +210,12 @@ void pdscal_( N, ALPHA, X, IX, JX, DESCX, INCX )
+ Xld = Xd[LLD_];
+ if( ALPHA[REAL_PART] == ZERO )
+ {
+- dset_( &Xnq, ((char *) ALPHA), ((char *)(X+(Xii+Xjj*Xld))),
++ dset_( &Xnq, ((char *) ALPHA), ((char *)Mptr(X,Xii,Xjj,Xld,1)),
+ &Xld );
+ }
+ else
+ {
+- dscal_( &Xnq, ((char *) ALPHA), ((char *)(X+(Xii+Xjj*Xld))),
++ dscal_( &Xnq, ((char *) ALPHA), ((char *)Mptr(X,Xii,Xjj,Xld,1)),
+ &Xld );
+ }
+ }
+@@ -239,12 +239,12 @@ void pdscal_( N, ALPHA, X, IX, JX, DESCX, INCX )
+ if( ALPHA[REAL_PART] == ZERO )
+ {
+ dset_( &Xnp, ((char *) ALPHA),
+- ((char *)( X+(Xii+Xjj*Xd[LLD_]) )), INCX );
++ ((char *)Mptr( X,Xii,Xjj,Xd[LLD_],1) ), INCX );
+ }
+ else
+ {
+ dscal_( &Xnp, ((char *) ALPHA),
+- ((char *)( X+(Xii+Xjj*Xd[LLD_]) )), INCX );
++ ((char *)Mptr( X,Xii,Xjj,Xd[LLD_],1) ), INCX );
+ }
+ }
+ }
+diff --git a/PBLAS/SRC/psamax_.c b/PBLAS/SRC/psamax_.c
+index a23b28a..8cdbd8e 100644
+--- a/PBLAS/SRC/psamax_.c
++++ b/PBLAS/SRC/psamax_.c
+@@ -260,7 +260,7 @@ void psamax_( N, AMAX, INDX, X, IX, JX, DESCX, INCX )
+ {
+ Xld = Xd[LLD_];
+ Xlindx = Xjj - 1 +
+- isamax_( &Xnq, ((char*)(X+(Xii+Xjj*Xld))), &Xld );
++ isamax_( &Xnq, ((char*)(Mptr(X,Xii,Xjj,Xld,1))), &Xld );
+ Mindxl2g( Xgindx, Xlindx, Xinb, Xnb, mycol, Xsrc, npcol );
+ work[0] = X[Xii+Xlindx*Xld];
+ work[1] = ((float )( Xgindx+1 ));
+@@ -343,8 +343,8 @@ l_20:
+ */
+ Xld = Xd[LLD_];
+ Xlindx = Xjj - 1 +
+- isamax_( &Xnq, ((char*)(X+(Xii+Xjj*Xld))), &Xld );
+- *AMAX = X[Xii+Xlindx*Xld];
++ isamax_( &Xnq, ((char*)(Mptr(X,Xii,Xjj,Xld, 1))), &Xld );
++ *AMAX = *Mptr(X,Xii,Xlindx,Xld,1);
+ }
+ else
+ {
+@@ -419,9 +419,9 @@ l_20:
+ {
+ Xld = Xd[LLD_];
+ Xlindx = Xii - 1 +
+- isamax_( &Xnp, ((char*)(X+(Xii+Xjj*Xld))), INCX );
++ isamax_( &Xnp, ((char*)Mptr(X,Xii,Xjj,Xld,1)), INCX );
+ Mindxl2g( Xgindx, Xlindx, Ximb, Xmb, myrow, Xsrc, nprow );
+- work[0] = X[Xlindx+Xjj*Xld];
++ work[0] = *Mptr(X,Xlindx,Xjj,Xld,1);
+ work[1] = ((float )( Xgindx+1 ));
+ }
+ else
+diff --git a/PBLAS/SRC/psasum_.c b/PBLAS/SRC/psasum_.c
+index a9820b3..dd6dcf1 100644
+--- a/PBLAS/SRC/psasum_.c
++++ b/PBLAS/SRC/psasum_.c
+@@ -225,7 +225,7 @@ void psasum_( N, ASUM, X, IX, JX, DESCX, INCX )
+ if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
+ ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
+ {
+- *ASUM = ABS( X[Xii+Xjj*Xd[LLD_]] );
++ *ASUM = ABS( *Mptr(X,Xii,Xjj,Xd[LLD_],1) );
+ }
+ return;
+ }
+@@ -243,7 +243,7 @@ void psasum_( N, ASUM, X, IX, JX, DESCX, INCX )
+ if( Xnq > 0 )
+ {
+ Xld = Xd[LLD_];
+- svasum_( &Xnq, ((char *) ASUM), ((char *)( X+(Xii+Xjj*Xld) )),
++ svasum_( &Xnq, ((char *) ASUM), ((char *)Mptr( X,Xii,Xjj,Xld,1) ),
+ &Xld );
+ }
+ /*
+@@ -276,7 +276,7 @@ void psasum_( N, ASUM, X, IX, JX, DESCX, INCX )
+ if( Xnp > 0 )
+ {
+ svasum_( &Xnp, ((char *) ASUM),
+- ((char *)( X+(Xii+Xjj*Xd[LLD_]) )), INCX );
++ ((char *)Mptr( X,Xii,Xjj,Xd[LLD_],1) ), INCX );
+ }
+ /*
+ * If Xnp <= 0, ASUM is zero (see initialization above)
+diff --git a/PBLAS/SRC/psger_.c b/PBLAS/SRC/psger_.c
+index f7774a4..47af5e5 100644
+--- a/PBLAS/SRC/psger_.c
++++ b/PBLAS/SRC/psger_.c
+@@ -286,7 +286,7 @@ void psger_( M, N, ALPHA, X, IX, JX, DESCX, INCX, Y, IY, JY, DESCY,
+ if( ( Amp > 0 ) && ( Anq > 0 ) )
+ {
+ sger_( &Amp, &Anq, ((char *) ALPHA), XA, &ione, YA, &YAd[LLD_],
+- ((char *) (A+(Aii+Ajj*Ald))), &Ald );
++ ((char *)Mptr(A,Aii,Ajj,Ald,1)), &Ald );
+ }
+ if( XAfr ) free( XA );
+ if( YAfr ) free( YA );
+diff --git a/PBLAS/SRC/psnrm2_.c b/PBLAS/SRC/psnrm2_.c
+index ff047c2..05eb00b 100644
+--- a/PBLAS/SRC/psnrm2_.c
++++ b/PBLAS/SRC/psnrm2_.c
+@@ -224,7 +224,7 @@ void psnrm2_( N, NORM2, X, IX, JX, DESCX, INCX )
+ */
+ if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
+ ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
+- *NORM2 = ABS( X[Xii+Xjj*Xd[LLD_]] );
++ *NORM2 = ABS( *Mptr(X,Xii,Xjj,Xd[LLD_],1) );
+ return;
+ }
+ else if( *INCX == Xd[M_] )
+@@ -246,7 +246,7 @@ void psnrm2_( N, NORM2, X, IX, JX, DESCX, INCX )
+ if( Xnq > 0 )
+ {
+ Xld = Xd[LLD_];
+- Xptr = X+(Xii+Xjj*Xld);
++ Xptr = Mptr(X,Xii,Xjj,Xld,1);
+
+ for( k = 0; k < Xnq; k++ )
+ {
+@@ -366,7 +366,7 @@ l_20:
+ Xnp = PB_Cnumroc( *N, Xi, Xd[IMB_], Xd[MB_], myrow, Xd[RSRC_], nprow );
+ if( Xnp > 0 )
+ {
+- Xptr = X+(Xii+Xjj*Xd[LLD_]);
++ Xptr = Mptr(X,Xii,Xjj,Xd[LLD_],1);
+
+ for( k = 0; k < Xnp; k++ )
+ {
+diff --git a/PBLAS/SRC/psscal_.c b/PBLAS/SRC/psscal_.c
+index d3652e2..6eb6ee7 100644
+--- a/PBLAS/SRC/psscal_.c
++++ b/PBLAS/SRC/psscal_.c
+@@ -210,12 +210,12 @@ void psscal_( N, ALPHA, X, IX, JX, DESCX, INCX )
+ Xld = Xd[LLD_];
+ if( ALPHA[REAL_PART] == ZERO )
+ {
+- sset_( &Xnq, ((char *) ALPHA), ((char *)(X+(Xii+Xjj*Xld))),
++ sset_( &Xnq, ((char *) ALPHA), ((char *)Mptr(X,Xii,Xjj,Xld,1)),
+ &Xld );
+ }
+ else
+ {
+- sscal_( &Xnq, ((char *) ALPHA), ((char *)(X+(Xii+Xjj*Xld))),
++ sscal_( &Xnq, ((char *) ALPHA), ((char *)Mptr(X,Xii,Xjj,Xld,1)),
+ &Xld );
+ }
+ }
+@@ -239,12 +239,12 @@ void psscal_( N, ALPHA, X, IX, JX, DESCX, INCX )
+ if( ALPHA[REAL_PART] == ZERO )
+ {
+ sset_( &Xnp, ((char *) ALPHA),
+- ((char *)( X+(Xii+Xjj*Xd[LLD_]) )), INCX );
++ ((char *)Mptr( X,Xii,Xjj,Xd[LLD_],1) ), INCX );
+ }
+ else
+ {
+ sscal_( &Xnp, ((char *) ALPHA),
+- ((char *)( X+(Xii+Xjj*Xd[LLD_]) )), INCX );
++ ((char *)Mptr( X,Xii,Xjj,Xd[LLD_],1 )), INCX );
+ }
+ }
+ }
diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/package.py b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
index 41f7431234..5841d25c6a 100644
--- a/var/spack/repos/builtin/packages/netlib-scalapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
@@ -44,6 +44,8 @@ class NetlibScalapack(CMakePackage):
patch("cmake_fortran_mangle.patch", when='@2.0.2:@2.0.99')
# See: https://github.com/Reference-ScaLAPACK/scalapack/pull/10
patch("mpi2-compatibility.patch", when='@2.0.2:@2.0.99')
+ # See: https://github.com/Reference-ScaLAPACK/scalapack/pull/16
+ patch("int_overflow.patch", when='@2.0.0:@2.1.0')
@property
def libs(self):