Closed GoogleCodeExporter closed 8 years ago
Compiling basic matrix_market example: {{{ #include <cusp/io/matrix_market.h> #include <cusp/array2d.h> #include <cusp/coo_matrix.h> #include <cusp/print.h> int main(void) { // create a simple example cusp::array2d<float, cusp::host_memory> A(3,4); A(0,0) = 10; A(0,1) = 0; A(0,2) = 20; A(0,3) = 0; A(1,0) = 0; A(1,1) = 30; A(1,2) = 0; A(1,3) = 40; A(2,0) = 50; A(2,1) = 60; A(2,2) = 70; A(2,3) = 80; // save A to disk in MatrixMarket format cusp::io::write_matrix_market_file(A, "A.mtx"); // load A from disk into a coo_matrix cusp::coo_matrix<int, float, cusp::device_memory> B; cusp::io::read_matrix_market_file(B, "A.mtx"); // print B cusp::print(B); return 0; } }}} Trying to run: {{{ [ashevchenko@tesla-cmc cusp]$ nvcc matrix_market.cu -o matrix_market -I /opt/ [ashevchenko@tesla-cmc cusp]$ ./matrix_market sparse matrix <3, 4> with 7 entries 0 0 10 0 2 60 1 3 70 2 0 50 2 1 30 2 2 20 2 3 6.86636e-44 }}} Version: {{{ [ashevchenko@tesla-cmc cusp]$ ./version CUDA v4.1 Thrust v1.5 Cusp v0.3 }}} Additional information: If add a line {{{ cusp::coo_matrix<int, float, cusp::host_memory> C = A; }}} before saving to disk, the program works as expected: {{{ [ashevchenko@tesla-cmc cusp]$ ./matrix_market sparse matrix <3, 4> with 8 entries 0 0 10 0 2 20 1 1 30 1 3 40 2 0 50 2 1 60 2 2 70 2 3 80 }}} Think, there's a problem, when writing cusp::array2d to .mtx file
Original issue reported on code.google.com by djsa...@gmail.com on 9 May 2012 at 4:39
djsa...@gmail.com
This issue was closed by revision aa28ed308d78.
Original comment by filipe.c...@gmail.com on 10 May 2012 at 10:48
filipe.c...@gmail.com
Original issue reported on code.google.com by
djsa...@gmail.com
on 9 May 2012 at 4:39