5555#include < vector.h>
5656#include < thrust_wrapper.h>
5757
58+ #include " matrix_analysis.h"
5859#include " amgx_types/util.h"
5960#include " amgx_types/rand.h"
6061#include " amgx_c_wrappers.inl"
@@ -2356,11 +2357,8 @@ extern "C" {
23562357 {
23572358 std::string deprecated (" The AMGX_initialize_plugins API call is deprecated and can be safely removed.\n " );
23582359
2359- #ifdef AMGX_WITH_MPI
23602360 amgx_distributed_output (deprecated.c_str (), deprecated.length ());
2361- #else
2362- amgx_output (deprecated.c_str (), deprecated.length ());
2363- #endif
2361+
23642362 return AMGX_RC_OK;
23652363 }
23662364
@@ -2385,11 +2383,9 @@ extern "C" {
23852383 AMGX_RC AMGX_API AMGX_finalize_plugins ()
23862384 {
23872385 std::string deprecated (" The AMGX_finalize_plugins API call is deprecated and can be safely removed.\n " );
2388- # ifdef AMGX_WITH_MPI
2386+
23892387 amgx_distributed_output (deprecated.c_str (), deprecated.length ());
2390- #else
2391- amgx_output (deprecated.c_str (), deprecated.length ());
2392- #endif
2388+
23932389 return AMGX_RC_OK;
23942390 }
23952391
@@ -5234,6 +5230,59 @@ extern "C" {
52345230 return AMGX_RC_OK;
52355231 }
52365232
5233+ AMGX_RC AMGX_matrix_check_symmetry (const AMGX_matrix_handle mtx, int * structurally_symmetric, int * symmetric)
5234+ {
5235+ nvtxRange nvrf (__func__);
5236+
5237+ Resources *resources = NULL ;
5238+ AMGX_CHECK_API_ERROR (getAMGXerror (getResourcesFromMatrixHandle (mtx, &resources)), NULL )
5239+
5240+ #ifdef AMGX_WITH_MPI
5241+ int nranks;
5242+ MPI_Comm_size (MPI_COMM_WORLD, &nranks);
5243+ if (nranks > 1 ) {
5244+ std::string err_msg (" AMGX_matrix_check_symmetry cannot yet test distributed matrices, please run on 1 rank.\n " );
5245+ amgx_distributed_output (err_msg.c_str (), err_msg.length ());
5246+ AMGX_CHECK_API_ERROR (AMGX_ERR_BAD_PARAMETERS, resources); // return AMGX_RC_BAD_PARAMETERS;
5247+ }
5248+ #endif
5249+
5250+ AMGX_ERROR rc = AMGX_OK;
5251+
5252+ AMGX_TRIES ()
5253+ {
5254+ AMGX_Mode mode = get_mode_from (mtx);
5255+
5256+ switch (mode)
5257+ {
5258+ #define AMGX_CASE_LINE (CASE ) case CASE: { \
5259+ typedef typename TemplateMode<CASE>::Type TConfig; \
5260+ typedef CWrapHandle<AMGX_matrix_handle, Matrix<TConfig>> MatrixW; \
5261+ MatrixW wrapA (mtx); \
5262+ Matrix<TConfig>& A = *wrapA.wrapped (); \
5263+ MatrixAnalysis<TConfig> m_ana (&A); \
5264+ bool verbose = false ; \
5265+ bool structurally_symmetric_out = false ; \
5266+ bool symmetric_out = false ; \
5267+ m_ana.checkSymmetry (structurally_symmetric_out, symmetric_out, verbose); \
5268+ *structurally_symmetric = (structurally_symmetric_out ? 1 : 0 ); \
5269+ *symmetric = (symmetric_out ? 1 : 0 ); \
5270+ break ; \
5271+ }
5272+ AMGX_FORALL_BUILDS (AMGX_CASE_LINE)
5273+ AMGX_FORCOMPLEX_BUILDS (AMGX_CASE_LINE)
5274+ #undef AMGX_CASE_LINE
5275+
5276+ default :
5277+ return AMGX_RC_BAD_MODE;
5278+ }
5279+ }
5280+
5281+ AMGX_CATCHES (rc)
5282+ AMGX_CHECK_API_ERROR (rc, resources)
5283+ return AMGX_RC_OK;
5284+ }
5285+
52375286 int AMGX_Debug_get_resource_count (AMGX_resources_handle rsc)
52385287 {
52395288 return ((ResourceW *)rsc)->wrapped ().use_count ();
0 commit comments