Ask Your Question
0

What's a good way to track spawned time on a shared server?

asked 2010-08-28 22:02:21 -0500

ccanonc gravatar image

Sometimes I'm running more than one notebook at a time; and since %time sometimes puts almost everything into Wall Time when I'm mostly using subprocesses, the Wall Time doesn't give me a good picture of the time spent since multiple notebooks are running. How can I work around this measurement problem?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2010-08-29 08:46:25 -0500

Mike Hansen gravatar image

I think the best way to track time across subprocesses is to use the cputime command in Sage. It takes a keyword arguments subprocesses=True which will try to track the time spent in subprocesses.

sage: t = cputime(subprocesses=True);
sage: integrate(sin(log(x))^2, x)
-1/5*x*sin(2*log(x)) - 1/10*x*cos(2*log(x)) + 1/2*x
sage: cputime(subprocesses=True) - t
0.13

Compare this with the non- subprocesses=True version:

sage: t = cputime();
sage: integrate(sin(log(x))^2, x)
-1/5*x*sin(2*log(x)) - 1/10*x*cos(2*log(x)) + 1/2*x
sage: cputime() - t
0.0099999999999997868

This currently works by using thing cputime method on expect interface objects.

edit flag offensive delete link more

Comments

Thanks Mike! Great answer as usual. I am finding the multiprocessing and itertools python modules very useful.

ccanonc gravatar imageccanonc ( 2010-08-29 08:58:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2010-08-28 22:02:21 -0500

Seen: 132 times

Last updated: Aug 29 '10