[Trilinos-Users] How to export top 1000 rows to a local process

Tian Xiaochen xchen.tian at gmail.com
Fri Jul 17 04:30:26 EDT 2015


I want to collect the first 1000 rows of a big matrix with type
Epetra_CrsMatrix to a local processor( e.g. with pid 0 )

Here is the brief of my code. I am not sure whether I did it right or not:

variable `matrix` is the big global Epetra_CrsMatrix and it is a square

long long num_export_elements = 0;
if (0 == pid) num_export_elements = 1000;
const Epetra_Map local_map((long
long)-1,(int)num_export_elements,(int)begin,*comm );

Epetra_Import importer(local_map,matrix.RowMap());
Epetra_CrsMatrix mtemp(matrix,importer);


The idea is to create a local map which is the range of 0 to 999.
And processor 0 has 1000 elements so that this map is local to processor 0.
Then create a new matrix with "import" using this map then it should have
and only have the first 1000 rows of the big global matrix.

However, I got error

0x00000000004eff8b in
Epetra_Import_Util::TUnpackAndCombineIntoCrsArrays<long long>
(SourceMatrix=..., NumSameIDs=NumSameIDs at entry=1000,
NumRemoteIDs=NumRemoteIDs at entry=0,
    RemoteLIDs=RemoteLIDs at entry=0x0, NumPermuteIDs=NumPermuteIDs at entry=0,
PermuteToLIDs=PermuteToLIDs at entry=0x0, PermuteFromLIDs=PermuteFromLIDs at entry
    LenImports=LenImports at entry=0, Imports=Imports at entry=0x0,
TargetNumRows=TargetNumRows at entry=1000,
TargetNumNonzeros=TargetNumNonzeros at entry=19946,
    MyTargetPID=MyTargetPID at entry=0, CSR_rowptr=CSR_rowptr at entry=0x62f7f00,
CSR_colind=CSR_colind at entry=0x2fe8bd0, CSR_vals=CSR_vals at entry=0xe4be30,
    SourcePids=std::vector of length 0, capacity 0, TargetPids=std::vector
of length 19946, capacity 19946 = {...})
    at trilinos-12.0.1-Source/packages/epetra/src/Epetra_Import_Util.cpp:358

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20150717/06267950/attachment.html>

More information about the Trilinos-Users mailing list