[petsc-users] How to confirm the performance of asynchronous computations
Viet H.Q.H.
hqhviet at tohoku.ac.jp
Thu Jan 21 06:52:51 CST 2021
Hello Petsc developers and supporters,
I would like to confirm the performance of asynchronous computations of
inner product computation overlapping with matrix-vector multiplication
computation by the below code.
PetscLogDouble tt1,tt2;
KSP ksp;
//ierr = VecSet(c,one);
ierr = VecSet(c,one);
ierr = VecSet(u,one);
ierr = VecSet(b,one);
ierr = KSPCreate(PETSC_COMM_WORLD,&ksp); CHKERRQ(ierr);
ierr = KSP_MatMult(ksp,A,x,Ax); CHKERRQ(ierr);
ierr = PetscTime(&tt1);CHKERRQ(ierr);
ierr = VecNormBegin(u,NORM_2,&norm1);
ierr = PetscCommSplitReductionBegin(PetscObjectComm((PetscObject)Ax));
ierr = KSP_MatMult(ksp,A,c,Ac);
ierr = VecNormEnd(u,NORM_2,&norm1);
ierr = PetscTime(&tt2);CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_WORLD, "The time used for the
asynchronous calculation: %f\n",tt2-tt1); CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_WORLD,"+ |u| = %g\n",(double) norm1);
CHKERRQ(ierr);
ierr = PetscTime(&tt1);CHKERRQ(ierr);
ierr = VecNorm(b,NORM_2,&norm2); CHKERRQ(ierr);
ierr = KSP_MatMult(ksp,A,c,Ac);
ierr = PetscTime(&tt2);CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_WORLD, "The time used for the synchronous
calculation: %f\n",tt2-tt1); CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_WORLD,"+ |b| = %g\n",(double) norm2);
CHKERRQ(ierr);
On a cluster with two or four nodes, the asynchronous computation is always
much slower than synchronous computation.
The time used for the asynchronous calculation: 0.000203
+ |u| = 100.
The time used for the synchronous calculation: 0.000006
+ |b| = 100.
Are there any necessary settings on MPI or Petsc to gain performance of
asynchronous computation?
Thank you very much for anything you can provide.
Sincerely,
Viet.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210121/119180fb/attachment.html>
More information about the petsc-users
mailing list