TerraME / terrame

TerraME is a programming environment for spatial dynamical modelling
www.terrame.org
GNU Lesser General Public License v3.0
35 stars 13 forks source link

Adding multitask feature #2353

Closed avancinirodrigo closed 3 years ago

avancinirodrigo commented 3 years ago
avancinirodrigo commented 3 years ago

@pedro-andrade-inpe @tiagogsc HPA is ready for use. There are some limitations and problems that must be fixed for use internally in TerraME (#2362 #2357 #2358 #2359), but nothing prevents it from being used by end-users as you can see in execution tests.

pedro-andrade-inpe commented 3 years ago

@avancinirodrigo, thanks. May I merge?

avancinirodrigo commented 3 years ago

@avancinirodrigo, thanks. May I merge?

Yes.

tiagogsc commented 3 years ago

Maybe you should try to call the function received as an argument by ForEcahCell in parallel, not the opposite: I do not remember the exact API of HPA, so consider the code below as a pseudocode.

parallel_forEachCell(csA, f) for cell in pairs(csA) do hpa:parallel( "f", cel ) end hpa:synchronize("f") end

Something more... I am not sure that HPA cannot receive Celluspces or tables as parameters of parallel functions. It can just be a bug in the new version. However, passing big tables to parallel functions could be a mistake due to the necessary copy of parameters to the thread´s lua stack. HPA was designed to see CellularSpaces as shared variables where several functions/agents/automatons make simultaneous changes (SIMD or MIMD parallelism models). We avoid copying large cellular spaces for preventing memory/stack overflow. We believe that the majority of models that requires high performance computing are very prone to deal with large geographical regions or use high resolution spatial data.

-- Prof. Dr. Tiago Garcia de Senna Carneiro TerraLAB - Earth System Modelling and Simulation Laboratory Computer Science Department, UFOP - Federal University of Ouro Preto

Campus Universitário Morro do Cruzeiro, Ouro Preto - MG, Brazil, 35400-000 +55 31 3559 1692 +55 31 3559 1253 www.decom.ufop.br/terralab www.decom.ufop.br

Em seg., 21 de set. de 2020 às 13:40, Pedro R. Andrade < notifications@github.com> escreveu:

@pedro-andrade-inpe commented on this pull request.

In test/scripts/hpa-matrix-mult.lua https://github.com/TerraME/terrame/pull/2353#discussion_r492200081:

  • local csA = CellularSpace {
  • xdim = dim
  • }
  • local csB = CellularSpace {
  • xdim = dim
  • }
  • function fillCsA()
  • forEachCell(csA, function(cell)
  • cell.value = dim
  • end)
  • end
  • function fillCsB()
  • forEachCell(csB, function(cell)

Why not?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TerraME/terrame/pull/2353#discussion_r492200081, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR547BEARQN55YYXK2TBU3SG56YJANCNFSM4P3C6GRA .