[MITgcm-support] identifying connected regions

Samar Khatiwala samar.khatiwala at earth.ox.ac.uk
Wed Feb 9 16:49:02 EST 2022


Hi Dan,

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 
(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 
efficient implementations available <https://gmd.copernicus.org/articles/9/4451/2016/>). But if you really need to do this on-the-fly in MITgcm, rather than offline, I know that parallel implementations do 
exist (e.g., this <https://www.sciencedirect.com/science/article/pii/S0021999118306557> and this <https://deepai.org/publication/scan-flood-fill-scaff-an-efficient-automatic-precise-region-filling-algorithm-for-complicated-regions>). 

Best,

Samar

> On Feb 9, 2022, at 3:16 PM, Daniel Goldberg <dan.goldberg at ed.ac.uk> wrote:
> 
> 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 i know of <https://people.sc.fsu.edu/~jburkardt/f77_src/image_components/components.f> into one that would work with EXCH, so i will proceed with gathering first and broadcasting, which might be very slow -- i will see!
> 
> 
> On Wed, Feb 9, 2022 at 3:03 PM Jean-Michel Campin <jmc at mit.edu <mailto:jmc at mit.edu>> wrote:
> This email was sent to you by someone outside the University.
> You should only click on links or attachments if you are certain that the email is genuine and the content is safe.
> 
> Hi Dan,
> 
> I think you could collect the full (global) 2-D field on 1 proc and work with
> this. But you should be able also to design the algorithm that works on each tile
> and then, with a couple of EXCH calls, finish the work at the global level.
> But this second solution probably requires more careful coding.
> 
> On the side (I don't think it's that relevant here), in term of global
> communication, I added (~ 10.y ago) a function to do a cummulative sum (cumulsum_z_tile.F).
> in case there is some similarity with your problem.
> 
> Cheers,
> Jean-Michel
> 
> On Wed, Feb 09, 2022 at 09:11:11AM +0000, Daniel Goldberg wrote:
> > thanks very much martin. this should be possible to use directly.
> >
> > best
> > dan
> >
> > On Wed, Feb 9, 2022 at 8:01 AM Martin Losch <Martin.Losch at awi.de <mailto:Martin.Losch at awi.de>> wrote:
> > >
> > > Hi Dan,
> > >
> > > I am not aware of any implementation of that within the MITgcm.
> > >
> > > There are gather and scatter routines in eesupp/src, e.g. gather_2d_r8.F
> > >
> > > Martin
> > >
> > > > On 7. Feb 2022, at 14:25, Daniel Goldberg <dan.goldberg at ed.ac.uk <mailto:dan.goldberg at ed.ac.uk>> wrote:
> > > >
> > > > Hello -
> > > >
> > > > I am curious if any part of model/src or a package implements an
> > > > algorithm to identify connected regions of a 2D (or 3D) array?
> > > >
> > > > If not, i feel this might be best solved in serial, and am wondering
> > > > if there are utilities to gather processor tiles to a single 2D array
> > > > (and broadcast such an array to tiles) that should be used or are
> > > > ideal to use. I am aware that something like this must be done with
> > > > useSingleCpuIO but am not sure if this is the best template to follow.
> > > >
> > > > Many thanks
> > > > Dan
> > > >
> > > > --
> > > > Daniel Goldberg, PhD (he/him)
> > > > Reader in Glaciology
> > > > School of Geosciences, University of Edinburgh
> > > > Geography Building, Drummond Street, Edinburgh EH8 9XP
> > > >
> > > >
> > > > em: dan.goldberg at ed.ac.uk <mailto:dan.goldberg at ed.ac.uk>
> > > > web: https://www.geos.ed.ac.uk/homes/dgoldber <https://www.geos.ed.ac.uk/homes/dgoldber>
> > > > 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.
> > > > _______________________________________________
> > > > MITgcm-support mailing list
> > > > MITgcm-support at mitgcm.org <mailto:MITgcm-support at mitgcm.org>
> > > > http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support <http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support>
> > >
> > > _______________________________________________
> > > MITgcm-support mailing list
> > > MITgcm-support at mitgcm.org <mailto:MITgcm-support at mitgcm.org>
> > > http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support <http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support>
> > _______________________________________________
> > MITgcm-support mailing list
> > MITgcm-support at mitgcm.org <mailto:MITgcm-support at mitgcm.org>
> > http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support <http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org <mailto:MITgcm-support at mitgcm.org>
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support <http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20220209/08905857/attachment.html>


More information about the MITgcm-support mailing list