AMGX icon indicating copy to clipboard operation
AMGX copied to clipboard

How to check the matrix set by "AMGX_matrix_upload_all"

Open ztdepztdep opened this issue 2 years ago • 1 comments

I read in a matrix from the matrix market file and upload the matrix with "AMGX_matrix_upload_all(ADiffu, NumGlobalRows, NumGlobalNonzeros, 1, 1, &Row_Count[0], &Col_vec[0], &Val_vec[0], 0);" where Row_Count Col_vec Val_vec are the arrays for the CSR matrix . My code is run with only 1 gpu and 1 process. but I got a totally wrong results. The matrix can be solved successfully with "AMG_READ_system" command . Could you please give me some infos about how to check the matrix that I read in is correct.

ztdepztdep avatar Jun 25 '22 12:06 ztdepztdep

Apologies for the slow reply. Given you only have 1 GPU and 1 process, the parameter passing looks correct (at least by the names).

Some unlikely but possible issues to double check are:

  • only have NumGlobalRows elements in Row_Count, i.e. missing the last element
  • NumGlobalRows, NumGlobalNonzeros don't match the matrix
  • Types are mismatched for data

You also initialise the rhs and sol when using AMGX_read_system, so perhaps something is not correct with that part.

You could try writing the system with:

AMGX_RC AMGX_API AMGX_write_system(const AMGX_matrix_handle mtx, const AMGX_vector_handle rhs, const AMGX_vector_handle sol, const char *filename)

and compare the two matrix market files.

mattmartineau avatar Jul 05 '22 07:07 mattmartineau