<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Thanks Samar! The two problems do seem as though they might be similar (they are both image processing problems..) I will have a look at the references you sent and have a think if this could be done some other way than serially.<div><br></div><div>Thanks</div><div>Dan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 9, 2022 at 9:49 PM Samar Khatiwala <<a href="mailto:samar.khatiwala@earth.ox.ac.uk">samar.khatiwala@earth.ox.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;">Hi Dan,<div><br></div><div>I don’t know if it is relevant to your problem but have you looked into the flood-fill algorithm? I haven’t used a parallel version as canned serial ones </div><div>(e.g., imfill in Matlab and flood_fill in python) were more than sufficient for the fairly large satellite images I was analyzing (and there are even more </div><div>efficient implementations <a href="https://gmd.copernicus.org/articles/9/4451/2016/" target="_blank">available</a>). But if you really need to do this on-the-fly in MITgcm, rather than offline, I know that parallel implementations do </div><div>exist (e.g., <a href="https://www.sciencedirect.com/science/article/pii/S0021999118306557" target="_blank">this</a> and <a href="https://deepai.org/publication/scan-flood-fill-scaff-an-efficient-automatic-precise-region-filling-algorithm-for-complicated-regions" target="_blank">this</a>). </div><div><br></div><div>Best,</div><div><br></div><div>Samar</div><div><div><br><blockquote type="cite"><div>On Feb 9, 2022, at 3:16 PM, Daniel Goldberg <<a href="mailto:dan.goldberg@ed.ac.uk" target="_blank">dan.goldberg@ed.ac.uk</a>> wrote:</div><br><div><div dir="ltr">thanks JM! i have talked to others who have tackled this issue as you describe.. but I do struggle to think through how to transform the simplest algorithm <a href="https://people.sc.fsu.edu/~jburkardt/f77_src/image_components/components.f" target="_blank">i know of</a> into one that would work with EXCH, so i will proceed with gathering first and broadcasting, which might be very slow -- i will see!</div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 9, 2022 at 3:03 PM Jean-Michel Campin <<a href="mailto:jmc@mit.edu" target="_blank">jmc@mit.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This email was sent to you by someone outside the University.<br>
You should only click on links or attachments if you are certain that the email is genuine and the content is safe.<br>
<br>
Hi Dan,<br>
<br>
I think you could collect the full (global) 2-D field on 1 proc and work with<br>
this. But you should be able also to design the algorithm that works on each tile<br>
and then, with a couple of EXCH calls, finish the work at the global level.<br>
But this second solution probably requires more careful coding.<br>
<br>
On the side (I don't think it's that relevant here), in term of global<br>
communication, I added (~ 10.y ago) a function to do a cummulative sum (cumulsum_z_tile.F).<br>
in case there is some similarity with your problem.<br>
<br>
Cheers,<br>
Jean-Michel<br>
<br>
On Wed, Feb 09, 2022 at 09:11:11AM +0000, Daniel Goldberg wrote:<br>
> thanks very much martin. this should be possible to use directly.<br>
><br>
> best<br>
> dan<br>
><br>
> On Wed, Feb 9, 2022 at 8:01 AM Martin Losch <<a href="mailto:Martin.Losch@awi.de" target="_blank">Martin.Losch@awi.de</a>> wrote:<br>
> ><br>
> > Hi Dan,<br>
> ><br>
> > I am not aware of any implementation of that within the MITgcm.<br>
> ><br>
> > There are gather and scatter routines in eesupp/src, e.g. gather_2d_r8.F<br>
> ><br>
> > Martin<br>
> ><br>
> > > On 7. Feb 2022, at 14:25, Daniel Goldberg <<a href="mailto:dan.goldberg@ed.ac.uk" target="_blank">dan.goldberg@ed.ac.uk</a>> wrote:<br>
> > ><br>
> > > Hello -<br>
> > ><br>
> > > I am curious if any part of model/src or a package implements an<br>
> > > algorithm to identify connected regions of a 2D (or 3D) array?<br>
> > ><br>
> > > If not, i feel this might be best solved in serial, and am wondering<br>
> > > if there are utilities to gather processor tiles to a single 2D array<br>
> > > (and broadcast such an array to tiles) that should be used or are<br>
> > > ideal to use. I am aware that something like this must be done with<br>
> > > useSingleCpuIO but am not sure if this is the best template to follow.<br>
> > ><br>
> > > Many thanks<br>
> > > Dan<br>
> > ><br>
> > > --<br>
> > > Daniel Goldberg, PhD (he/him)<br>
> > > Reader in Glaciology<br>
> > > School of Geosciences, University of Edinburgh<br>
> > > Geography Building, Drummond Street, Edinburgh EH8 9XP<br>
> > ><br>
> > ><br>
> > > em: <a href="mailto:dan.goldberg@ed.ac.uk" target="_blank">dan.goldberg@ed.ac.uk</a><br>
> > > web: <a href="https://www.geos.ed.ac.uk/homes/dgoldber" rel="noreferrer" target="_blank">https://www.geos.ed.ac.uk/homes/dgoldber</a><br>
> > > The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th??? ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.<br>
> > > _______________________________________________<br>
> > > MITgcm-support mailing list<br>
> > > <a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
> > > <a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br>
> ><br>
> > _______________________________________________<br>
> > MITgcm-support mailing list<br>
> > <a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
> > <a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br>
> _______________________________________________<br>
> MITgcm-support mailing list<br>
> <a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
> <a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br>
_______________________________________________<br>
MITgcm-support mailing list<br>
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br>
</blockquote></div>
_______________________________________________<br>MITgcm-support mailing list<br><a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br><a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br></div></blockquote></div><br></div></div>_______________________________________________<br>
MITgcm-support mailing list<br>
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br>
</blockquote></div>