Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue]Caught amgx exception: SelectorFactory 'PMIS' has not been registered #315

Open
kkmund146 opened this issue Jun 28, 2024 · 11 comments
Labels

Comments

@kkmund146
Copy link

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

@kkmund146 kkmund146 added the bug label Jun 28, 2024
@marsaev
Copy link
Collaborator

marsaev commented Jul 2, 2024

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,

@kkmund146
Copy link
Author

kkmund146 commented Jul 9, 2024

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

@marsaev
Copy link
Collaborator

marsaev commented Jul 9, 2024

@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,

@kkmund146
Copy link
Author

@marsaev I believe this is what you were looking for, see attached.
amgx.cxx.pdf

@marsaev
Copy link
Collaborator

marsaev commented Jul 9, 2024

@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)

@kkmund146
Copy link
Author

kkmund146 commented Jul 9, 2024

@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;
}

@marsaev
Copy link
Collaborator

marsaev commented Jul 9, 2024

Can you dump the contents of those variables?
amgx->cfg_contents.c_str()

@kkmund146
Copy link
Author

kkmund146 commented Jul 10, 2024

@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?

@kkmund146
Copy link
Author

@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

@marsaev
Copy link
Collaborator

marsaev commented Jul 11, 2024

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.

@xiaochiyue
Copy link

xiaochiyue commented Oct 3, 2024

@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

===================================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants