Page **1** of **1**

### Matrix export to matrix market file contains only header

Posted: **Thu Oct 19, 2017 10:20 am**

by **Klausb**

Hello,

I tried to export the matrices from my application using the MAGMA export function:

Code: Select all

` magma_dwrite_csr_mtx(A, MagmaRowMajor, "sym_matrix_p.mtx", queue);`

In any case, a file containing only the header information was created.

File content:

Code: Select all

```
%%MatrixMarket matrix coordinate real general
40800 40800 203400
```

What's wrong with my attempt?

Klaus

### Re: Matrix export to matrix market file contains only header

Posted: **Thu Oct 19, 2017 10:44 am**

by **hartwig anzt**

Klaus,

please always provide the complete code - this makes the analysis much easier.

Thanks, Hartwig

### Re: Matrix export to matrix market file contains only header

Posted: **Thu Oct 19, 2017 3:18 pm**

by **Klausb**

Here the code section:

Code: Select all

```
// Initialize MAGMA and create some LA structures.
magma_init();
magma_dopts opts;
magma_queue_t queue;
magma_queue_create( 0, &queue );
magma_d_matrix A={Magma_CSR}, dA={Magma_CSR};
magma_d_matrix b={Magma_CSR}, db={Magma_CSR};
magma_d_matrix x={Magma_CSR}, dx={Magma_CSR};
// get vector size
magma_int_t n = matrix.diag().size();
magma_int_t one = 1; // magma vector number of columns
// Pass the system to MAGMA.
// import rhs
mFoam::import_vector(source, b, queue);
// convert matrix and fill matrix A based on magma_dcsrset( m, m, row, col, val, &A, queue );
mFoam::CSR2MAGMA(matrix, A, queue);
// save the matrix for p or U etc.
if (matrix.symmetric()) {
magma_dwrite_csr_mtx(A, MagmaRowMajor, "sym_matrix_p.mtx", queue); // p
} else {
magma_dwrite_csr_mtx(A, MagmaRowMajor, "asym_matrix_U.mtx", queue); // U etc.
}
```