[petsc-users] Bug or unexpected behaviour when running petsc+hypre on CPUs

Stefano Zampini stefano.zampini at gmail.com
Wed Aug 6 11:58:26 CDT 2025


>
> If I use
>
> -pc_type hypre
> -pc_hypre_type boomeramg
> -pc_hypre_boomeramg_coarsen_type hmis
> -pc_hypre_boomeramg_interp_type ext+i
> -pc_hypre_boomeramg_relax_type_all SOR/Jacobi
> -pc_hypre_boomeramg_relax_type_coarse SOR/Jacobi
> -pc_hypre_boomeramg_grid_sweeps_coarse 1
> -pc_hypre_boomeramg_strong_threshold 0.25
>
>
>
Some HYPRE options for the relaxation and coarsening type are not coded for
GPU, that's probably the reason for the segfault.
I suggest you run without special options and start adding one by one until
you find the ones are not supported.




>
>
> Instead if I use  only
>
> -pc_type hypre
>
>
This probably leads to a successful setup of the preconditioner on the GPU,
but then you most probably are passing a CPU vector for the RHS.
A convenient way to have always a consistent vector is to use MatCreateVecs



> I get
>
>
>
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Invalid argument
> [0]PETSC ERROR: HYPRE_MEMORY_DEVICE expects a device vector. You need to
> enable PETSc device support, for example, in some cases, -vec_type cuda
>
>
> This helped my realise that hypre was trying to use the GPU despite in my
> code
>
> Both runs are succesfull when compiling without -with-cuda
>
> Best,
> Herbert Owen
> Senior Researcher, Dpt. Computer Applications in Science and Engineering
> Barcelona Supercomputing Center (BSC-CNS)
> Tel: +34 93 413 4038
> Skype: herbert.owen
>
> https://urldefense.us/v3/__https://scholar.google.es/citations?user=qe5O2IYAAAAJ&hl=en__;!!G_uCfscf7eWS!eUJy7kA8zOa0CWtMLCijo4AR4thJRQNNhM5OhBMp-pokLY6RYnJGRnEk-eGL8I2CaNf-zHz2v5dFWMA7LEJ_D_EJapgyt-Y$ 
> <https://urldefense.us/v3/__https://scholar.google.es/citations?user=qe5O2IYAAAAJ&hl=en__;!!G_uCfscf7eWS!f0Y_9okAiFSBeUBOlNplMe6jOCPtdRHfhX2s_rz3N9kCK4OJGiGWGjFyRd3JOwojw7MeNEA-VJtgdn8wBbCmRkKVuPTJ$>
>
>
>
>
>
>
>
>
>

-- 
Stefano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250806/daf5226e/attachment.html>


More information about the petsc-users mailing list