[petsc-users] Trouble with ISEmbed

Pierre Jolivet pierre at joliv.et
Wed Oct 19 10:01:43 CDT 2022



> On 19 Oct 2022, at 4:32 PM, TARDIEU Nicolas <nicolas.tardieu at edf.fr> wrote:
> 
> Dear Pierre,
> 
> Thank you very much for your answer. I have the same explanation as you for the code I sent. 
> But what I would like to do is the following : I have the full matrix A with fields u, p and t (which are interlaced in the real application). I want to extract B=A(u+p, u+p). *Then* I would like to extract the (u, u) block from B - let us call it B_uu.
> In fact, B_uu=A_uu but I really need to do the extraction from B.
> And I am missing something since I have to play with different numberings when switching the IS from A to B.
> 
> Is it clear enough ???? 

That’s cristal clear.
If the fields are interlaced, that’s actually easier to do, because you preserve the distribution, and there is less data movement.
I’ll try to fix your code in the case where the fields are interlaced if now one gives you another answer in the meantime.

Thanks,
Pierre

> Regards, 
> Nicolas
> --
> Nicolas Tardieu
> Ing PhD Computational Mechanics
> EDF - R&D Dpt ERMES
> PARIS-SACLAY, FRANCE
> De : pierre at joliv.et <pierre at joliv.et>
> Envoyé : mercredi 19 octobre 2022 14:51
> À : TARDIEU Nicolas <nicolas.tardieu at edf.fr>
> Cc : petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> Objet : Re: [petsc-users] Trouble with ISEmbed
>  
> On two processes, you have a different distribution for u and u+p.
> IS Object: 2 MPI processes
>   type: general
> [0] Number of indices in set 5
> [0] 0 0
> [0] 1 1
> [0] 2 2
> [0] 3 3
> [0] 4 4
> [1] Number of indices in set 5
> [1] 0 5
> [1] 1 6
> [1] 2 7
> [1] 3 8
> [1] 4 9
> IS Object: 2 MPI processes
>   type: general
> [0] Number of indices in set 8
> [0] 0 0
> [0] 1 1
> [0] 2 2
> [0] 3 3
> [0] 4 4
> [0] 5 5
> [0] 6 6
> [0] 7 7
> [1] Number of indices in set 7
> [1] 0 8
> [1] 1 9
> [1] 2 10
> [1] 3 11
> [1] 4 12
> [1] 5 13
> [1] 6 14
> ISEmbed() only works on local indices, so when you embed u into u+p, on the second process, you miss the row/column indices 5, 6, 7 of B = A(u+p, u+p).
> Thus, you end up with a matrix of dimension size(u) - 3 = 10 - 3 = 7, with just the row/column indices 8 and 9 being selected by the second process.
> What is it that you want to do exactly? Play with ISEmbed(), or get A(u, u) without using A but B instead?
> 
> Thanks,
> Pierre
> 
> > On 19 Oct 2022, at 12:00 PM, TARDIEU Nicolas via petsc-users <petsc-users at mcs.anl.gov> wrote:
> > 
> > Dear PETSc Team,
> > 
> > I am trying to use IS embeding in parallel. 
> > In order to (try to) understand how it works, I have built a simple example, attached to this email.
> > 
> > I consider a 20X20 matrix. The dof (u, p, t) in global numbering are the following : 
> > u: 0..9     p: 10..14     t: 15..19
> > 
> > I have defined 4 IS to describe the dof  u, p, t and the agglomeration of u and p, called up.
> > I first extract the submatrix matrix(up,up), then  I would like to extract from it the (u,u) block.
> > 
> > The example runs OK in sequential but I do not obtain the (u,u) block on 2 processes.
> > 
> > I have a mistake in the build of the sub-IS but I cannot find it for days.
> > 
> > Best regards,
> > Nicolas
> > --
> > Nicolas Tardieu
> > Ing PhD Computational Mechanics
> > EDF - R&D Dpt ERMES
> > PARIS-SACLAY, FRANCE
> > 
> > Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.
> > Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.
> > Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.
> > ____________________________________________________
> > This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.
> > If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.
> > E-mail communication cannot be guaranteed to be timely secure, error or virus-free.
> > <is_pb.tgz>
> 
> 
> Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.
> Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.
> Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.
> ____________________________________________________
> This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.
> If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.
> E-mail communication cannot be guaranteed to be timely secure, error or virus-free.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221019/a4e34ee3/attachment.html>


More information about the petsc-users mailing list