Re: [Yade-users] [Question #705760]: How to get the runtime or CPU time?

2023-03-09 Thread Danny (Dingeman) van der Haven
Question #705760 on Yade changed:
https://answers.launchpad.net/yade/+question/705760

Status: Answered => Solved

Danny (Dingeman) van der Haven confirmed that the question is solved:
Thank you all! Those suggestions indeed sovled my problem.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #705760]: How to get the runtime or CPU time?

2023-03-09 Thread Bruno Chareyre
Question #705760 on Yade changed:
https://answers.launchpad.net/yade/+question/705760

Bruno Chareyre proposed the following answer:
Python's time.time() is enough in many cases, as long as you don't need
per-engine data or nano-second accuracy.

t1 = time.time()
O.run(...)
realTime = time.time() - t1

yade.timing is convenient if you want more granularity in the timings
(you probably forgot 'from yade import timing'). You can also introduce
your own checkpoints in the source code which will be reflected in the
output of yade.timing.stats().

Bruno

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #705760]: How to get the runtime or CPU time?

2023-03-09 Thread Jérôme Duriez
Question #705760 on Yade changed:
https://answers.launchpad.net/yade/+question/705760

Jérôme Duriez proposed the following answer:
Hi,

There should be no problem in using timing module (have you "from yade
import timing" first ?). Using time.time Python functions is still not a
bad idea though as the timing module induces some overhead (see the
doc).


Cheers

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #705760]: How to get the runtime or CPU time?

2023-03-08 Thread Karol Brzezinski
Question #705760 on Yade changed:
https://answers.launchpad.net/yade/+question/705760

Status: Open => Answered

Karol Brzezinski proposed the following answer:
Hi Danny,

It may be a little bit of a workaround, but every periodic engine (e.g. 
PyRunner) stores the information about the time of the last run. You could use 
it to track the time of the simulation. For example, if the last engine in the 
list is PyRunner, you can check:
O.engines[-1].realLast

Cheers,
Karol

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #705760]: How to get the runtime or CPU time?

2023-03-08 Thread Danny (Dingeman) van der Haven
New question #705760 on Yade:
https://answers.launchpad.net/yade/+question/705760

Hi all!

I would like to time the running time of the simulation at various stages. With 
this I mean the CPU time or the actual real-world time it take to run the 
simulation.

I have tried the instructions at https://yade-dem.org/doc/prog.html#timing
But I just get a message that yade.timing does not have the attribute 'timing', 
even after setting O.timingEnabled=True.
I really just want to use yade.timing.runtime() and write its output to a file.
I don't need a very precise timing or to know how long the engine takes. I just 
need the current CPU time.

Does YADE have this option or do I need to resort to general Python functions?

With kind regards,
Danny

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp