Epetra64: Epetra_CrsMatrix throws if given a Map with a 64-bit (long long) number of rows; 32-bit (int) number of rows is OK
Created by: mhoemmen
I was working on #3139 (closed), in particular on an Ifpack2 BlockRelaxation test that @brian-kelley wrote, that compares Ifpack2 and ML performance. My first pass of changes used a 64-bit (long long
) value for the global number of rows, when building both an Epetra and a Tpetra Map. The test threw in that case. However, when I gave Epetra_Map
's constructor the global number of rows as a 32-bit (int
) value, the test passed.
@trilinos/epetra @trilinos/tpetra @trilinos/ifpack2 @kddevin
Expectations
Epetra_CrsMatrix
should behave the same, whether its row Map was created with a 64-bit or 32-bit global number of indices.
Current Behavior
using GO = long long;
const GO localRows = 5000;
#ifdef EPETRA_MPI
Epetra_MpiComm ecomm(MPI_COMM_WORLD);
#else
Epetra_SerialComm ecomm;
#endif
// If I cast localRows to int, this code doesn't throw.
// Otherwise, something after the Epetra_Map constructor will throw.
Epetra_Map rowmap(localRows, 0, ecomm);
Teuchos::RCP<Epetra_CrsMatrix> crsmatrix =
Teuchos::rcp(new Epetra_CrsMatrix(Epetra_DataAccess::Copy, rowmap, 3));
int numRows = rowmap.NumGlobalElements();
double tile[3] = {-2, 4, -2};
int firstCols[] = {0, 1};
crsmatrix->InsertGlobalValues(0, 2, tile + 1, firstCols);
for(int row = 1; row < numRows - 1; row++)
{
int cols[] = {row - 1, row, row + 1};
crsmatrix->InsertGlobalValues(row, 3, tile, cols);
}
int lastCols[] = {numRows - 2, numRows - 1};
crsmatrix->InsertGlobalValues(numRows - 1, 2, tile, lastCols);
crsmatrix->FillComplete();
I see now that the code passes 32-bit global column indices into InsertGlobalValues
. Is it wrong to do that after creating a row Map with a 64-bit global number of rows? That's very easy to do when writing Epetra vs. Tpetra comparisons.
Motivation and Context
This hindered #3139 (closed). Also, we're generally interested in Epetra vs. Tpetra performance comparisons.
Related Issues
- Related to #3139 (closed)