[Trilinos-Users] MatrixMarket to CrsMatrix

Heroux, Michael A maherou at sandia.gov
Fri Oct 21 10:25:38 EDT 2016


Brian,

First, sorry for such an unfriendly error message.  This is very old code from a time when we didn’t pay much attention to helping people recover from error states.

My guess is that your matrix has one or more rows with either no entries, or there is an MPI process that has one or more rows with no corresponding column element on that process.  In other words, if rank 0 has row 9, there is no nonzero in column 9 on rank 0.

In most cases, the sparse matrices we work with have a nonzero diagonal, which guarantees that the above situation won’t occur, but if you have a matrix with an empty row, or zero diagonals, you can run into this issue.

Let me know if this helps you diagnose the problem.

Mike

From: Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf of Brian Staber <brian.staber at u-pem.fr>
Date: Friday, October 21, 2016 at 2:47 AM
To: Trilinos Users <trilinos-users at trilinos.org>
Subject: [EXTERNAL] [Trilinos-Users] MatrixMarket to CrsMatrix

Hello everyone,

I recently wrote a simple piece of code in order to read a sparse matrix and a rhs with EpetraExt. However, when solving the linear problem with AztecOO, I get the following errors:

AZ_extract_comm_info: Received elements must be stored after
all 95955 local elements
AZ_extract_comm_info: Received elements must be stored after
all 95955 local elements

Here is my code:

// Epetra includes
#include "Epetra_ConfigDefs.h"
#ifdef HAVE_MPI
#include "mpi.h"
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif

#include "Epetra_Map.h"
#include "Epetra_FECrsGraph.h"
#include "Epetra_FECrsMatrix.h"
#include "Epetra_CrsMatrix.h"
#include "Epetra_FEVector.h"
#include "Epetra_SerialDenseMatrix.h"
#include "Epetra_SerialDenseVector.h"
#include "Epetra_Time.h"
#include "Epetra_IntVector.h"
#include "Epetra_Export.h"
#include "Epetra_Import.h"
#include "Epetra_Time.h"

// AztecOO includes
#include "AztecOO.h"

// ML includes
#include "ml_MultiLevelPreconditioner.h"
#include "ml_epetra_utils.h"

// EpetraExt includes
#include "EpetraExt_RowMatrixOut.h"
#include "EpetraExt_MultiVectorOut.h"
#include "EpetraExt_MultiVectorIn.h"
#include "EpetraExt_CrsMatrixIn.h"
#include "EpetraExt_VectorIn.h"

int main(int argc, char *argv[]){

#ifdef HAVE_MPI
MPI_Init(&argc, &argv);
Epetra_MpiComm Comm(MPI_COMM_WORLD);
#else
Epetra_SerialComm Comm;
#endif

int MyPID = Comm.MyPID();
int NumProc = Comm.NumProc();
int root = 0;

char stiffness_File[] = "CRS_MATRIX.mxt";
char rhs_File[] = "RHS.mtx";
int CHECK_ERR=0;

Epetra_CrsMatrix *stiffness = NULL;
Epetra_MultiVector *rhs = NULL;
CHECK_ERR = EpetraExt::MatrixMarketFileToCrsMatrix(stiffness_File,Comm,stiffness,0,1);
CHECK_ERR = EpetraExt::MatrixMarketFileToMultiVector(rhs_File,stiffness->RowMap(),rhs);

Epetra_Vector lhs(stiffness->RowMap());
Epetra_LinearProblem problem(stiffness, &lhs, rhs);
AztecOO solver(problem);
solver.SetAztecOption(AZ_solver, AZ_gmres);
solver.SetAztecOption(AZ_precond, AZ_Jacobi);
solver.SetAztecOption(AZ_output,1);
solver.Iterate(800,1e-10);


#ifdef HAVE_MPI
MPI_Finalize();
#endif

}

Am I doing something wrong ?

Thanks a lot,
Brian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20161021/0b593f8c/attachment.html>


More information about the Trilinos-Users mailing list