[Issue]Caught amgx exception: SelectorFactory 'PMIS' has not been registered
I am attempting to implement AmgX's algebraic multigrid preconditioner in Petsc. When I include the following optional database keys
-pc_amgx_amg_method CLASSICAL
I encounter the following error
Caught amgx exception: SelectorFactory 'PMIS' has not been registered
I have attached the outlog, errlog and toolkits files for your reference. Does anyone know what caused this error and how to resolve it? Thanks.
PIG6e4_HO-CLASSICAL outlog.pdf PIG6e4_HO-CLASSICAL toolkits.pdf PIG6e4_HO-CLASSICAL errorlog.pdf
Hello @kkmund146 ,
I'm not familiar with PETSc code and it's options, so maybe https://gitlab.com/petsc/petsc/-/issues might be a good place to start troubleshooting such issue.
Could you confirm that you are calling AMGX_Initialize() before calling any AMGX_config_XXX() functions?
Thanks,
There should be no issue with the order, as it does attempt to solve without encountering this error for other models. I am also able to successfully do the AMGX example in PETSc.
I am actually getting this now when using the following database keys:
-pc_amgx_amg_method AGGREGATION
I will attach the outlog, errlog, and toolkits as before. Thanks, PIG6e4_SSA.toolkits.pdf PIG6e4_SSA-amgx-test-AGGREGATION.outlog.pdf PIG6e4_SSA-amgx-test-AGGREGATION.errlog.pdf
@kkmund146 I just noticed in both cases that AGGREGATION multigrid is used, for which PMIS is not an option, you can see it here:
Caught amgx exception: SelectorFactory 'PMIS' has not been registered
at: /home/kenneth.mosley/ISSM/ISSM/externalpackages/petsc/src/arch-linux-c-opt/
externalpackages/git.amgx/src/aggregation/selectors/agg_selector.cu:302
so the configuration that PETSc provides to AMGX is not correct. If you can provide configuration that is used to initialize solver I can advise on how to correct this issue, otherwise I would suggest opening an issue with PETSc ( https://gitlab.com/petsc/petsc/-/issues ), since their code is configuring AMGX solver.
Thanks,
@marsaev I believe this is what you were looking for, see attached. amgx.cxx.pdf
@kkmund146
Can you provide contents of
amgx->cfg_contents.c_str()
from this line:
PetscCallAmgX(AMGX_config_create(&amgx->cfg, amgx->cfg_contents.c_str()));
(there are two occurrences of this call, depending on which is called in your case)
@marsaev: Here is what I am seeing: The first:
if (!partial_setup_allowed) { // Initialise resources and matrices if (!amgx->rsrc_init) { // Read configuration file PetscCallAmgX(AMGX_config_create(&amgx->cfg, amgx->cfg_contents.c_str())); PetscCallAmgX(AMGX_resources_create(&amgx->rsrc, amgx->cfg, &amgx->comm, 1, &amgx->devID)); amgx->rsrc_init = true; } The second:
PetscFunctionBegin; if (!amgx->rsrc_init) { // Read configuration file PetscCallAmgX(AMGX_config_create(&amgx->cfg, amgx->cfg_contents.c_str())); PetscCallAmgX(AMGX_resources_create(&amgx->rsrc, amgx->cfg, &amgx->comm, 1, &amgx->devID)); amgx->rsrc_init = true; }
Can you dump the contents of those variables?
amgx->cfg_contents.c_str()
@marsaev I am attempting to do this by adding a print statement, as in the following example:
if (!partial_setup_allowed) { // Initialise resources and matrices if (!amgx->rsrc_init) { // Read configuration file PetscCallAmgX(AMGX_config_create(&amgx->cfg, amgx->cfg_contents.c_str())); printf("amgx->cfg.contents.c_str"); PetscCallAmgX(AMGX_resources_create(&amgx->rsrc, amgx->cfg, &amgx->comm, 1, &amgx->devID)); amgx->rsrc_init = true; }
I am not seeing any output in the console. Is there another way to do this?
@marsaev A few other things I noticed while looking at the error message and outlog that may help:
- Some of the error messages in my toolkit attached above point to:
[/externalpackages/petsc/src/src/ksp/pc/impls/amgx/amgx.cxx]
This path actually does not exist, as amgx.cxx is at /externalpackages/petsc/src/ksp/pc/impls/amgx/amgx.cxx.
- I am also not sure if AMGX is actually doing preconditioning at all, as I am using pc_amgx_verbose and am getting no output saying that the solver has failed.
Thanks
I am attempting to do this by adding a print statement, as in the following example:
Can you replace it with:
printf("============================================");
printf(" AMGX configuration:\n%s\n", amgx->cfg_contents.c_str());
printf("============================================");
There is a small chance PETSc suppresses printf and you can try writing this to file, but other than that - if you don't see output - that means this code is not reached and AMGX configured somewhere else.
Unfortunately I cannot answer your PETSc questions.
@marsaev
This is the content of amgx->cfg_contents.c_str()
==================================================================================== AMGX version 2.4.0 Built on Oct 3 2024, 01:48:03 Compiled with CUDA Runtime 11.8, using CUDA driver 12.6 The AMGX_initialize_plugins API call is deprecated and can be safely removed.
config_version=2,determinism_flag=1,exact_coarse_solve=1,solver(amg)=AMG,amg:algorithm=AGGREGATION,amg:cycle=V,amg:smoother(smooth)=BLOCK_JACOBI,smooth:relaxation_factor=0.900000,amg:selector=PMIS,amg:presweeps=1,amg:postsweeps=1,amg:max_levels=100,amg:dense_lu_num_rows=1,amg:strength_threshold=0.500000,amg:coarse_solver=DENSE_LU_SOLVER,amg:max_iters=1,amg:monitor_residual=0
.....
Caught amgx exception: SelectorFactory 'PMIS' has not been registered
===================================================================================