Git Product home page Git Product logo

Comments (6)

mmann1123 avatar mmann1123 commented on September 21, 2024 1

Ok great. Can we close this?

from geowombat.

mmann1123 avatar mmann1123 commented on September 21, 2024

A a simple solution we could add a chunk id in the generator as follows:

class ParallelTask

def map(self, func, *args):
    ....
    for cidx, wchunk in enumerate(range(0, self.n_windows, self.n_chunks)):

                data_gen = ((self.data[slice_], cidx, widx, *args) for widx, slice_ in enumerate(window_slice))

although I am admittedly a bit confused about chunk vs window, especially as this relates to pt.n_chunks pt.n_windows

from geowombat.

mmann1123 avatar mmann1123 commented on September 21, 2024

Found a better option (see PR), the following will ensure that the window_id increments from 0 the n_windows without repeat.

class ParallelTask

def map(self, func, *args):
    ....
    for cidx, wchunk in enumerate(range(0, self.n_windows, self.n_chunks)):

                data_gen = ((self.data[slice_], cidx*self.n_chunks + widx, *args) for widx, slice_ in enumerate(window_slice))

from geowombat.

jgrss avatar jgrss commented on September 21, 2024

Nice catch. I should have used batches instead of chunks. You can think of them as mini batches of windows passed to the parallel executor. I added it a while back to limit memory overhead.

I think we just need the following, right?

for wchunk in range(0, self.n_windows, self.n_chunks):

    data_gen = ((self.data[slice_], widx+wchunk, *args) for widx, slice_ in enumerate(window_slice))

from geowombat.

mmann1123 avatar mmann1123 commented on September 21, 2024

from geowombat.

jgrss avatar jgrss commented on September 21, 2024

@mmann1123 The window id was also incorrect in to_raster. Both cidx*self.n_chunks + widx and widx+wchunk produced the same result. The fix was pushed in 911145ecc92bad22f06d0326cadf99d46ec893f2.

from geowombat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.