[petsc-users] Warning [-Wformat-overflow]

2024-07-11 Thread Ivan Luthfi
I have warning: FormatFunction.c: In function 'ComputeStiffnessMatrix': FormatFunction.c:128:46: warning: '%d' directive writing between 1 and 11 bytes into a region of size between 0 and 99 [-Wformat-overflow] (line128) sprintf(filename, "%sc%d_N%dM%d_permeability.log", up->problem_description,

Re: [petsc-users] error: 'DMDA_BOUNDARY_NONE'

2024-07-11 Thread Pierre Jolivet
> On 12 Jul 2024, at 5:51 AM, Ivan Luthfi wrote: > > This Message Is From an External Sender > This message came from outside your organization. > Hello there, > I am trying to update a very old petsc code. > > When i run it i get the following error. > > FormFunction.c:14:47: error: 'DMDA_B

[petsc-users] error: 'DMDA_BOUNDARY_NONE'

2024-07-11 Thread Ivan Luthfi
Hello there, I am trying to update a very old petsc code. When i run it i get the following error. FormFunction.c:14:47: error: 'DMDA_BOUNDARY_NONE' undeclared (first use in this function); did you mean 'DM_BOUNDARY_NONE'? ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_N

Re: [petsc-users] Asking about warning unused variable

2024-07-11 Thread Satish Balay
On Fri, 12 Jul 2024, Ivan Luthfi wrote: > Hello, > > I have declare a variable in my petsc code like the following: > > PetscInt mg_level = 2, finest; > > but i get warning. The warning is, > > (line185) warning:  ZjQcmQRYFpfptBannerStart This Message Is From an Externa

[petsc-users] Asking about warning unused variable

2024-07-11 Thread Ivan Luthfi
Hello, I have declare a variable in my petsc code like the following: PetscInt mg_level = 2, finest; but i get warning. The warning is, (line185) warning: 'variable 'finest' set but not used [-Wunused-but-set-variable] PetscInt mg_level=2, finest; But actually it is used in line 200 as: (line

Re: [petsc-users] What exactly is the GlobalToNatural PetscSF of DMPlex/DM?

2024-07-11 Thread Matthew Knepley
On Mon, Jul 8, 2024 at 10:28 PM Ferrand, Jesus A. wrote: > Dear PETSc team: Greetings. I keep working on mesh I/O utilities using > DMPlex. Specifically for the output stage, I need a solid grasp on the > global numbers and ideally how to set them into the DMPlex during an input > operation and c

Re: [petsc-users] question on matrix preallocation

2024-07-11 Thread Michael Povolotskyi
Thanks a lot, I'm using petsc since 2004 On 7/11/2024 5:09 PM, Barry Smith wrote:    The default behavior previously was the flip of the current behavior. By the way, we also now have much better performance if you do not preallocate (not as good as with perfect preallocation, but much bette

Re: [petsc-users] question on matrix preallocation

2024-07-11 Thread Barry Smith
The default behavior previously was the flip of the current behavior. By the way, we also now have much better performance if you do not preallocate (not as good as with perfect preallocation, but much better than in ancient history; you simply do not preallocate to get this behavior). Ba

Re: [petsc-users] question on matrix preallocation

2024-07-11 Thread Michael Povolotskyi
Thanks a lot. Is this a new feature? It seems to me that 10 years ago the default behavior was different. Michael. On 7/11/2024 4:04 PM, Barry Smith wrote:  By default, if you preallocate but not enough, it will automatically error unless you call MatSetOption(mat,MAT_NEW_NONZERO_ALLOCATI

Re: [petsc-users] question on matrix preallocation

2024-07-11 Thread Barry Smith
By default, if you preallocate but not enough, it will automatically error unless you call MatSetOption(mat,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE); > On Jul 11, 2024, at 4:02 PM, Michael Povolotskyi wrote: > > Thank you, > > let me clarify my question. > > Imagine that I have a sparse

Re: [petsc-users] MKL Pardiso returning NAN values

2024-07-11 Thread Chris Hewson
So are you saying that MKL_Padiso is returning inf/nan in the solution but a return code less than or equal to zero? - that's correct Is this expected behavior of MKL Pardiso? - from what I can see, that does appear to be the expected behavior of Pardiso. I mean I guess it has solved the system c

Re: [petsc-users] question on matrix preallocation

2024-07-11 Thread Michael Povolotskyi
Thank you, let me clarify my question. Imagine that I have a sparse matrix, and the number of non zero entries that I specified is too small. I know that I can insert values in it but it will be slow. I remember there was a way to make PETSC to throw an error if a number of non zero element

Re: [petsc-users] question on matrix preallocation

2024-07-11 Thread Barry Smith
MatGetInfo() is the programmatic interface used to get this information. You can also run a proggram with -info and grep for malloc. Barry > On Jul 11, 2024, at 1:55 PM, Michael Povolotskyi wrote: > > This Message Is From an External Sender > This message came from outside your organiza

Re: [petsc-users] MKL Pardiso returning NAN values

2024-07-11 Thread Barry Smith
We don't by default, for example, check the norm of the solution returned by an external direct solver due to the added expense. We do check the error condition returned by MKL Pardiso with PetscCheck(mat_mkl_pardiso->err >= 0, PETSC_COMM_SELF, PETSC_ERR_LIB, "Error reported by MKL PAR

Re: [petsc-users] How to add additional cpp flags in the makefile while compiling a code?

2024-07-11 Thread Satish Balay
CXXFLAGS, (and similarly CXXPPFLAGS) should work -as I've shown in my prior e-mail [if you are using default PETSc makefile targets] Satish balay@ pj01: ~/test$ ls ex2. cpp makefile balay@ pj01: ~/test$ cat makefile CXXFLAGS = -test_cxxflags ZjQcmQRYFpfptBannerStart

Re: [petsc-users] How to add additional cpp flags in the makefile while compiling a code?

2024-07-11 Thread Qiyue Lu
Please ignore the previous thread. By using NVCC, I can append additional options to CXXPPFLAGS. Thanks On Thu, Jul 11, 2024 at 2:28 PM Qiyue Lu wrote: > Thanks, it works with appending to LDFLAGS. > May I know how to add additional CPP options? It seems manually adding to > CXXFLAGS, CPPFLAGS

Re: [petsc-users] How to add additional cpp flags in the makefile while compiling a code?

2024-07-11 Thread Qiyue Lu
Thanks, it works with appending to LDFLAGS. May I know how to add additional CPP options? It seems manually adding to CXXFLAGS, CPPFLAGS and CXXPPFLAGS won't work in the makefile. Qiyue Lu On Tue, Jul 9, 2024 at 6:34 PM Satish Balay wrote: > And sometimes you might need to list these additional

[petsc-users] question on matrix preallocation

2024-07-11 Thread Michael Povolotskyi
Hello, is there an option in PETSC that allows to check at run time if a sparse matrix has been preallocated correctly? I remember there was something like that is the older versions, but cannot find it now. The goal is to get rid of any possible ZjQcmQRYFpfptBannerStart

Re: [petsc-users] MKL Pardiso returning NAN values

2024-07-11 Thread Mark Adams
Not sure I understand the question but if you use '-ksp_type richardson' then you get a convergence check. Then you might say '-ksp_rtol 1e-1 -ksp_max_it 1' just to check if it failed with convered _reason. Just requires one residual calculation. Mark On Wed, Jul 10, 2024 at 5:02 PM Chris Hewson