octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58795] ode15i and ode15s fail for Windows 32b


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #58795] ode15i and ode15s fail for Windows 32bit
Date: Thu, 10 Sep 2020 15:21:18 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36 Edg/85.0.564.44

Follow-up Comment #57, bug #58795 (project octave):

Thanks for the test.
Sorry, I wasn't clear what I wanted to have tested. I actually meant to ask
for testing the attached patch. The verbatim block was just to show what I
changed with respect to the patch that failed on the buildbots.

My Ubuntu 20.04.1 is 64bit. But still sunindextype is 32bit wide  on that
system.

I might be misunderstanding how this is supposed to work. But afaics,
sunindextype should be set to the same size as the integer type used in the
BLAS/LAPACK libraries. That is still 32bit on most systems.
Otherwise, bad things could happen somewhere when unavoidably sunindextype has
to be cast to "int" for calling the BLAS/LAPACK functions.

For example in sundials 4.1.0 in sunlinsol_lapackband.c:

int SUNLinSolSetup_LapackBand(SUNLinearSolver S, SUNMatrix A)
{
  int n, ml, mu, ldim, ier;

  /* check for valid inputs */
  if ( (A == NULL) || (S == NULL) ) 
    return(SUNLS_MEM_NULL);
  
  /* Ensure that A is a band matrix */
  if (SUNMatGetID(A) != SUNMATRIX_BAND) {
    LASTFLAG(S) = SUNLS_ILL_INPUT;
    return(LASTFLAG(S));
  }
  
  /* Call LAPACK to do LU factorization of A */
  n = SUNBandMatrix_Rows(A);
  ml = SUNBandMatrix_LowerBandwidth(A);
  mu = SUNBandMatrix_UpperBandwidth(A);
  ldim = SUNBandMatrix_LDim(A);
  xgbtrf_f77(&n, &n, &ml, &mu, SUNBandMatrix_Data(A), 
             &ldim, PIVOTS(S), &ier);
  
  LASTFLAG(S) = (long int) ier;
  if (ier > 0) 
    return(SUNLS_LUFACT_FAIL);
  if (ier < 0) 
    return(SUNLS_PACKAGE_FAIL_UNREC);
  return(SUNLS_SUCCESS);
}


With among other the following declarations in sunmatrix_band.h:

SUNDIALS_EXPORT sunindextype SUNBandMatrix_Rows(SUNMatrix A);
SUNDIALS_EXPORT sunindextype SUNBandMatrix_Columns(SUNMatrix A);
SUNDIALS_EXPORT sunindextype SUNBandMatrix_LowerBandwidth(SUNMatrix A);
SUNDIALS_EXPORT sunindextype SUNBandMatrix_UpperBandwidth(SUNMatrix A);


That seems to have been fixed in the meantime by efectively forcing
sunindextype to match the BLAS index type.
But it is only safe in older version if "sunindextype" was correctly
configured when sundials was compiled.
That seems to be not the case for the sundials that is packaged for Fedora.
So to avoid a possible issue here, we need to make sure that the sunindextype
variables we pass to sundials can safely be cast to the BLAS integer type.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58795>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]