-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
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
AssertionError: Run with more than 1 PE to use charm.pool #184
Comments
Can you paste the command you used to produce this output? |
I just ran this snippet in pycharm. |
Aah, I see. When starting Charm4Py scripts, you actually want to run the The In the example when As for running this in PyCharm, you might be able to set up the run configuration such that it will allow you to run Charm4Py programs directly from within the IDE: https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html |
|
@ZwFink So I tried the way you mentioned above in my own program and getting this error:- |
Regarding the timeout error, this issue happens because |
I should mention that this is a gap in the Charm4Py documentation and will make sure it gets added. |
@ZwFink Thanks for your reply and clarification. To explain further on my doubt earlier, what I meant is:- I have a main script say E.g. main.py
How to use charm4py in this case? |
Is this an existing codebase where it's not possible/feasible to make Otherwise, in the above example can |
"The fork/join model you propose above is trivial to express in Charm4Py." Can you please share an example? |
Sure! I transformed your example above into a Charm4Py program: from charm4py import charm, Chare, Future, Array, Reducer
import time
class ChildProcess(Chare):
def __init__(self, arg, doneFuture):
self.arg = arg
self.doneFuture = doneFuture
@coro
def start(self):
# our "work" here is just to perform a reduction and send it to the
# future, but anything can be done
self.reduce(self.doneFuture, self.thisIndex[0], Reducer.sum)
# if the main process doesn't need the result, we may simply do:
# self.reduce(self.doneFuture)
def main(args):
childProcessFuture = Future()
childProcessArg = 1
# child_process = Process(target=(...), args=(...))
# Here we specify that 20 chares will be created to perform the work.
childProc = Array(ChildProcess, 20, args=[childProcessArg, childProcessFuture])
# alternatively, the constructor of ChildProcess can call doWork which saves some message passing
# this represents the child process creation that does the work
# child_process.start()
childProc.start()
# some other code, in this case just sleep
# <some other code>
time.sleep(3)
# similar to 'child_process.join()' in the example you provided
# child_process.join()
childResult = childProcessFuture.get()
print(f'Child result: {childResult}')
charm.exit()
charm.start(main) In the above example, the code executed by the After saving the above in |
@karankakwani Just following up on this. Have you been able to use something similar to the above to solve your problem? |
When I run the example given here on my system, I get the following error(s):-
Example: https://github.com/UIUC-PPL/charm4py/blob/master/examples/parallel-map/square.py
The text was updated successfully, but these errors were encountered: