Re: [petsc-users] Norm_2 calculation

2020-06-05 Thread Fazlul Huq
Thanks for the hint!
I will look at the matrix more closely.

For reference:

  if (!rstart) {
rstart = 1;
i  = 0; col[0] = 0; col[1] = 1; value[0] = 2.0; value[1] = -1.0;
ierr   = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr);
  }
  if (rend == n) {
rend = n-1;
i= n-1; col[0] = n-2; col[1] = n-1; value[0] = -1.0; value[1] = 2.0;
ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr);
  }

  /* Set entries corresponding to the mesh interior */
  value[0] = -1.0; value[1] = 2.0; value[2] = -1.0;
  for (i=rstart; i wrote:

> On Fri, Jun 5, 2020 at 2:18 PM Fazlul Huq  wrote:
>
>> The same is happening with "-pc_type hypre -pc_hypre_type boomerang" and
>> with "-pc_type ilu".
>>
>> I tried with,
>> ierr =
>> KSPSetTolerances(ksp,1.e-10,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT);CHKERRQ(ierr);
>> this also.
>>
>> Getting higher values of error even then.
>>
>
> Always check with
>
>   -pc_type lu
>
> It seems likely that your matrix is flawed.
>
>   Thanks,
>
>  Matt
>
>
>> Any suggestion to go over this issue?
>> Shall I send the code? It's not a large script (single routine, less than
>> 100 lines except comment).
>>
>> Thank you.
>> Sincerely,
>> Huq
>>
>> On Fri, Jun 5, 2020 at 12:53 PM Matthew Knepley 
>> wrote:
>>
>>> On Fri, Jun 5, 2020 at 12:32 PM Fazlul Huq  wrote:
>>>
>>>> Input string:
>>>> mpiexec -np 1 ./poisson_m -n 1000 -pc_type cholesky  -ksp_view
>>>> -ksp_converged_reason -ksp_monitor_true_residual
>>>>
>>>> Output is attached herewith.
>>>>
>>>
>>> Solving the problem...
>>>
>>>   0 KSP preconditioned resid norm 9.741453255800e+07 true resid norm
>>> 1.802775638200e+01 ||r(i)||/||b|| 1.e+00
>>>
>>>   1 KSP preconditioned resid norm 5.796040438920e+00 true resid norm
>>> 3.146946078273e-05 ||r(i)||/||b|| 1.745611606675e-06
>>>
>>> Your Cholesky preconditioner is crap, probably because the system is
>>> either not symmetric or nearly singular. You can see this
>>> because the preconditioned residual is 6 orders of magnitude greater
>>> than the true residual. Also, if you want to evaluate convergence, you
>>> should probably use a lower tolerance like
>>>
>>>   -ksp_rtol 1e-10
>>>
>>>   Thanks,
>>>
>>>  Matt
>>>
>>> Thank you.
>>>> Sincerely,
>>>> Huq
>>>>
>>>> On Fri, Jun 5, 2020 at 10:16 AM Matthew Knepley 
>>>> wrote:
>>>>
>>>>> On Fri, Jun 5, 2020 at 11:04 AM Fazlul Huq  wrote:
>>>>>
>>>>>> Hello All,
>>>>>> I'm trying to calculate the norm_2 error of a solution.
>>>>>> Here, vector s: Analytical solution
>>>>>>   vector x: Numerical solution
>>>>>>
>>>>>> ierr = VecView(s,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>>>> ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>>>>
>>>>>>  ierr = VecAXPY(x,-1.0,s);CHKERRQ(ierr);
>>>>>>  ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
>>>>>>  ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>>>>  ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
>>>>>>  if (norm > tol) {
>>>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Second Norm of error %g\n",
>>>>>> double)norm);CHKERRQ(ierr);
>>>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Iterations
>>>>>> %D\n",its);CHKERRQ(ierr);
>>>>>>   }
>>>>>>
>>>>>> Am I calculating the "Norm_2" error correctly or making any mistake?
>>>>>> Unfortunately, for large sized matrix, say 10^6, I am getting very
>>>>>> high value of "Norm_2" error.
>>>>>>
>>>>>
>>>>> 1) I am guessing x comes from a KSPSolve(). It is only as accurate as
>>>>> your tolerance
>>>>>
>>>>> 2) This is the l_2 norm, not the L_2 norm, so if you are using a
>>>>> continuum method like FEM, this is likely wrong.
>>>>>
>>>>>   Thanks,
>>>>>
>>>>>  Matt
>>>>>
>>>>>
>>>>>> Thank you.
>>>

Re: [petsc-users] Norm_2 calculation

2020-06-05 Thread Fazlul Huq
The same is happening with "-pc_type hypre -pc_hypre_type boomerang" and
with "-pc_type ilu".

I tried with,
ierr =
KSPSetTolerances(ksp,1.e-10,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT);CHKERRQ(ierr);
this also.

Getting higher values of error even then.

Any suggestion to go over this issue?
Shall I send the code? It's not a large script (single routine, less than
100 lines except comment).

Thank you.
Sincerely,
Huq

On Fri, Jun 5, 2020 at 12:53 PM Matthew Knepley  wrote:

> On Fri, Jun 5, 2020 at 12:32 PM Fazlul Huq  wrote:
>
>> Input string:
>> mpiexec -np 1 ./poisson_m -n 1000 -pc_type cholesky  -ksp_view
>> -ksp_converged_reason -ksp_monitor_true_residual
>>
>> Output is attached herewith.
>>
>
> Solving the problem...
>
>   0 KSP preconditioned resid norm 9.741453255800e+07 true resid norm
> 1.802775638200e+01 ||r(i)||/||b|| 1.e+00
>
>   1 KSP preconditioned resid norm 5.796040438920e+00 true resid norm
> 3.146946078273e-05 ||r(i)||/||b|| 1.745611606675e-06
>
> Your Cholesky preconditioner is crap, probably because the system is
> either not symmetric or nearly singular. You can see this
> because the preconditioned residual is 6 orders of magnitude greater than
> the true residual. Also, if you want to evaluate convergence, you
> should probably use a lower tolerance like
>
>   -ksp_rtol 1e-10
>
>   Thanks,
>
>  Matt
>
> Thank you.
>> Sincerely,
>> Huq
>>
>> On Fri, Jun 5, 2020 at 10:16 AM Matthew Knepley 
>> wrote:
>>
>>> On Fri, Jun 5, 2020 at 11:04 AM Fazlul Huq  wrote:
>>>
>>>> Hello All,
>>>> I'm trying to calculate the norm_2 error of a solution.
>>>> Here, vector s: Analytical solution
>>>>   vector x: Numerical solution
>>>>
>>>> ierr = VecView(s,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>> ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>>
>>>>  ierr = VecAXPY(x,-1.0,s);CHKERRQ(ierr);
>>>>  ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
>>>>  ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>>  ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
>>>>  if (norm > tol) {
>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Second Norm of error %g\n",
>>>> double)norm);CHKERRQ(ierr);
>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Iterations
>>>> %D\n",its);CHKERRQ(ierr);
>>>>   }
>>>>
>>>> Am I calculating the "Norm_2" error correctly or making any mistake?
>>>> Unfortunately, for large sized matrix, say 10^6, I am getting very high
>>>> value of "Norm_2" error.
>>>>
>>>
>>> 1) I am guessing x comes from a KSPSolve(). It is only as accurate as
>>> your tolerance
>>>
>>> 2) This is the l_2 norm, not the L_2 norm, so if you are using a
>>> continuum method like FEM, this is likely wrong.
>>>
>>>   Thanks,
>>>
>>>      Matt
>>>
>>>
>>>> Thank you.
>>>> Sincerely,
>>>> Huq
>>>>
>>>> --
>>>>
>>>> Fazlul Huq
>>>> Graduate Research Assistant
>>>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>>>> University of Illinois at Urbana-Champaign (UIUC)
>>>> E-mail: huq2...@gmail.com
>>>>
>>>
>>>
>>> --
>>> What most experimenters take for granted before they begin their
>>> experiments is infinitely more interesting than any results to which their
>>> experiments lead.
>>> -- Norbert Wiener
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>
>>
>> --
>>
>> Fazlul Huq
>> Graduate Research Assistant
>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>> University of Illinois at Urbana-Champaign (UIUC)
>> E-mail: huq2...@gmail.com
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com
Total time st

Re: [petsc-users] Norm_2 calculation

2020-06-05 Thread Fazlul Huq
Input string:
mpiexec -np 1 ./poisson_m -n 1000 -pc_type cholesky  -ksp_view
-ksp_converged_reason -ksp_monitor_true_residual

Output is attached herewith.

Thank you.
Sincerely,
Huq

On Fri, Jun 5, 2020 at 10:16 AM Matthew Knepley  wrote:

> On Fri, Jun 5, 2020 at 11:04 AM Fazlul Huq  wrote:
>
>> Hello All,
>> I'm trying to calculate the norm_2 error of a solution.
>> Here, vector s: Analytical solution
>>   vector x: Numerical solution
>>
>> ierr = VecView(s,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>> ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>
>>  ierr = VecAXPY(x,-1.0,s);CHKERRQ(ierr);
>>  ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
>>  ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>  ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
>>  if (norm > tol) {
>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Second Norm of error %g\n",
>> double)norm);CHKERRQ(ierr);
>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Iterations
>> %D\n",its);CHKERRQ(ierr);
>>   }
>>
>> Am I calculating the "Norm_2" error correctly or making any mistake?
>> Unfortunately, for large sized matrix, say 10^6, I am getting very high
>> value of "Norm_2" error.
>>
>
> 1) I am guessing x comes from a KSPSolve(). It is only as accurate as your
> tolerance
>
> 2) This is the l_2 norm, not the L_2 norm, so if you are using a continuum
> method like FEM, this is likely wrong.
>
>   Thanks,
>
>  Matt
>
>
>> Thank you.
>> Sincerely,
>> Huq
>>
>> --
>>
>> Fazlul Huq
>> Graduate Research Assistant
>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>> University of Illinois at Urbana-Champaign (UIUC)
>> E-mail: huq2...@gmail.com
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com
Total time starting..

Preparing and assigning values in matrix and vectors...


Allocation is completed in 4.449939 sec. 

Solving the problem...  0 KSP preconditioned resid norm 9.741453255800e+07 true resid norm 1.802775638200e+01 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 5.796040438920e+00 true resid norm 3.146946078273e-05 ||r(i)||/||b|| 1.745611606675e-06
Linear solve converged due to CONVERGED_RTOL iterations 1
KSP Object: 1 MPI processes
  type: gmres
restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
happy breakdown tolerance 1e-30
  maximum iterations=1, initial guess is zero
  tolerances:  relative=1e-07, absolute=1e-50, divergence=1.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: cholesky
out-of-place factorization
tolerance for zero pivot 2.22045e-14
matrix ordering: nd
factor fill ratio given 5., needed 1.5
  Factored matrix follows:
Mat Object: 1 MPI processes
  type: seqsbaij
  rows=1000, cols=1000
  package used to perform factorization: petsc
  total: nonzeros=2954, allocated nonzeros=2954
  total number of mallocs used during MatSetValues calls=0
  block size is 1
  linear system matrix = precond matrix:
  Mat Object: 1 MPI processes
type: seqaij
rows=1000, cols=1000
total: nonzeros=2998, allocated nonzeros=5000
total number of mallocs used during MatSetValues calls=0
  not using I-node routines

Problem solved by 15.404302 sec. 


Total time 19.854268 sec. 

KSP Object: 1 MPI processes
  type: gmres
restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
happy breakdown tolerance 1e-30
  maximum iterations=1, initial guess is zero
  tolerances:  relative=1e-07, absolute=1e-50, divergence=1.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: cholesky
out-of-place factorization
tolerance for zero pivot 2.22045e-14
matrix ordering: nd
factor fill ratio given 5., needed 1.5
  Factored matrix follows:
Mat Object: 1 MPI processes
  type: seqsbaij
  rows=1000, cols=1000
  package used to perform factorization: petsc
  total: nonzeros=2954, allocated nonzeros=

[petsc-users] Norm_2 calculation

2020-06-05 Thread Fazlul Huq
Hello All,
I'm trying to calculate the norm_2 error of a solution.
Here, vector s: Analytical solution
  vector x: Numerical solution

ierr = VecView(s,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);

 ierr = VecAXPY(x,-1.0,s);CHKERRQ(ierr);
 ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
 ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
 ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
 if (norm > tol) {
ierr = PetscPrintf(PETSC_COMM_WORLD,"Second Norm of error %g\n",
double)norm);CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_WORLD,"Iterations
%D\n",its);CHKERRQ(ierr);
  }

Am I calculating the "Norm_2" error correctly or making any mistake?
Unfortunately, for large sized matrix, say 10^6, I am getting very high
value of "Norm_2" error.

Thank you.
Sincerely,
Huq

-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


Re: [petsc-users] Running example problem

2020-06-04 Thread Fazlul Huq
"make all test" gives the attached summary.

Looks like only one problem failed.
All the others passed.

Thanks.
Sincerely,
Huq

On Thu, Jun 4, 2020 at 12:27 PM Satish Balay  wrote:

> Should work
>
> If it fails -  send us corresponding configure.log
>
> Satish
>
> On Thu, 4 Jun 2020, Fazlul Huq wrote:
>
> > I think it's okay to have a separate version of hypre for PETSc.
> > So, what I understand is I have to do,
> >
> > ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
> > --download-mpich --download-fblaslapack --download-hypre
> > make all test
> >
> > Is that all?
> > Am I missing something?
> >
> > Thank you.
> > Sincerely,
> > Huq
> >
> >
> > On Thu, Jun 4, 2020 at 11:04 AM Satish Balay  wrote:
> >
> > > Its best to use --download-hypre with PETSc configure - it installs a
> > > compatible version of hypre.
> > >
> > > If you have a pre-installed hypre, you'l have to:
> > > - make sure its compatible version
> > > - its built with the same MPI, compilers etc as PETSc
> > > - you can use --with-hypre-dir option with PETSc configure
> > >
> > > Satish
> > >
> > > On Thu, 4 Jun 2020, Fazlul Huq wrote:
> > >
> > > > I have HYPRE installed in my machine.
> > > > Ithink, I need to compile PETSc with HYPRE.
> > > > I'm not clear about how to do that?
> > > >
> > > > Thank you.
> > > > Sincerely,
> > > > Huq
> > > >
> > > > On Thu, Jun 4, 2020 at 10:13 AM Matthew Knepley 
> > > wrote:
> > > >
> > > > > On Thu, Jun 4, 2020 at 10:28 AM Fazlul Huq 
> wrote:
> > > > >
> > > > >> Thank you.
> > > > >> Working now.
> > > > >>
> > > > >> I think to run the following command I need to configure PETSc
> with
> > > HYPRE.
> > > > >> mpiexec -np 1 ./poisson_m -n 10 -pc_type hypre -pc_hypre_type
> > > > >> boomerang
> > > > >>
> > > > >> If I am right, can you please guide me how to configure with
> HYPRE and
> > > > >> run the above command?
> > > > >>
> > > > >
> > > > > --download-hypre
> > > > >
> > > > >   Thanks,
> > > > >
> > > > >  Matt
> > > > >
> > > > >
> > > > >> Thank you.
> > > > >> Sincerely,
> > > > >> Huq
> > > > >>
> > > > >> On Thu, Jun 4, 2020 at 8:34 AM Matthew Knepley  >
> > > wrote:
> > > > >>
> > > > >>>
> > > > >>> On Thu, Jun 4, 2020 at 9:19 AM Dave May  >
> > > wrote:
> > > > >>>
> > > > >>>>
> > > > >>>>
> > > > >>>> On Thu, 4 Jun 2020 at 14:17, Dave May 
> > > wrote:
> > > > >>>>
> > > > >>>>>
> > > > >>>>>
> > > > >>>>> On Thu, 4 Jun 2020 at 14:15, Matthew Knepley <
> knep...@gmail.com>
> > > > >>>>> wrote:
> > > > >>>>>
> > > > >>>>>> On Thu, Jun 4, 2020 at 9:12 AM Fazlul Huq 
> > > wrote:
> > > > >>>>>>
> > > > >>>>>>> Somehow, make is not working.
> > > > >>>>>>> Please find the attachment herewith for the terminal readout.
> > > > >>>>>>>
> > > > >>>>>>
> > > > >>>>>> Since you built with PETSC_ARCH=linux-gnu, you need that in
> your
> > > > >>>>>> environment.
> > > > >>>>>>
> > > > >>>>>
> > > > >>>>> Or just do
> > > > >>>>>
> > > > >>>>> make ex5 PETSC_ARCH=linux-gnu
> > > > >>>>>
> > > > >>>>
> > > > >>>> sorry I hit send without checking your png)
> > > > >>>> The command should be
> > > > >>>>
> > > > >>>> make ex5 PETSC_ARCH=arch-linux2-c-debug
> > > > >>>>
> > > > >>>
> > > > >>> No, your first o

Re: [petsc-users] Running example problem

2020-06-04 Thread Fazlul Huq
I think it's okay to have a separate version of hypre for PETSc.
So, what I understand is I have to do,

./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
--download-mpich --download-fblaslapack --download-hypre
make all test

Is that all?
Am I missing something?

Thank you.
Sincerely,
Huq


On Thu, Jun 4, 2020 at 11:04 AM Satish Balay  wrote:

> Its best to use --download-hypre with PETSc configure - it installs a
> compatible version of hypre.
>
> If you have a pre-installed hypre, you'l have to:
> - make sure its compatible version
> - its built with the same MPI, compilers etc as PETSc
> - you can use --with-hypre-dir option with PETSc configure
>
> Satish
>
> On Thu, 4 Jun 2020, Fazlul Huq wrote:
>
> > I have HYPRE installed in my machine.
> > Ithink, I need to compile PETSc with HYPRE.
> > I'm not clear about how to do that?
> >
> > Thank you.
> > Sincerely,
> > Huq
> >
> > On Thu, Jun 4, 2020 at 10:13 AM Matthew Knepley 
> wrote:
> >
> > > On Thu, Jun 4, 2020 at 10:28 AM Fazlul Huq  wrote:
> > >
> > >> Thank you.
> > >> Working now.
> > >>
> > >> I think to run the following command I need to configure PETSc with
> HYPRE.
> > >> mpiexec -np 1 ./poisson_m -n 10 -pc_type hypre -pc_hypre_type
> > >> boomerang
> > >>
> > >> If I am right, can you please guide me how to configure with HYPRE and
> > >> run the above command?
> > >>
> > >
> > > --download-hypre
> > >
> > >   Thanks,
> > >
> > >  Matt
> > >
> > >
> > >> Thank you.
> > >> Sincerely,
> > >> Huq
> > >>
> > >> On Thu, Jun 4, 2020 at 8:34 AM Matthew Knepley 
> wrote:
> > >>
> > >>>
> > >>> On Thu, Jun 4, 2020 at 9:19 AM Dave May 
> wrote:
> > >>>
> > >>>>
> > >>>>
> > >>>> On Thu, 4 Jun 2020 at 14:17, Dave May 
> wrote:
> > >>>>
> > >>>>>
> > >>>>>
> > >>>>> On Thu, 4 Jun 2020 at 14:15, Matthew Knepley 
> > >>>>> wrote:
> > >>>>>
> > >>>>>> On Thu, Jun 4, 2020 at 9:12 AM Fazlul Huq 
> wrote:
> > >>>>>>
> > >>>>>>> Somehow, make is not working.
> > >>>>>>> Please find the attachment herewith for the terminal readout.
> > >>>>>>>
> > >>>>>>
> > >>>>>> Since you built with PETSC_ARCH=linux-gnu, you need that in your
> > >>>>>> environment.
> > >>>>>>
> > >>>>>
> > >>>>> Or just do
> > >>>>>
> > >>>>> make ex5 PETSC_ARCH=linux-gnu
> > >>>>>
> > >>>>
> > >>>> sorry I hit send without checking your png)
> > >>>> The command should be
> > >>>>
> > >>>> make ex5 PETSC_ARCH=arch-linux2-c-debug
> > >>>>
> > >>>
> > >>> No, your first one was right.
> > >>>
> > >>>Matt
> > >>>
> > >>>
> > >>>>
> > >>>>>
> > >>>>>
> > >>>>>>
> > >>>>>>   Thanks,
> > >>>>>>
> > >>>>>>  Matt
> > >>>>>>
> > >>>>>>
> > >>>>>>> Thank you.
> > >>>>>>>
> > >>>>>>> Sincerely,
> > >>>>>>> Huq
> > >>>>>>>
> > >>>>>>> On Thu, Jun 4, 2020 at 7:57 AM Matthew Knepley <
> knep...@gmail.com>
> > >>>>>>> wrote:
> > >>>>>>>
> > >>>>>>>> On Thu, Jun 4, 2020 at 8:53 AM Fazlul Huq 
> > >>>>>>>> wrote:
> > >>>>>>>>
> > >>>>>>>>> Hello,
> > >>>>>>>>>
> > >>>>>>>>> I have a very preliminary question!
> > >>>>>>>>> I think I have installed PETSc correctly cause I got following
> on
> > >>>>>>>>> the terminal:
> > >>>>>>>>>
&g

Re: [petsc-users] Running example problem

2020-06-04 Thread Fazlul Huq
I have HYPRE installed in my machine.
Ithink, I need to compile PETSc with HYPRE.
I'm not clear about how to do that?

Thank you.
Sincerely,
Huq

On Thu, Jun 4, 2020 at 10:13 AM Matthew Knepley  wrote:

> On Thu, Jun 4, 2020 at 10:28 AM Fazlul Huq  wrote:
>
>> Thank you.
>> Working now.
>>
>> I think to run the following command I need to configure PETSc with HYPRE.
>> mpiexec -np 1 ./poisson_m -n 10 -pc_type hypre -pc_hypre_type
>> boomerang
>>
>> If I am right, can you please guide me how to configure with HYPRE and
>> run the above command?
>>
>
> --download-hypre
>
>   Thanks,
>
>  Matt
>
>
>> Thank you.
>> Sincerely,
>> Huq
>>
>> On Thu, Jun 4, 2020 at 8:34 AM Matthew Knepley  wrote:
>>
>>>
>>> On Thu, Jun 4, 2020 at 9:19 AM Dave May  wrote:
>>>
>>>>
>>>>
>>>> On Thu, 4 Jun 2020 at 14:17, Dave May  wrote:
>>>>
>>>>>
>>>>>
>>>>> On Thu, 4 Jun 2020 at 14:15, Matthew Knepley 
>>>>> wrote:
>>>>>
>>>>>> On Thu, Jun 4, 2020 at 9:12 AM Fazlul Huq  wrote:
>>>>>>
>>>>>>> Somehow, make is not working.
>>>>>>> Please find the attachment herewith for the terminal readout.
>>>>>>>
>>>>>>
>>>>>> Since you built with PETSC_ARCH=linux-gnu, you need that in your
>>>>>> environment.
>>>>>>
>>>>>
>>>>> Or just do
>>>>>
>>>>> make ex5 PETSC_ARCH=linux-gnu
>>>>>
>>>>
>>>> sorry I hit send without checking your png)
>>>> The command should be
>>>>
>>>> make ex5 PETSC_ARCH=arch-linux2-c-debug
>>>>
>>>
>>> No, your first one was right.
>>>
>>>Matt
>>>
>>>
>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>   Thanks,
>>>>>>
>>>>>>  Matt
>>>>>>
>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>> Sincerely,
>>>>>>> Huq
>>>>>>>
>>>>>>> On Thu, Jun 4, 2020 at 7:57 AM Matthew Knepley 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On Thu, Jun 4, 2020 at 8:53 AM Fazlul Huq 
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I have a very preliminary question!
>>>>>>>>> I think I have installed PETSc correctly cause I got following on
>>>>>>>>> the terminal:
>>>>>>>>>
>>>>>>>>> Command:
>>>>>>>>> make PETSC_DIR=/home/huq2090/petsc-3.10.2 PETSC_ARCH=linux-gnu
>>>>>>>>> check
>>>>>>>>> Response:
>>>>>>>>> Running check examples to verify correct installation
>>>>>>>>> Using PETSC_DIR=/home/huq2090/petsc-3.10.2 and PETSC_ARCH=linux-gnu
>>>>>>>>> C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI
>>>>>>>>> process
>>>>>>>>> C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI
>>>>>>>>> processes
>>>>>>>>> Fortran example src/snes/tutorials/ex5f run successfully with 1
>>>>>>>>> MPI process
>>>>>>>>> Completed test examples
>>>>>>>>>
>>>>>>>>> Now, I am trying to run an example from the list of provided
>>>>>>>>> examples.
>>>>>>>>> Can you please help me out, how to run an example problem from the
>>>>>>>>> list of examples?
>>>>>>>>> I mean, how to make executable and run the executable?
>>>>>>>>>
>>>>>>>>
>>>>>>>> cd $PETSC_DIR
>>>>>>>> cd src/snes/tutorials
>>>>>>>> make ex5
>>>>>>>> ./ex5 -snes_monitor
>>>>>>>>
>>>>>>>>   Thanks,
>>>>>>>>
>>>>>>>>  Matt
>>>>>>>>
>>&

Re: [petsc-users] Running example problem

2020-06-04 Thread Fazlul Huq
Thank you.
Working now.

I think to run the following command I need to configure PETSc with HYPRE.
mpiexec -np 1 ./poisson_m -n 10 -pc_type hypre -pc_hypre_type boomerang

If I am right, can you please guide me how to configure with HYPRE and run
the above command?

Thank you.
Sincerely,
Huq

On Thu, Jun 4, 2020 at 8:34 AM Matthew Knepley  wrote:

>
> On Thu, Jun 4, 2020 at 9:19 AM Dave May  wrote:
>
>>
>>
>> On Thu, 4 Jun 2020 at 14:17, Dave May  wrote:
>>
>>>
>>>
>>> On Thu, 4 Jun 2020 at 14:15, Matthew Knepley  wrote:
>>>
>>>> On Thu, Jun 4, 2020 at 9:12 AM Fazlul Huq  wrote:
>>>>
>>>>> Somehow, make is not working.
>>>>> Please find the attachment herewith for the terminal readout.
>>>>>
>>>>
>>>> Since you built with PETSC_ARCH=linux-gnu, you need that in your
>>>> environment.
>>>>
>>>
>>> Or just do
>>>
>>> make ex5 PETSC_ARCH=linux-gnu
>>>
>>
>> sorry I hit send without checking your png)
>> The command should be
>>
>> make ex5 PETSC_ARCH=arch-linux2-c-debug
>>
>
> No, your first one was right.
>
>Matt
>
>
>>
>>>
>>>
>>>>
>>>>   Thanks,
>>>>
>>>>  Matt
>>>>
>>>>
>>>>> Thank you.
>>>>>
>>>>> Sincerely,
>>>>> Huq
>>>>>
>>>>> On Thu, Jun 4, 2020 at 7:57 AM Matthew Knepley 
>>>>> wrote:
>>>>>
>>>>>> On Thu, Jun 4, 2020 at 8:53 AM Fazlul Huq  wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I have a very preliminary question!
>>>>>>> I think I have installed PETSc correctly cause I got following on
>>>>>>> the terminal:
>>>>>>>
>>>>>>> Command:
>>>>>>> make PETSC_DIR=/home/huq2090/petsc-3.10.2 PETSC_ARCH=linux-gnu check
>>>>>>> Response:
>>>>>>> Running check examples to verify correct installation
>>>>>>> Using PETSC_DIR=/home/huq2090/petsc-3.10.2 and PETSC_ARCH=linux-gnu
>>>>>>> C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI
>>>>>>> process
>>>>>>> C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI
>>>>>>> processes
>>>>>>> Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI
>>>>>>> process
>>>>>>> Completed test examples
>>>>>>>
>>>>>>> Now, I am trying to run an example from the list of provided
>>>>>>> examples.
>>>>>>> Can you please help me out, how to run an example problem from the
>>>>>>> list of examples?
>>>>>>> I mean, how to make executable and run the executable?
>>>>>>>
>>>>>>
>>>>>> cd $PETSC_DIR
>>>>>> cd src/snes/tutorials
>>>>>> make ex5
>>>>>> ./ex5 -snes_monitor
>>>>>>
>>>>>>   Thanks,
>>>>>>
>>>>>>  Matt
>>>>>>
>>>>>>
>>>>>>> Thank you.
>>>>>>> Sincerely,
>>>>>>> Huq
>>>>>>> --
>>>>>>>
>>>>>>> Fazlul Huq
>>>>>>> Graduate Research Assistant
>>>>>>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>>>>>>> University of Illinois at Urbana-Champaign (UIUC)
>>>>>>> E-mail: huq2...@gmail.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> What most experimenters take for granted before they begin their
>>>>>> experiments is infinitely more interesting than any results to which 
>>>>>> their
>>>>>> experiments lead.
>>>>>> -- Norbert Wiener
>>>>>>
>>>>>> https://www.cse.buffalo.edu/~knepley/
>>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Fazlul Huq
>>>>> Graduate Research Assistant
>>>>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>>>>> University of Illinois at Urbana-Champaign (UIUC)
>>>>> E-mail: huq2...@gmail.com
>>>>>
>>>>
>>>>
>>>> --
>>>> What most experimenters take for granted before they begin their
>>>> experiments is infinitely more interesting than any results to which their
>>>> experiments lead.
>>>> -- Norbert Wiener
>>>>
>>>> https://www.cse.buffalo.edu/~knepley/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


Re: [petsc-users] Running example problem

2020-06-04 Thread Fazlul Huq
Somehow, make is not working.
Please find the attachment herewith for the terminal readout.

Thank you.

Sincerely,
Huq

On Thu, Jun 4, 2020 at 7:57 AM Matthew Knepley  wrote:

> On Thu, Jun 4, 2020 at 8:53 AM Fazlul Huq  wrote:
>
>> Hello,
>>
>> I have a very preliminary question!
>> I think I have installed PETSc correctly cause I got following on the
>> terminal:
>>
>> Command:
>> make PETSC_DIR=/home/huq2090/petsc-3.10.2 PETSC_ARCH=linux-gnu check
>> Response:
>> Running check examples to verify correct installation
>> Using PETSC_DIR=/home/huq2090/petsc-3.10.2 and PETSC_ARCH=linux-gnu
>> C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process
>> C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI
>> processes
>> Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI
>> process
>> Completed test examples
>>
>> Now, I am trying to run an example from the list of provided examples.
>> Can you please help me out, how to run an example problem from the list
>> of examples?
>> I mean, how to make executable and run the executable?
>>
>
> cd $PETSC_DIR
> cd src/snes/tutorials
> make ex5
> ./ex5 -snes_monitor
>
>   Thanks,
>
>  Matt
>
>
>> Thank you.
>> Sincerely,
>> Huq
>> --
>>
>> Fazlul Huq
>> Graduate Research Assistant
>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>> University of Illinois at Urbana-Champaign (UIUC)
>> E-mail: huq2...@gmail.com
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


[petsc-users] Running example problem

2020-06-04 Thread Fazlul Huq
Hello,

I have a very preliminary question!
I think I have installed PETSc correctly cause I got following on the
terminal:

Command:
make PETSC_DIR=/home/huq2090/petsc-3.10.2 PETSC_ARCH=linux-gnu check
Response:
Running check examples to verify correct installation
Using PETSC_DIR=/home/huq2090/petsc-3.10.2 and PETSC_ARCH=linux-gnu
C/C++ example src/snes/tutorials/ex19 run successfully with 1 MPI process
C/C++ example src/snes/tutorials/ex19 run successfully with 2 MPI processes
Fortran example src/snes/tutorials/ex5f run successfully with 1 MPI process
Completed test examples

Now, I am trying to run an example from the list of provided examples.
Can you please help me out, how to run an example problem from the list of
examples?
I mean, how to make executable and run the executable?

Thank you.
Sincerely,
Huq
-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


Re: [petsc-users] Problem with large grid size

2018-11-29 Thread Fazlul Huq via petsc-users
Sorry! I made mistake in running the code.

It's actually working now until matrix size of 999!

But when I try to extend to one order more it give me error message:
**
Out of memory trying to allocate 79992 bytes
[0]PETSC ERROR:

[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see
http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X
to find memory corruption errors
[0]PETSC ERROR: likely location of problem given in stack below
[0]PETSC ERROR: -  Stack Frames

[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
[0]PETSC ERROR:   INSTEAD the line number of the start of the function
[0]PETSC ERROR:   is given.
[0]PETSC ERROR: [0] HYPRE_SetupXXX line 322
/home/huq2090/petsc-3.10.2/src/ksp/pc/impls/hypre/hypre.c
[0]PETSC ERROR: [0] PCSetUp_HYPRE line 138
/home/huq2090/petsc-3.10.2/src/ksp/pc/impls/hypre/hypre.c
[0]PETSC ERROR: [0] PCSetUp line 894
/home/huq2090/petsc-3.10.2/src/ksp/pc/interface/precon.c
[0]PETSC ERROR: [0] KSPSetUp line 304
/home/huq2090/petsc-3.10.2/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: [0] KSPSolve line 678
/home/huq2090/petsc-3.10.2/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: Signal received
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.2, Oct, 09, 2018
[0]PETSC ERROR: ./poisson_m on a arch-linux2-c-debug named
huq2090-XPS-15-9570 by huq2090 Thu Nov 29 20:47:50 2018
[0]PETSC ERROR: Configure options --download-hypre --download-mpich
--with-64-bit-indices
[0]PETSC ERROR: #1 User provided function() line 0 in  unknown file
application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=59
:
system msg for write_line failure : Bad file descriptor
**

I am using dell xps laptop with 32 GB RAM, Intel 8th generation core i7
processor.
Since the RAM is 32 GB, is there any way to allocate even higher order
problem in my machine?

Thanks.
Sincerely,
Huq



On Thu, Nov 29, 2018 at 8:26 PM Fazlul Huq  wrote:

> Thanks.
>
> I have configured with 64-bit and then when I run, I got the following
> error message:
>
> ***
> [0]PETSC ERROR: - Error Message
> --
> [0]PETSC ERROR: Out of memory. This could be due to allocating
> [0]PETSC ERROR: too large an object or bleeding by not properly
> [0]PETSC ERROR: destroying unneeded objects.
> [0]PETSC ERROR: Memory allocated 41632 Memory used by process 13361152
> [0]PETSC ERROR: Try running with -malloc_dump or -malloc_log for info.
> [0]PETSC ERROR: Memory requested 1614907707076
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.10.2, Oct, 09, 2018
> [0]PETSC ERROR: ./poisson_m on a arch-linux2-c-debug named
> huq2090-XPS-15-9570 by huq2090 Thu Nov 29 20:24:13 2018
> [0]PETSC ERROR: Configure options --download-hypre --download-mpich
> --with-64-bit-indices
> [0]PETSC ERROR: #1 VecCreate_Seq() line 35 in
> /home/huq2090/petsc-3.10.2/src/vec/vec/impls/seq/bvec3.c
> [0]PETSC ERROR: #2 PetscTrMallocDefault() line 183 in
> /home/huq2090/petsc-3.10.2/src/sys/memory/mtr.c
> [0]PETSC ERROR: #3 PetscMallocA() line 397 in
> /home/huq2090/petsc-3.10.2/src/sys/memory/mal.c
> [0]PETSC ERROR: #4 VecCreate_Seq() line 35 in
> /home/huq2090/petsc-3.10.2/src/vec/vec/impls/seq/bvec3.c
> [0]PETSC ERROR: #5 VecSetType() line 51 in
> /home/huq2090/petsc-3.10.2/src/vec/vec/interface/vecreg.c
> [0]PETSC ERROR: #6 VecSetTypeFromOptions_Private() line 1250 in
> /home/huq2090/petsc-3.10.2/src/vec/vec/interface/vector.c
> [0]PETSC ERROR: #7 VecSetFromOptions() line 1284 in
> /home/huq2090/petsc-3.10.2/src/vec/vec/interface/vector.c
> [0]PETSC ERROR: #8 main() line 57 in
> /home/huq2090/petsc-3.10.2/problems/ksp/poisson_m.c
> [0]PETSC ERROR: No PETSc Option Table entries
> [0]PETSC ERROR: End of Error Message ---send entire
> error message to petsc-ma..

[petsc-users] Problem with large grid size

2018-11-29 Thread Fazlul Huq via petsc-users
Hello PETSc Developers,

I am trying to run the code (attached herewith) with the following command
and it works until the size of the matrix is 9X9. But when I try to
run with 99X99 then I got weird result.

The command is:
./poisson_m -n 99 -pc_type hypre -pc_hypre_type boomeramg
-ksp_view_solution
Any suggestions is appreciated.

Thanks.
Sincerely,
Huq


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com

static char help[] = "Solves a tridiagonal linear system.\n\n";

/*T
   Concepts: KSP^basic parallel example;
   Processors: n
T*/



/*
  Include "petscksp.h" so that we can use KSP solvers.  Note that this file
  automatically includes:
 petscsys.h   - base PETSc routines   petscvec.h - vectors
 petscmat.h - matrices
 petscis.h - index setspetscksp.h - Krylov subspace methods
 petscviewer.h - viewers   petscpc.h  - preconditioners

  Note:  The corresponding uniprocessor example is ex1.c
*/
#include 
#include 
#include 
#include 
#include 

int main(int argc,char **args)
{
  Vecx, b, u, c;   /* approx solution, RHS, exact solution */
  MatA;/* linear system matrix */
  KSPksp;  /* linear solver context */
  PC pc;   /* preconditioner context */
  // PetscTime  time;
  PetscErrorCode ierr;
  // PetscViewerviewer;
  double start_clock, end_clock;
  PetscInt   i,n,col[3],its,rstart,rend,nlocal;
  ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;
  ierr = PetscOptionsGetInt(NULL,NULL,"-n",&n,NULL);CHKERRQ(ierr);
  PetscScalarone = 1.0,h = (n+1)*(n+1),leftbc = 10,rightbc = 15,value[3];
  PetscReal  norm,h1 = 1/h, tol=1.*PETSC_MACHINE_EPSILON;  /* norm of solution error */

  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Compute the matrix and right-hand-side vector that define
 the linear system, Ax = b.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  /*
 Create vectors.  Note that we form 1 vector from scratch and
 then duplicate as needed. For this simple case let PETSc decide how
 many elements of the vector are stored on each processor. The second
 argument to VecSetSizes() below causes PETSc to decide.
  */

  ierr = VecCreate(PETSC_COMM_WORLD,&x);CHKERRQ(ierr);
  ierr = VecSetSizes(x,PETSC_DECIDE,n);CHKERRQ(ierr);
  ierr = VecSetFromOptions(x);CHKERRQ(ierr);
  ierr = VecDuplicate(x,&b);CHKERRQ(ierr);
  ierr = VecDuplicate(x,&u);CHKERRQ(ierr);
  ierr = VecDuplicate(x,&c);CHKERRQ(ierr);
  // ierr = VecView(x,PETSC_VIEWER_STDOUT_Wierr = VecView(b,PETSC_VIEWERierr = VecView(b,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);_STDOUT_WORLD);CHKERRQ(ierr);ORLD);CHKERRQ(ierr);

  /* Identify the starting and ending mesh points on each
 processor for the interior part of the mesh. We let PETSc decide
 above. */

  ierr = VecGetOwnershipRange(x,&rstart,&rend);CHKERRQ(ierr);
  ierr = VecGetLocalSize(x,&nlocal);CHKERRQ(ierr);

  /*
 Create matrix.  When using MatCreate(), the matrix format can
 be specified at runtime.

 Performance tuning note:  For problems of substantial size,
 preallocation of matrix memory is crucial for attaining good
 performance. See the matrix chapter of the users manual for details.

 We pass in nlocal as the "local" size of the matrix to force it
 to have the same parallel layout as the vector created above.
  */
  printf("Preparing matrix");

  start_clock = clock();
  ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
  ierr = MatSetSizes(A,nlocal,nlocal,n,n);CHKERRQ(ierr);
  ierr = MatSetFromOptions(A);CHKERRQ(ierr);
  ierr = MatSetUp(A);CHKERRQ(ierr);
  end_clock = clock();

  printf("\n...pre-processing completed! (%lf seconds) \n\n", (end_clock-start_clock)/CLOCKS_PER_SEC);


  /*
 Assemble matrix.

 The linear system is distributed across the processors by
 chunks of contiguous rows, which correspond to contiguous
 sections of the mesh on which the problem is discretized.
 For matrix assembly, each processor contributes entries for
 the part that it owns locally.
  */
  
  if (!rstart) {
rstart = 1;
i  = 0; col[0] = 0; col[1] = 1; value[0] = 2.0; value[1] = -1.0;
ierr   = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr);
  }
  if (rend == n) {
rend = n-1;
i= n-1; col[0] = n-2; col[1] = n-1; value[0] = -1.0; value[1] = 2.0;
ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr);
  }

  /* Set entries corresponding to the mesh interior */
  value[0] = -1.0; value[1] = 2.0; value[2] = -1.0;
  for (i=rstart; i -pc_type  -ksp_m

Re: [petsc-users] Problem to configure

2018-11-26 Thread Fazlul Huq via petsc-users
It works!

Thanks.
Sincerely,
Huq

On Tue, Nov 20, 2018 at 6:17 PM Balay, Satish  wrote:

> Try:
>
> rm -rf arch-linux2-c-debug
>
> And rebuild petsc. ie. redo configure and make
>
> Satish
>
> We don't know why this On Tue, 20 Nov 2018, Fazlul Huq via petsc-users
> wrote:
>
> > Thanks.
> > ./configure --download-hypre  --download-mpich works well.
> > But when I run the follwoing:
> > make PETSC_DIR=/home/huq2090/petsc-3.10.2 PETSC_ARCH=arch-linux2-c-debug
> all
> >
> > I got following errors:
> >
> 
> > CLINKER arch-linux2-c-debug/lib/libpetsc.so.3.10.2
> > arch-linux2-c-debug/obj/mat/impls/baij/seq/baij.o: In function
> > `MatCreate_SeqBAIJ':
> > /home/huq2090/petsc-3.10.2/src/mat/impls/baij/seq/baij.c:3049: undefined
> > reference to `MatConvert_AIJ_HYPRE'
> > /usr/bin/ld: arch-linux2-c-debug/obj/mat/impls/baij/seq/baij.o:
> relocation
> > R_X86_64_PC32 against undefined hidden symbol `MatConvert_AIJ_HYPRE' can
> > not be used when making a shared object
> > /usr/bin/ld: final link failed: Bad value
> > collect2: error: ld returned 1 exit status
> > gmakefile:86: recipe for target
> > 'arch-linux2-c-debug/lib/libpetsc.so.3.10.2' failed
> > make[2]: *** [arch-linux2-c-debug/lib/libpetsc.so.3.10.2] Error 1
> > make[2]: Leaving directory '/home/huq2090/petsc-3.10.2'
> > /home/huq2090/petsc-3.10.2/lib/petsc/conf/rules:81: recipe for target
> > 'gnumake' failed
> > make[1]: *** [gnumake] Error 2
> > make[1]: Leaving directory '/home/huq2090/petsc-3.10.2'
> > **ERROR*
> >   Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
> >   Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
> > petsc-ma...@mcs.anl.gov
> > 
> > makefile:30: recipe for target 'all' failed
> > make: *** [all] Error 1
> >
> $
> >
> > Again, the log file is attached herewith.
> >
> > Note: I have moose installed in my laptop but I have commented out from
> > bashrc file
> > #moose
> > #if [ -f /opt/moose/environments/moose_profile ]; then
> >  #   . /opt/moose/environments/moose_profile
> > #fi
> >
> > Thanks.
> > Sincerely,
> > Huq
> >
> > On Tue, Nov 20, 2018 at 4:59 PM Balay, Satish  wrote:
> >
> > > As the message suggests - you don't have MPI installed - so run:
> > >
> > > ./configure --download-hypre  --download-mpich
> > >
> > > Satish
> > >
> > > On Tue, 20 Nov 2018, Fazlul Huq via petsc-users wrote:
> > >
> > > > Hello PETSc Developers,
> > > >
> > > > I am trying to configure PETSc with ./configure --download-hypre
> > > > but I got the following message on terminal:
> > > >
> > > >
> 
> > > >  Configuring PETSc to compile on your system
> > > >
> > > >
> =
> > > > TESTING: check from
> > > > config.libraries(config/BuildSystem/config/libraries.py:158)
> > > >
> > > >
> > >
> ***
> > > >  UNABLE to CONFIGURE with GIVEN OPTIONS(see
> configure.log for
> > > > details):
> > > >
> > >
> ---
> > > > Unable to find mpi in default locations!
> > > > Perhaps you can specify with --with-mpi-dir=
> > > > If you do not want MPI, then give --with-mpi=0
> > > > You might also consider using --download-mpich instead
> > > >
> > >
> ***
> > > >
> > > > The log file is attached herewith.
> > > >
> > > > Thanks.
> > > > Sincerely,
> > > > Huq
> > > >
> > >
> > >
> >
> >
>
>

-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


[petsc-users] Example 23 of ksp problems

2018-11-26 Thread Fazlul Huq via petsc-users
Hello PETSc developers,

I went through the ex23.c of ksp section attached herewith but I don't
understand the following part:
***
tol=1000.*PETSC_MACHINE_EPSILON

and,

ierr = VecAXPY(x,-1.0,u);CHKERRQ(ierr);
 ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
 ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
 if (norm > tol) {
 ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g, Iterations %D\n",
(double)norm,its);CHKERRQ(ierr);
  }

I don't understand what is "tol" here and "*PETSC_MACHINE_EPSILON"?
The if condition is also not clear to me.

Thanks.
Sincerely,
Huq
-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com

static char help[] = "Solves a tridiagonal linear system.\n\n";

/*T
   Concepts: KSP^basic parallel example;
   Processors: n
T*/



/*
  Include "petscksp.h" so that we can use KSP solvers.  Note that this file
  automatically includes:
 petscsys.h   - base PETSc routines   petscvec.h - vectors
 petscmat.h - matrices
 petscis.h - index setspetscksp.h - Krylov subspace methods
 petscviewer.h - viewers   petscpc.h  - preconditioners

  Note:  The corresponding uniprocessor example is ex1.c
*/
#include 

int main(int argc,char **args)
{
  Vecx, b, u;  /* approx solution, RHS, exact solution */
  MatA;/* linear system matrix */
  KSPksp;  /* linear solver context */
  PC pc;   /* preconditioner context */
  PetscReal  norm,tol=1000.*PETSC_MACHINE_EPSILON;  /* norm of solution error */
  PetscErrorCode ierr;
  PetscInt   i,n = 10,col[3],its,rstart,rend,nlocal;
  PetscScalarone = 1.0,value[3];

  ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;
  ierr = PetscOptionsGetInt(NULL,NULL,"-n",&n,NULL);CHKERRQ(ierr);

  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Compute the matrix and right-hand-side vector that define
 the linear system, Ax = b.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  /*
 Create vectors.  Note that we form 1 vector from scratch and
 then duplicate as needed. For this simple case let PETSc decide how
 many elements of the vector are stored on each processor. The second
 argument to VecSetSizes() below causes PETSc to decide.
  */
  ierr = VecCreate(PETSC_COMM_WORLD,&x);CHKERRQ(ierr);
  ierr = VecSetSizes(x,PETSC_DECIDE,n);CHKERRQ(ierr);
  ierr = VecSetFromOptions(x);CHKERRQ(ierr);
  ierr = VecDuplicate(x,&b);CHKERRQ(ierr);
  ierr = VecDuplicate(x,&u);CHKERRQ(ierr);

  /* Identify the starting and ending mesh points on each
 processor for the interior part of the mesh. We let PETSc decide
 above. */

  ierr = VecGetOwnershipRange(x,&rstart,&rend);CHKERRQ(ierr);
  ierr = VecGetLocalSize(x,&nlocal);CHKERRQ(ierr);

  /*
 Create matrix.  When using MatCreate(), the matrix format can
 be specified at runtime.

 Performance tuning note:  For problems of substantial size,
 preallocation of matrix memory is crucial for attaining good
 performance. See the matrix chapter of the users manual for details.

 We pass in nlocal as the "local" size of the matrix to force it
 to have the same parallel layout as the vector created above.
  */
  ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
  ierr = MatSetSizes(A,nlocal,nlocal,n,n);CHKERRQ(ierr);
  ierr = MatSetFromOptions(A);CHKERRQ(ierr);
  ierr = MatSetUp(A);CHKERRQ(ierr);

  /*
 Assemble matrix.

 The linear system is distributed across the processors by
 chunks of contiguous rows, which correspond to contiguous
 sections of the mesh on which the problem is discretized.
 For matrix assembly, each processor contributes entries for
 the part that it owns locally.
  */


  if (!rstart) {
rstart = 1;
i  = 0; col[0] = 0; col[1] = 1; value[0] = 2.0; value[1] = -1.0;
ierr   = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr);
  }
  if (rend == n) {
rend = n-1;
i= n-1; col[0] = n-2; col[1] = n-1; value[0] = -1.0; value[1] = 2.0;
ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr);
  }

  /* Set entries corresponding to the mesh interior */
  value[0] = -1.0; value[1] = 2.0; value[2] = -1.0;
  for (i=rstart; i -pc_type  -ksp_monitor -ksp_rtol 
These options will override those specified above as long as
KSPSetFromOptions() is called _after_ any other customization
routines.
  */
  ierr = 

Re: [petsc-users] Expecting Explanation

2018-11-18 Thread Fazlul Huq via petsc-users
So I have to remove mpiexec from usr/bin
and keep it in home/petsc-3.10.2/lib/petsc/bin
Is it?

Thanks.
Sincerely,
Huq

On Sun, Nov 18, 2018 at 6:49 AM Matthew Knepley  wrote:

> On Sat, Nov 17, 2018 at 10:37 PM Fazlul Huq via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> I tried to reconfigure PETSc and I got the following error message:
>>
>
> Do not reconfigure, just use the mpiexec in $PETSC_DIR/$PETSC_ARCH/bin as
> Barry suggested.
>
>Matt
>
>
>>
>> ..
>> Unable to find mpi in default locations!
>> Perhaps you can specify with --with-mpi-dir=
>> If you do not want MPI, then give --with-mpi=0
>> You might also consider using --download-mpich instead
>>
>> .
>> I also got this error message last time when I have installed first and I
>> have used --download-mpich command.
>>
>> The log file is attached herewith along with terminal screenshot.
>> I am not sure what to do now.
>>
>> Thanks.
>> Sincerely,
>> Huq
>>
>>
>> On Sat, Nov 17, 2018 at 5:26 PM Smith, Barry F. 
>> wrote:
>>
>>>
>>>    Then use
>>>
>>>  ${PETSC_DIR}/${PETSC_ARCH}/bin/mpiexec
>>>
>>>   don't just use the random (wrong) mpiexec that is in your path.
>>>
>>>Barry
>>>
>>>
>>> > On Nov 17, 2018, at 5:22 PM, Fazlul Huq  wrote:
>>> >
>>> > I think when I have installed PETSc, I did --download-mpich.
>>> > How can I correct it? Shall I install PETSc again?
>>> >
>>> > Thanks.
>>> > Sincerely,
>>> > Huq
>>> >
>>> > On Sat, Nov 17, 2018 at 4:53 PM Smith, Barry F. 
>>> wrote:
>>> >
>>> >
>>> > > On Nov 17, 2018, at 3:51 PM, Fazlul Huq via petsc-users <
>>> petsc-users@mcs.anl.gov> wrote:
>>> > >
>>> > > Thanks for the answer.
>>> > >
>>> > > So, when I run the code with "mpiexec -n 2 ./ex6" or "mpiexec -n 4
>>> ./ex6" shouldn't it spit out
>>> > > the error "This is a uniprocessor example only!"?
>>> > > But it didn't do that rather run the code 2/4 times.
>>> >
>>> >This can happen if you use the "wrong" mpiexec; that is a different
>>> mpiexec than the one associated with the mpi you built PETSc with. For
>>> example if some mpiexec is in your path and you used ./configure
>>> --download-mpich
>>> >
>>> >Barry
>>> >
>>> >
>>> > >
>>> > > Thanks.
>>> > > Sincerely,
>>> > > Huq
>>> > >
>>> > > On Sat, Nov 17, 2018 at 1:12 PM Fazlul Huq 
>>> wrote:
>>> > > Hello PETSc developers,
>>> > >
>>> > > In example 6 or vec section I don't understand this line:
>>> > > if (size != 1) SETERRQ(PETSC_COMM_SELF,1,"This is a uniprocessor
>>> example only!");
>>> > >
>>> > > I tried to run the code with "mpiexec -n 2 ./ex6" or "mpiexec -n 4
>>> ./ex6" or even "mpiexec -n 1 ./ex6" it the code runs properly.
>>> > >
>>> > > Thanks.
>>> > >
>>> > > Sincerely,
>>> > > Huq
>>> > >
>>> > > --
>>> > >
>>> > > Fazlul Huq
>>> > > Graduate Research Assistant
>>> > > Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>>> > > University of Illinois at Urbana-Champaign (UIUC)
>>> > > E-mail: huq2...@gmail.com
>>> > >
>>> > >
>>> > > --
>>> > >
>>> > > Fazlul Huq
>>> > > Graduate Research Assistant
>>> > > Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>>> > > University of Illinois at Urbana-Champaign (UIUC)
>>> > > E-mail: huq2...@gmail.com
>>> >
>>> >
>>> >
>>> > --
>>> >
>>> > Fazlul Huq
>>> > Graduate Research Assistant
>>> > Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>>> > University of Illinois at Urbana-Champaign (UIUC)
>>> > E-mail: huq2...@gmail.com
>>>
>>>
>>
>> --
>>
>> Fazlul Huq
>> Graduate Research Assistant
>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>> University of Illinois at Urbana-Champaign (UIUC)
>> E-mail: huq2...@gmail.com
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


Re: [petsc-users] Example 1 of Vector section

2018-09-24 Thread Fazlul Huq
Got it.
Thanks a lot.

Best,
Huq

On Mon, Sep 24, 2018 at 8:26 PM Matthew Knepley  wrote:

> On Mon, Sep 24, 2018 at 9:02 PM Fazlul Huq  wrote:
>
>> Hello All,
>>
>> I am looking through the example problems given in PETSc. In the very
>> first example, ex1 of vector section, I don't understand the following
>> part, especially the term "PETSC_SMALL". What does this mean?
>>
>
> This checks that we get the norm we expect. PETSC_SMALL is a small
> difference we are willing to accept
> due to roundoff error.
>
>Matt
>
>
>> Here, in the second line we already assign zero to v. What is the meaning
>> of "if" condition then?
>>
>> ierr = VecScale(x,two);CHKERRQ(ierr);
>>   ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
>>   v= norm-2.0*PetscSqrtReal((PetscReal)n); if (v > -PETSC_SMALL && v
>> < PETSC_SMALL) v = 0.0;
>>   ierr = PetscPrintf(PETSC_COMM_WORLD,"VecScale
>> %g\n",(double)v);CHKERRQ(ierr);
>>
>>
>> All the best.
>> Sincerely,
>> Huq
>> --
>>
>> Fazlul Huq
>> Graduate Research Assistant
>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>> University of Illinois at Urbana-Champaign (UIUC)
>> E-mail: huq2...@gmail.com
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


[petsc-users] Example 1 of Vector section

2018-09-24 Thread Fazlul Huq
Hello All,

I am looking through the example problems given in PETSc. In the very first
example, ex1 of vector section, I don't understand the following part,
especially the term "PETSC_SMALL". What does this mean?
Here, in the second line we already assign zero to v. What is the meaning
of "if" condition then?

ierr = VecScale(x,two);CHKERRQ(ierr);
  ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
  v= norm-2.0*PetscSqrtReal((PetscReal)n); if (v > -PETSC_SMALL && v <
PETSC_SMALL) v = 0.0;
  ierr = PetscPrintf(PETSC_COMM_WORLD,"VecScale
%g\n",(double)v);CHKERRQ(ierr);


All the best.
Sincerely,
Huq
-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


[petsc-users] Execution time of the code

2018-09-01 Thread Fazlul Huq
Hello PETSc Developers,

I know that to know the execution time of code I have to run code with
-log_view and I also read chapter 13 (Profiling) of the user-manual, but I
can't figure out what is the total execution time of my code from the
information printed on the screen. I got Time (sec) there but there exist
sub-categories like Max, Max/Min, Avg and Total.
My simple question (and may be stupid question!) is, what is the total
execution time of the code here?
(Following is the part of the information printed on the screen)

jimmy@dave:~/projects/petsc/src/ksp/ksp/examples/tutorials$ mpiexec -n 4
./ex10 -f0 medium -f1 arco6 -ksp_gmres_classicalgramschmidt -log_view
-mat_type baij -matload_block_size 3 -pc_type bjacobi -options_left
Number of iterations = 19
Residual norm 1.088292e-05
Number of iterations = 59
Residual norm 3.871022e-02

*** WIDEN YOUR WINDOW TO 120 CHARACTERS.  Use 'enscript -r
-fCourier9' to print this document***


-- PETSc Performance Summary:
--

./ex10 on a arch-linux2-c-debug named dave with 4 processors, by jimmy Sat
Sep  1 13:41:14 2018
Using Petsc Release Version 3.9.2, unknown

 Max   Max/MinAvg  Total
Time (sec):   6.196e-01  1.2   6.196e-01
Objects:  1.060e+02  1.0   1.060e+02
Flop: 2.361e+08  1.00684   2.353e+08  9.413e+08
Flop/sec:3.811e+08  1.00682   3.798e+08  1.519e+09
MPI Messages: 2.360e+02  1.34857   2.061e+02  8.245e+02
MPI Message Lengths:  1.256e+07  2.24620   4.071e+04  3.357e+07
MPI Reductions:   2.160e+02  1.0

Thanks.

Sincerely,
Huq


Re: [petsc-users] Using C routines in PETSc code

2018-08-31 Thread Fazlul Huq
Thanks Barry.
I will try to fix the error.
Sincerely,
Huq

On Fri, Aug 31, 2018 at 12:43 PM Smith, Barry F.  wrote:

>
>
> > On Aug 31, 2018, at 12:12 PM, Fazlul Huq  wrote:
> >
> > Hello PETSc Developers,
> > Can I use c programming routine in PETSc code and make and run it (since
> PETSc is written in c)?
>
>Of course.
>
> > Last day I tried to do that but I got error message while making the
> file.
>
>Must be due to syntax errors in the code. You should read the error
> messages to determine how to fix the code.
>
>Barry
>
> >
> > Thanks.
> > Huq
> >
> >
>
>

-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


[petsc-users] Using C routines in PETSc code

2018-08-31 Thread Fazlul Huq
Hello PETSc Developers,
Can I use c programming routine in PETSc code and make and run it (since
PETSc is written in c)? Last day I tried to do that but I got error message
while making the file.

Thanks.
Huq


Re: [petsc-users] Integration of hyper & trilinos

2018-08-30 Thread Fazlul Huq
Sorry for not getting it!
Thanks!
Have send it to petsc-ma...@mcs.anl.gov
Sincerely,
Huq



On Thu, Aug 30, 2018 at 12:33 PM Smith, Barry F.  wrote:

>
> Please read and follow the directions that PETSc prints out, this will
> reduced unneeded emails back and forth. The instructions were to send the
> files
>
> configure.log and make.log
>
> to petsc-ma...@mcs.anl.gov and we'll see if we can resolve the MPI issue.
>
> Barry
>
>
> > On Aug 30, 2018, at 11:33 AM, Fazlul Huq  wrote:
> >
> > I think error is in this portion, but I don't know how to fix:
> >
> > /home/jimmy/projects/petsc/include/petscsys.h:159:6: error: #error
> "PETSc was configured with one MPICH mpi.h version but now appears to be
> compiling using a different MPICH mpi.h version"
> >  #error "PETSc was configured with one MPICH mpi.h version but now
> appears to be compiling using a different MPICH mpi.h version"
> >   ^
> > gmakefile:150: recipe for target
> 'arch-linux2-c-debug/obj/sys/info/verboseinfo.o' failed
> > make[2]: *** [arch-linux2-c-debug/obj/sys/info/verboseinfo.o] Error 1
> > make[2]: *** Waiting for unfinished jobs
> > Use "/usr/bin/make V=1" to see verbose compile lines, "/usr/bin/make
> V=0" to suppress.
> >   FC arch-linux2-c-debug/obj/sys/fsrc/somefort.o
> >   FC arch-linux2-c-debug/obj/sys/f90-src/fsrc/f90_fwrap.o
> >   FC arch-linux2-c-debug/obj/sys/f90-mod/petscsysmod.o
> > make[2]: Leaving directory '/home/jimmy/projects/petsc'
> > /home/jimmy/projects/petsc/lib/petsc/conf/rules:81: recipe for target
> 'gnumake' failed
> > make[1]: *** [gnumake] Error 2
> > make[1]: Leaving directory '/home/jimmy/projects/petsc'
> > **ERROR*
> >   Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
> >   Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
> petsc-ma...@mcs.anl.gov
> > ****
> > makefile:30: recipe for target 'all' failed
> > make: *** [all] Error 1
> >
> > Thanks.
> > Huq
> >
> > On Thu, Aug 30, 2018 at 11:22 AM Matthew Knepley 
> wrote:
> > On Thu, Aug 30, 2018 at 11:59 AM Fazlul Huq  wrote:
> > I did that and I got the following error:
> >
> > **ERROR*
> >   Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
> >   Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
> petsc-ma...@mcs.anl.gov
> >
> > See the message above. It suggests a course of action.
> >
> >Matt
> >
> > 
> > Thanks,
> > Huq
> >
> > On Thu, Aug 30, 2018 at 10:55 AM Jed Brown  wrote:
> > Fazlul Huq  writes:
> >
> > > I have run:
> > >
> > > jimmy@dave:~/projects/petsc$ ./configure --download-hyper
> > > &
> > > jimmy@dave:~/projects/petsc$ ./configure --download-ml
> >
> > The package name is hypre, not hyper.  And you need to pass both at once
> > if you want both libraries to be available.
> >
> > > At the end I got following message:
> > >
> > >
> xxx=xxx
> > >  Configure stage complete. Now build PETSc libraries with (gnumake
> build):
> > >make PETSC_DIR=/home/jimmy/projects/petsc
> PETSC_ARCH=arch-linux2-c-debug
> > > all
> > >
> xxx=xxx
> > >
> > > Am I ready to use it now or do I need no make it first?
> >
> > As the message says, you need to issue that command to build.
> >
> > > Or do I need to edit .bashrc file with,
> > >
> > > export PETSC_DIR=/home/jimmy/projects/petsc
> > > &
> > > export PETSC_ARCH=arch-linux2-c-debug all
> > >
> > > And then run make from command window?
> > >
> > > Thanks.
> > > Huq
> > >
> > >
> > > On Thu, Aug 30, 2018 at 9:40 AM Jed Brown  wrote:
> > >
> > >> You would configure PETSc with --download-hypre and --download-ml
> (this
> > >> part of Trilinos can be installed on its own).  Then run your
> > >> application with run-time options like -pc_type hypre or -pc_type ml.
> > >> See the user's manua

Re: [petsc-users] Integration of hyper & trilinos

2018-08-30 Thread Fazlul Huq
I think error is in this portion, but I don't know how to fix:

/home/jimmy/projects/petsc/include/petscsys.h:159:6: error: #error "PETSc
was configured with one MPICH mpi.h version but now appears to be compiling
using a different MPICH mpi.h version"
 #error "PETSc was configured with one MPICH mpi.h version but now
appears to be compiling using a different MPICH mpi.h version"
  ^
gmakefile:150: recipe for target
'arch-linux2-c-debug/obj/sys/info/verboseinfo.o' failed
make[2]: *** [arch-linux2-c-debug/obj/sys/info/verboseinfo.o] Error 1
make[2]: *** Waiting for unfinished jobs
Use "/usr/bin/make V=1" to see verbose compile lines, "/usr/bin/make V=0"
to suppress.
  FC arch-linux2-c-debug/obj/sys/fsrc/somefort.o
  FC arch-linux2-c-debug/obj/sys/f90-src/fsrc/f90_fwrap.o
  FC arch-linux2-c-debug/obj/sys/f90-mod/petscsysmod.o
make[2]: Leaving directory '/home/jimmy/projects/petsc'
/home/jimmy/projects/petsc/lib/petsc/conf/rules:81: recipe for target
'gnumake' failed
make[1]: *** [gnumake] Error 2
make[1]: Leaving directory '/home/jimmy/projects/petsc'
**ERROR*
  Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
  Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
petsc-ma...@mcs.anl.gov

makefile:30: recipe for target 'all' failed
make: *** [all] Error 1

Thanks.
Huq

On Thu, Aug 30, 2018 at 11:22 AM Matthew Knepley  wrote:

> On Thu, Aug 30, 2018 at 11:59 AM Fazlul Huq  wrote:
>
>> I did that and I got the following error:
>>
>> **ERROR*
>>   Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
>>   Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
>> petsc-ma...@mcs.anl.gov
>>
>
> See the message above. It suggests a course of action.
>
>Matt
>
>
>> 
>> Thanks,
>> Huq
>>
>> On Thu, Aug 30, 2018 at 10:55 AM Jed Brown  wrote:
>>
>>> Fazlul Huq  writes:
>>>
>>> > I have run:
>>> >
>>> > jimmy@dave:~/projects/petsc$ ./configure --download-hyper
>>> > &
>>> > jimmy@dave:~/projects/petsc$ ./configure --download-ml
>>>
>>> The package name is hypre, not hyper.  And you need to pass both at once
>>> if you want both libraries to be available.
>>>
>>> > At the end I got following message:
>>> >
>>> >
>>> xxx=xxx
>>> >  Configure stage complete. Now build PETSc libraries with (gnumake
>>> build):
>>> >make PETSC_DIR=/home/jimmy/projects/petsc
>>> PETSC_ARCH=arch-linux2-c-debug
>>> > all
>>> >
>>> xxx=xxx
>>> >
>>> > Am I ready to use it now or do I need no make it first?
>>>
>>> As the message says, you need to issue that command to build.
>>>
>>> > Or do I need to edit .bashrc file with,
>>> >
>>> > export PETSC_DIR=/home/jimmy/projects/petsc
>>> > &
>>> > export PETSC_ARCH=arch-linux2-c-debug all
>>> >
>>> > And then run make from command window?
>>> >
>>> > Thanks.
>>> > Huq
>>> >
>>> >
>>> > On Thu, Aug 30, 2018 at 9:40 AM Jed Brown  wrote:
>>> >
>>> >> You would configure PETSc with --download-hypre and --download-ml
>>> (this
>>> >> part of Trilinos can be installed on its own).  Then run your
>>> >> application with run-time options like -pc_type hypre or -pc_type ml.
>>> >> See the user's manual and/or tutorials.
>>> >>
>>> >> Fazlul Huq  writes:
>>> >>
>>> >> > Hello Petsc developers,
>>> >> >
>>> >> > 1. I want to integrate petsc with hyper and trilinos cause I want to
>>> >> solve
>>> >> > some   problems using multigrid. I know, I need to download and
>>> install
>>> >> > both of them and then configure petsc with hyper and trilinos to
>>> use them
>>> >> > with petsc. But, I don't know how to configure petsc with hyper and
>>> >> > trilinos or any other package. Is it like,

Re: [petsc-users] Integration of hyper & trilinos

2018-08-30 Thread Fazlul Huq
I did that and I got the following error:

**ERROR*
  Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
  Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
petsc-ma...@mcs.anl.gov

Thanks,
Huq

On Thu, Aug 30, 2018 at 10:55 AM Jed Brown  wrote:

> Fazlul Huq  writes:
>
> > I have run:
> >
> > jimmy@dave:~/projects/petsc$ ./configure --download-hyper
> > &
> > jimmy@dave:~/projects/petsc$ ./configure --download-ml
>
> The package name is hypre, not hyper.  And you need to pass both at once
> if you want both libraries to be available.
>
> > At the end I got following message:
> >
> >
> xxx=xxx
> >  Configure stage complete. Now build PETSc libraries with (gnumake
> build):
> >make PETSC_DIR=/home/jimmy/projects/petsc
> PETSC_ARCH=arch-linux2-c-debug
> > all
> >
> xxx=xxx
> >
> > Am I ready to use it now or do I need no make it first?
>
> As the message says, you need to issue that command to build.
>
> > Or do I need to edit .bashrc file with,
> >
> > export PETSC_DIR=/home/jimmy/projects/petsc
> > &
> > export PETSC_ARCH=arch-linux2-c-debug all
> >
> > And then run make from command window?
> >
> > Thanks.
> > Huq
> >
> >
> > On Thu, Aug 30, 2018 at 9:40 AM Jed Brown  wrote:
> >
> >> You would configure PETSc with --download-hypre and --download-ml (this
> >> part of Trilinos can be installed on its own).  Then run your
> >> application with run-time options like -pc_type hypre or -pc_type ml.
> >> See the user's manual and/or tutorials.
> >>
> >> Fazlul Huq  writes:
> >>
> >> > Hello Petsc developers,
> >> >
> >> > 1. I want to integrate petsc with hyper and trilinos cause I want to
> >> solve
> >> > some   problems using multigrid. I know, I need to download and
> install
> >> > both of them and then configure petsc with hyper and trilinos to use
> them
> >> > with petsc. But, I don't know how to configure petsc with hyper and
> >> > trilinos or any other package. Is it like, running some command from
> >> > terminal or editing .bashrc file? Currently, this is the .bashrc file
> >> > regarding petsc in my desktop:
> >> >
> >> > export PETSC_DIR=/home/jimmy/projects/petsc
> >> >
> >> > 2. Can I use c programming routine in petsc code and make and run it?
> If
> >> > yes then what is the procedure? Last day I tried to do that but I got
> >> error
> >> > message while making the file.
> >> >
> >> > Thanks.
> >> >
> >> > --
> >> >
> >> > Fazlul Huq
> >> > Graduate Research Assistant
> >> > Department of Nuclear, Plasma & Radiological Engineering (NPRE)
> >> > University of Illinois at Urbana-Champaign (UIUC)
> >> > E-mail: huq2...@gmail.com
> >>
> >
> >
> > --
> >
> > Fazlul Huq
> > Graduate Research Assistant
> > Department of Nuclear, Plasma & Radiological Engineering (NPRE)
> > University of Illinois at Urbana-Champaign (UIUC)
> > E-mail: huq2...@gmail.com
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


Re: [petsc-users] Integration of hyper & trilinos

2018-08-30 Thread Fazlul Huq
I have run:

jimmy@dave:~/projects/petsc$ ./configure --download-hyper
&
jimmy@dave:~/projects/petsc$ ./configure --download-ml

At the end I got following message:

xxx=xxx
 Configure stage complete. Now build PETSc libraries with (gnumake build):
   make PETSC_DIR=/home/jimmy/projects/petsc PETSC_ARCH=arch-linux2-c-debug
all
xxx=xxx

Am I ready to use it now or do I need no make it first?
Or do I need to edit .bashrc file with,

export PETSC_DIR=/home/jimmy/projects/petsc
&
export PETSC_ARCH=arch-linux2-c-debug all

And then run make from command window?

Thanks.
Huq


On Thu, Aug 30, 2018 at 9:40 AM Jed Brown  wrote:

> You would configure PETSc with --download-hypre and --download-ml (this
> part of Trilinos can be installed on its own).  Then run your
> application with run-time options like -pc_type hypre or -pc_type ml.
> See the user's manual and/or tutorials.
>
> Fazlul Huq  writes:
>
> > Hello Petsc developers,
> >
> > 1. I want to integrate petsc with hyper and trilinos cause I want to
> solve
> > some   problems using multigrid. I know, I need to download and install
> > both of them and then configure petsc with hyper and trilinos to use them
> > with petsc. But, I don't know how to configure petsc with hyper and
> > trilinos or any other package. Is it like, running some command from
> > terminal or editing .bashrc file? Currently, this is the .bashrc file
> > regarding petsc in my desktop:
> >
> > export PETSC_DIR=/home/jimmy/projects/petsc
> >
> > 2. Can I use c programming routine in petsc code and make and run it? If
> > yes then what is the procedure? Last day I tried to do that but I got
> error
> > message while making the file.
> >
> > Thanks.
> >
> > --
> >
> > Fazlul Huq
> > Graduate Research Assistant
> > Department of Nuclear, Plasma & Radiological Engineering (NPRE)
> > University of Illinois at Urbana-Champaign (UIUC)
> > E-mail: huq2...@gmail.com
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


[petsc-users] Integration of hyper & trilinos

2018-08-30 Thread Fazlul Huq
Hello Petsc developers,

1. I want to integrate petsc with hyper and trilinos cause I want to solve
some   problems using multigrid. I know, I need to download and install
both of them and then configure petsc with hyper and trilinos to use them
with petsc. But, I don't know how to configure petsc with hyper and
trilinos or any other package. Is it like, running some command from
terminal or editing .bashrc file? Currently, this is the .bashrc file
regarding petsc in my desktop:

export PETSC_DIR=/home/jimmy/projects/petsc

2. Can I use c programming routine in petsc code and make and run it? If
yes then what is the procedure? Last day I tried to do that but I got error
message while making the file.

Thanks.

-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


Re: [petsc-users] Saving output and execution time

2018-07-27 Thread Fazlul Huq
Thanks Karl!


On Fri, Jul 27, 2018 at 2:09 PM, Karl Rupp  wrote:

> Hi Fazlul,
>
> Pass the command line option -log_view to get a detailed breakdown of time
> spent in various code sections. For details, consult the manual.
>
> Best regards,
> Karli
>
> On 07/27/2018 01:47 PM, Fazlul Huq wrote:
>
>> Thanks Matthew.
>>
>> By the way, how can I find the execution time of the processor?
>>
>>
>>
>> On Thu, Jul 19, 2018 at 7:34 PM, Matthew Knepley > <mailto:knep...@gmail.com>> wrote:
>>
>> On Thu, Jul 19, 2018 at 1:44 PM Fazlul Huq > <mailto:huq2...@gmail.com>> wrote:
>>
>> Hello all,
>>
>> I can run the following code with this command showing output on
>> the console: ./poisson_m -ksp_view_solution
>>
>>
>> What is the question? To put that ASCII output in a file, use
>>
>> -ksp_view_solution :sol.txt
>>
>> There is a chapter in the manual on viewing.
>>
>>Thanks,
>>
>>  Matt
>>
>> The code is:
>> static char help[] = "Solves a tridiagonal linear system.\n\n";
>>
>> /*T
>> Concepts: KSP^basic parallel example;
>> Processors: n
>> T*/
>>
>> /*
>>Include "petscksp.h" so that we can use KSP solvers.  Note
>> that this file
>>automatically includes:
>>   petscsys.h   - base PETSc routines   petscvec.h -
>> vectors
>>   petscmat.h - matrices
>>   petscis.h - index setspetscksp.h - Krylov
>> subspace methods
>>   petscviewer.h - viewers   petscpc.h  -
>> preconditioners
>>
>>Note:  The corresponding uniprocessor example is ex1.c
>> */
>> #include 
>>
>> int main(int argc,char **args)
>> {
>>Vecx, b, u;  /* approx solution, RHS,
>> exact solution */
>>MatA;/* linear system matrix */
>>KSPksp;  /* linear solver context */
>>PC pc;   /* preconditioner context */
>>PetscReal  norm,tol=1000.*PETSC_MACHINE_EPSILON;  /* norm
>> of solution error */
>>PetscErrorCode ierr;
>>PetscInt   i,n = 99,col[3],its,rstart,rend,nlocal;
>>PetscScalarone = 1.0,hundredth = 0.001,leftbc =
>> 10.001,rightbc = 15.001,value[3];
>>
>>ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr)
>> return ierr;
>>ierr = PetscOptionsGetInt(NULL,NULL,"
>> -n",&n,NULL);CHKERRQ(ierr);
>>
>>/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - - - - -
>>   Compute the matrix and right-hand-side vector that
>> define
>>   the linear system, Ax = b.
>>   - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - - - - - */
>>
>>/*
>>   Create vectors.  Note that we form 1 vector from scratch and
>>   then duplicate as needed. For this simple case let PETSc
>> decide how
>>   many elements of the vector are stored on each processor.
>> The second
>>   argument to VecSetSizes() below causes PETSc to decide.
>>*/
>>ierr = VecCreate(PETSC_COMM_WORLD,&x);CHKERRQ(ierr);
>>ierr = VecSetSizes(x,PETSC_DECIDE,n);CHKERRQ(ierr);
>>ierr = VecSetFromOptions(x);CHKERRQ(ierr);
>>ierr = VecDuplicate(x,&b);CHKERRQ(ierr);
>>ierr = VecDuplicate(x,&u);CHKERRQ(ierr);
>>
>>/* Identify the starting and ending mesh points on each
>>   processor for the interior part of the mesh. We let PETSc
>> decide
>>   above. */
>>
>>ierr = VecGetOwnershipRange(x,&rstart,&rend);CHKERRQ(ierr);
>>ierr = VecGetLocalSize(x,&nlocal);CHKERRQ(ierr);
>>
>>/*
>>   Create matrix.  When using MatCreate(), the matrix format
>> can
>>   be specified at runtime.
>>
>>   Performance tuning note:  For problems of substantial size,
>>   preallocation o

Re: [petsc-users] Saving output and execution time

2018-07-27 Thread Fazlul Huq
Thanks Matthew.

By the way, how can I find the execution time of the processor?



On Thu, Jul 19, 2018 at 7:34 PM, Matthew Knepley  wrote:

> On Thu, Jul 19, 2018 at 1:44 PM Fazlul Huq  wrote:
>
>> Hello all,
>>
>> I can run the following code with this command showing output on the
>> console: ./poisson_m -ksp_view_solution
>>
>
> What is the question? To put that ASCII output in a file, use
>
> -ksp_view_solution :sol.txt
>
> There is a chapter in the manual on viewing.
>
>   Thanks,
>
> Matt
>
>
>> The code is:
>> static char help[] = "Solves a tridiagonal linear system.\n\n";
>>
>> /*T
>>Concepts: KSP^basic parallel example;
>>Processors: n
>> T*/
>>
>> /*
>>   Include "petscksp.h" so that we can use KSP solvers.  Note that this
>> file
>>   automatically includes:
>>  petscsys.h   - base PETSc routines   petscvec.h - vectors
>>  petscmat.h - matrices
>>  petscis.h - index setspetscksp.h - Krylov subspace
>> methods
>>  petscviewer.h - viewers   petscpc.h  - preconditioners
>>
>>   Note:  The corresponding uniprocessor example is ex1.c
>> */
>> #include 
>>
>> int main(int argc,char **args)
>> {
>>   Vecx, b, u;  /* approx solution, RHS, exact
>> solution */
>>   MatA;/* linear system matrix */
>>   KSPksp;  /* linear solver context */
>>   PC pc;   /* preconditioner context */
>>   PetscReal  norm,tol=1000.*PETSC_MACHINE_EPSILON;  /* norm of
>> solution error */
>>   PetscErrorCode ierr;
>>   PetscInt   i,n = 99,col[3],its,rstart,rend,nlocal;
>>   PetscScalarone = 1.0,hundredth = 0.001,leftbc = 10.001,rightbc =
>> 15.001,value[3];
>>
>>   ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return
>> ierr;
>>   ierr = PetscOptionsGetInt(NULL,NULL,"-n",&n,NULL);CHKERRQ(ierr);
>>
>>   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>  Compute the matrix and right-hand-side vector that define
>>  the linear system, Ax = b.
>>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> */
>>
>>   /*
>>  Create vectors.  Note that we form 1 vector from scratch and
>>  then duplicate as needed. For this simple case let PETSc decide how
>>  many elements of the vector are stored on each processor. The second
>>  argument to VecSetSizes() below causes PETSc to decide.
>>   */
>>   ierr = VecCreate(PETSC_COMM_WORLD,&x);CHKERRQ(ierr);
>>   ierr = VecSetSizes(x,PETSC_DECIDE,n);CHKERRQ(ierr);
>>   ierr = VecSetFromOptions(x);CHKERRQ(ierr);
>>   ierr = VecDuplicate(x,&b);CHKERRQ(ierr);
>>   ierr = VecDuplicate(x,&u);CHKERRQ(ierr);
>>
>>   /* Identify the starting and ending mesh points on each
>>  processor for the interior part of the mesh. We let PETSc decide
>>  above. */
>>
>>   ierr = VecGetOwnershipRange(x,&rstart,&rend);CHKERRQ(ierr);
>>   ierr = VecGetLocalSize(x,&nlocal);CHKERRQ(ierr);
>>
>>   /*
>>  Create matrix.  When using MatCreate(), the matrix format can
>>  be specified at runtime.
>>
>>  Performance tuning note:  For problems of substantial size,
>>  preallocation of matrix memory is crucial for attaining good
>>  performance. See the matrix chapter of the users manual for details.
>>
>>  We pass in nlocal as the "local" size of the matrix to force it
>>  to have the same parallel layout as the vector created above.
>>   */
>>   ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
>>   ierr = MatSetSizes(A,nlocal,nlocal,n,n);CHKERRQ(ierr);
>>   ierr = MatSetFromOptions(A);CHKERRQ(ierr);
>>   ierr = MatSetUp(A);CHKERRQ(ierr);
>>
>>   /*
>>  Assemble matrix.
>>  The linear system is distributed across the processors by
>>  chunks of contiguous rows, which correspond to contiguous
>>  sections of the mesh on which the problem is discretized.
>>  For matrix assembly, each processor contributes entries for
>>  the part that it owns locally.
>>   */
>>
>>
>>   if (!rstart) {
>> rstart = 1;
>> i  = 0; col[0] = 0; col[1] = 1; value[0] = 2.0; value[1] = -1.0;
>> ierr   = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(
>> ierr);
>>   }
>>   if

[petsc-users] Solving problems using multigrid

2018-07-26 Thread Fazlul Huq
Hello All,

I am a new user of petsc and I am wondering, is it possible to solve both
linear and non-linear problems using multigrid in petsc?

Thanking you.

Sincerely,
Huq


[petsc-users] Getting time

2018-07-20 Thread Fazlul Huq
 - - - - - - - - - - - - - - - - - - -
  Check solution and clean up
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  /*
 Check the error
  */
  ierr = VecAXPY(x,-1.0,u);CHKERRQ(ierr);
  ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
  ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
  if (norm > tol) {
ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g, Iterations
%D\n",(double)norm,its);CHKERRQ(ierr);
  }

  // if (!PETSC_TRUE) {
  // ierr = PetscViewer viewer;CHKERRQ(ierr);
  // ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD, "Amat.m",
&viewer);CHKERRQ(ierr);
  // ierr = PetscViewerPushFormat(viewer,
PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr);
  // ierr = MatView(A,viewer);CHKERRQ(ierr);
  // ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr);
  // ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);
  // }
ierr = PetscTime(PetscLogDouble *v);CHKERRQ(ierr);
ierr = PetscLogDouble v;CHKERRQ(ierr);
ierr = PetscTime(&v);CHKERRQ(ierr);
ierr = printf(MPI_Wtime, "Time for operation %g\n",(double)v);

  /*
 Free work space.  All PETSc objects should be destroyed when they
 are no longer needed.
  */
  ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr);
  ierr = VecDestroy(&b);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr);
  ierr = KSPDestroy(&ksp);CHKERRQ(ierr);

  /*
 Always call PetscFinalize() before exiting a program.  This routine
   - finalizes the PETSc libraries as well as MPI
   - provides summary and diagnostic information if certain runtime
 options are chosen (e.g., -log_view).
  */
  ierr = PetscFinalize();
  return ierr;
}

Error Message:
jimmy@dave:~/projects/petsc/problems/ksp$ make poisson_m
/home/jimmy/projects/petsc/arch-linux2-c-debug/bin/mpicc -o poisson_m.o -c
-Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
-fstack-protector -fvisibility=hidden -g3
-I/home/jimmy/projects/petsc/include
-I/home/jimmy/projects/petsc/arch-linux2-c-debug/include
`pwd`/poisson_m.c
/home/jimmy/projects/petsc/problems/ksp/poisson_m.c: In function ‘main’:
/home/jimmy/projects/petsc/problems/ksp/poisson_m.c:200:18: error: expected
expression before ‘PetscLogDouble’
 ierr = PetscTime(PetscLogDouble *v);CHKERRQ(ierr);
  ^~
/home/jimmy/projects/petsc/problems/ksp/poisson_m.c:201:8: error: expected
expression before ‘PetscLogDouble’
 ierr = PetscLogDouble v;CHKERRQ(ierr);
^~
/home/jimmy/projects/petsc/problems/ksp/poisson_m.c:203:15: warning:
passing argument 1 of ‘printf’ from incompatible pointer type
[-Wincompatible-pointer-types]
 ierr = printf(MPI_Wtime, "Time for operation %g\n",(double)v);
   ^
In file included from /home/jimmy/projects/petsc/include/petscsys.h:175:0,
 from /home/jimmy/projects/petsc/include/petscis.h:7,
 from /home/jimmy/projects/petsc/include/petscvec.h:9,
 from /home/jimmy/projects/petsc/include/petscmat.h:6,
 from /home/jimmy/projects/petsc/include/petscpc.h:6,
 from /home/jimmy/projects/petsc/include/petscksp.h:6,
 from
/home/jimmy/projects/petsc/problems/ksp/poisson_m.c:21:
/usr/include/stdio.h:362:12: note: expected ‘const char * restrict’ but
argument is of type ‘double (*)(void)’
 extern int printf (const char *__restrict __format, ...);
^~
/home/jimmy/projects/petsc/lib/petsc/conf/rules:359: recipe for target
'poisson_m.o' failed
make: *** [poisson_m.o] Error 1

Thanks in advance.

Sincerely,
Huq

-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com


[petsc-users] Saving output and execution time

2018-07-19 Thread Fazlul Huq
&norm);CHKERRQ(ierr);
  ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
  if (norm > tol) {
ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g, Iterations
%D\n",(double)norm,its);CHKERRQ(ierr);
  }

  /*
 Free work space.  All PETSc objects should be destroyed when they
 are no longer needed.
  */
  ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr);
  ierr = VecDestroy(&b);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr);
  ierr = KSPDestroy(&ksp);CHKERRQ(ierr);

  /*
 Always call PetscFinalize() before exiting a program.  This routine
   - finalizes the PETSc libraries as well as MPI
   - provides summary and diagnostic information if certain runtime
 options are chosen (e.g., -log_view).
  */
  ierr = PetscFinalize();
  return ierr;
}


Now I am trying to save this output in a file (say in a .csv file) at
runtime along with execution time but I can't.

Any suggestion please!

Sincerely,
Huq

-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com