Re: [petsc-users] [petsc-maint] Inquiry about Multithreading Capabilities in PETSc's KSPSolver

2024-04-23 Thread Matthew Knepley
On Tue, Apr 23, 2024 at 4:00 PM Yongzhong Li wrote: > Thanks Barry! Does this mean that the sparse matrix-vector products, which > actually constitute the majority of the computations in my GMRES routine in > PETSc, don’t utilize multithreading? Only basic vector operations such as > VecAXPY and

Re: [petsc-users] [petsc-maint] Inquiry about Multithreading Capabilities in PETSc's KSPSolver

2024-04-23 Thread Barry Smith
Yes, only the routines that can explicitly use BLAS have multi-threading. PETSc does support using nay MPI linear solvers from a sequential (or OpenMP) main program using the https://urldefense.us/v3/__https://petsc.org/release/manualpages/PC/PCMPI/*pcmpi__;Iw!!G_uCfscf7eWS!axQjxZeWC27cy3W

Re: [petsc-users] [petsc-maint] Inquiry about Multithreading Capabilities in PETSc's KSPSolver

2024-04-23 Thread Junchao Zhang
No, I think sparse matrix-vector products (MatMult in petsc) can be accelerated with multithreading. petsc does not do that, but one can use other libraries, such as MKL for that. --Junchao Zhang On Tue, Apr 23, 2024 at 3:00 PM Yongzhong Li wrote: > Thanks Barry! Does this mean that the spars

Re: [petsc-users] [petsc-maint] Inquiry about Multithreading Capabilities in PETSc's KSPSolver

2024-04-23 Thread Yongzhong Li
Thanks Barry! Does this mean that the sparse matrix-vector products, which actually constitute the majority of the computations in my GMRES routine in PETSc, don’t utilize multithreading? Only basic vector operations such as VecAXPY and VecDot or dense matrix operations in PETSc will benefit fro

Re: [petsc-users] [petsc-maint] Inquiry about Multithreading Capabilities in PETSc's KSPSolver

2024-04-23 Thread Barry Smith
Intel MKL or OpenBLAS are the best bet, but for vector operations they will not be significant since the vector operations do not dominate the computations. > On Apr 23, 2024, at 3:23 PM, Yongzhong Li > wrote: > > Hi Barry, > > Thank you for the information provided! > > Do you think dif

Re: [petsc-users] [petsc-maint] Inquiry about Multithreading Capabilities in PETSc's KSPSolver

2024-04-23 Thread Yongzhong Li
Hi Barry, Thank you for the information provided! Do you think different BLAS implementation will affect the multithreading performance of some vectors operations in GMERS in PETSc? I am now using OpenBLAS but didn’t see much improvement when theb multithreading are enabled, do you think other

Re: [petsc-users] Parallelism of the Mat.convert() function

2024-04-23 Thread Pierre Jolivet
The code is behaving as it should, IMHO. Here is a way to have the Mat stored the same independently of the number of processes. […] global_rows, global_cols = input_array.T.shape size = ((None, global_rows), (0 if COMM_WORLD.Get_rank() < COMM_WORLD.Get_size() - 1 else global_cols, global_cols))

[petsc-users] Parallelism of the Mat.convert() function

2024-04-23 Thread Miguel Angel Salazar de Troya
Hello, The following code returns a different answer depending on how many processors I use. With one processor, the last MPIAIJ matrix is correctly formed: row 0: (0, 1.) (1, 2.) (2, 3.) (3, 4.) (4, -1.) row 1: (0, 5.) (1, 6.) (2, 7.) (3, 8.) (4, -2.) row 2: (0, 9.) (1, 10.) (2, 11.)