We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have an upstream array which contains thousands of codewords to be decoded.
So I write a feeder like this:
class Feeder(Py_Module): def __init__(self, N: int, batch_size: int, dtype): Py_Module.__init__(self) self.name = "py_Feeder" self.N = N self.batch_size = batch_size self.cnt = 0 step = self.create_task("step") inpt = self.create_socket_in(step, "input", batch_size * N, dtype) out = self.create_socket_out(step, "output", N, dtype) self.create_codelet(step, lambda slf, lsk, fid: slf.step(lsk[inpt], lsk[out])) def step(self, x: ndarray, y: ndarray): if self.cnt >= self.batch_size: print("Feeder overflow") self.toggle_done() return 0 y[:] = x[:, self.cnt * self.N: (self.cnt + 1) * self.N] self.cnt += 1 if self.cnt >= self.batch_size: self.toggle_done() return 0
It works well when sequence is run with 1 thread, but when it comes to multithreading, the code just keeps running into overflow.
Mutex lock seems not to be supported either.
Is there a proper way to implement it?
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
I have an upstream array which contains thousands of codewords to be decoded.
So I write a feeder like this:
It works well when sequence is run with 1 thread, but when it comes to multithreading, the code just keeps
running into overflow.
Mutex lock seems not to be supported either.
Is there a proper way to implement it?
The text was updated successfully, but these errors were encountered: