Thanks, William!
> It absolutely will use two additional *processes*, as you might see by
> watching with htop, top, or using ps.
Is it right that the master process is creating all the subprocesses?
I'd suspect I don't quite see the other processes in action simply
because they are there only for milliseconds...
> Yes-ish. Just to be clear there is one single fork that happens,
> which means that
> (almost) all state of the process is inherited by the subprocess.
Yes, but every subprocess modified the data structure *within the
subprocess*, the object in the main process is not modified, or am I
missing something? (That's at least how I understand the
documentation, and what I see happening in my computation output.)
> That fakes @parallel -- providing the same API -- but actually running
> everything in serial in the parent process. No forking or anything
> else happens. It's for testing and development purposes.
I see.
> Break up your computation into far less than 20,000 separate steps, then us
> @parallel.
Okay, I'll do that.
But I still don't see how I should handle the side effects that are
supposed to effect objects in the main process.
Or are you suggesting that I should (actually also for clarity of the
code) completely remove all side effects, do the computations in
parallel, but instead of the side effects return the stuff I need and
then do the side effect stuff in serial. Sth. like
@parallel
def f(m):
return [ factor(k) for k in range(1000*m, 1000*(m+1)) ]
obj = MyObj()
for x in f([1..20]):
print x[0]
for y in x:
obj.store_new_data(y)
If I should do it this way: is the body of the for-loop executed in
the main process *in parallel* to the subprocess computing the next
element of the iterator f([1..20]) ?
Thanks again for the clarification!
Christian
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.