[Trilinos-Users] Problemsunderstandin g MatrixMarketFileToCrsMatrix

Mancke, Bradley bmancke at sandia.gov
Thu Jan 3 08:36:38 MST 2008


Hi,

At one point I had problems with the MatrixMarketFileToCrsMatrix
function.  After printing out the matrix (a smaller one), I found out
that when the function splits up to it's different processors to read in
from the file, it didn't set the offset for the indexing correctly.  I
believe that I was using version 7 at the time and that it's fixed in
the latest release.  Hope this helps.

Brad

-----Original Message-----
From: trilinos-users-bounces at software.sandia.gov
[mailto:trilinos-users-bounces at software.sandia.gov] On Behalf Of
trilinos at perfect-kreim.de
Sent: Thursday, December 27, 2007 9:57 AM
To: trilinos-users at software.sandia.gov
Subject: Re: [Trilinos-Users] Problemsunderstandin g
MatrixMarketFileToCrsMatrix

Hi,

thank you for your answer, Mike, but I still do not get it. But at least
I have no more compiler errors. Unfortunately I have now error from my
code.

I created now a Epetra_Map with NumGlobalElements of the size of my
matrix (961*961 Elements). Then I tried to read in a MatrixMarket file
using EpetraExt::MatrixMarketFileToCrsMatrix and the map I created.
But this gives me a -1-error. The trilinos-documentation says here:
Returns 0 if no error, -1 if any problems with file system.

I don't know what this means. The file exists and has permissions 777
and I give the full path to the file in my code.

So maybe you or somebody else has some ideas.

Thank you,

Michael

Here is my code:
#include "header.hpp"
int main( int argc, char *argv[]) {

	// Creation of an Epeter Communicator
	// This Code works on Serial and on Parallel Computers :-)
	#ifdef HAVE_MPI
		MPI_Init(&argc, &argv);
		Epetra_MpiComm Comm(MPI_COMM_WORLD);
	#else
		Epetra_SerialComm Comm;
	#endif
	std::cout << "  COMM: " << Comm << endl;

	const int NumGlobalElements=961*961;
	const char*
filename="/home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx"; //
mat_A.mtx

	Epetra_Map map(NumGlobalElements,1,Comm);
	Epetra_CrsMatrix *A;

	int
answer=EpetraExt::MatrixMarketFileToCrsMatrix(filename,map,A);
	std::cout << "ANSWER: " << answer << endl;

//	std::cout << "   MAP: " << map << endl;
	std::cout << "MATRIX: " << A << endl;


	#ifdef HAVE_MPI
	  MPI_Finalize();
	#endif
	return EXIT_SUCCESS;
} // end of int main()

The file header.hpp only contains a lot of includes.

Here is the output from my code:
  COMM: Epetra::Comm
::Processor 0 of 1 total processors.
Epetra ERROR -1,
../../../../packages/epetraext/src/inout/EpetraExt_CrsMatrixIn.cpp, line
119
Epetra ERROR -1,
../../../../packages/epetraext/src/inout/EpetraExt_CrsMatrixIn.cpp, line
54
ANSWER: -1
MATRIX: 0xb7f3ab28
(1120) kreim at fb04370 ~

and here are the first 10 lines from my MatrixMarketFile:
 ls -lah /home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx
-rwxrwxrwx 1 kreim students 30K Dec 27 16:07
/home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx

$ head /home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx
%%MatrixMarket matrix coordinate real symmetric % Generated 27-Dec-2007
961 961 2821
1 1  4
332 1 -1
333 1 -1
708 1 -1
709 1 -1
2 2  4
254 2 -1

Michael A Heroux schrieb:
> Michael,
>
> There is a fairly detailed example in the test directory 
> trilinos/packages/epetraext/test/inout
>
> Mike
>
> On 12/24/07 6:32 AM, "trilinos at perfect-kreim.de"
<trilinos at perfect-kreim.de>
> wrote:
>
>> Hello and merry Christmas,
>>
>> I have some problems to understand the 
>> EpetraExt::MatrixMarketFileToCrsMatrix function.[...]





_______________________________________________
Trilinos-Users mailing list
Trilinos-Users at software.sandia.gov
http://software.sandia.gov/mailman/listinfo/trilinos-users



More information about the Trilinos-Users mailing list