[petsc-users] Different solution while running in parallel
Matthew Knepley
knepley at gmail.com
Thu Nov 17 06:19:19 CST 2022
On Wed, Nov 16, 2022 at 9:07 PM Zhang, Hong via petsc-users <
petsc-users at mcs.anl.gov> wrote:
> Karhik,
> Can you find out the condition number of your matrix?
>
Also, run using
-ksp_view -ksp_monitor_true_residual -ksp_converged_reason
and send the two outputs.
Thanks,
Matt
> Hong
>
> ------------------------------
> *From:* petsc-users <petsc-users-bounces at mcs.anl.gov> on behalf of
> Karthikeyan Chockalingam - STFC UKRI via petsc-users <
> petsc-users at mcs.anl.gov>
> *Sent:* Wednesday, November 16, 2022 6:04 PM
> *To:* petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> *Subject:* [petsc-users] Different solution while running in parallel
>
>
> Hello,
>
>
>
> I tried to solve a (FE discretized) Poisson equation using PCLU. For
> some reason I am getting different solutions while running the problem on
> one and two cores. I have attached the output file (out.txt) from both the
> runs. I am printing A, b and x from both the runs – while A and b are the
> same but the solution seems is different.
>
>
>
> I am not sure what I doing wrong.
>
>
>
> Below is my matrix, vector, and solve setup.
>
>
>
>
>
> Mat A;
>
> Vec b, x;
>
>
>
> ierr = MatCreate(PETSC_COMM_WORLD, &A); CHKERRQ(ierr);
>
> ierr = MatSetType(A, MATMPIAIJ); CHKERRQ(ierr);
>
> ierr = MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, N, N); CHKERRQ
> (ierr);
>
> ierr = MatMPIAIJSetPreallocation(A,d_nz, *NULL*, o_nz, *NULL*);
> CHKERRQ(ierr);
>
> ierr = MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE); CHKERRQ(ierr);
>
> ierr = MatCreateVecs(A, &b, &x); CHKERRQ(ierr);
>
>
>
> KSP ksp;
>
> PC pc;
>
> KSPCreate(PETSC_COMM_WORLD, &ksp);
>
> KSPSetOperators(ksp, A, A);
>
> ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr);
>
> ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
>
> ierr = PCSetType(pc,PCLU);CHKERRQ(ierr);
>
> ierr = PCFactorSetMatSolverType(pc,MATSOLVERMUMPS);CHKERRQ(ierr);
>
> KSPSolve(ksp, b, x);
>
>
>
> Thank you for your help.
>
>
>
> Karhik.
>
>
>
> This email and any attachments are intended solely for the use of the
> named recipients. If you are not the intended recipient you must not use,
> disclose, copy or distribute this email or any of its attachments and
> should notify the sender immediately and delete this email from your
> system. UK Research and Innovation (UKRI) has taken every reasonable
> precaution to minimise risk of this email or any attachments containing
> viruses or malware but the recipient should carry out its own virus and
> malware checks before opening the attachments. UKRI does not accept any
> liability for any losses or damages which the recipient may sustain due to
> presence of any viruses.
>
--
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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221117/6e91a9c5/attachment-0001.html>
More information about the petsc-users
mailing list