Measuring and saving runtime for GCMC

Hi everyone,

I am running adsorption isotherms with Aiida using RASPA, which means that I run several GCMC simulations one after the others. I would like to save the runtime of the whole process. How could I do that?

Thank you in advance for your help !
Vincent

2 Likes

Hi Vincent! :wave: For each calculation job, there is quite a bit of information on the scheduler (e.g. Slurm) job stored in the attributes of the node under the last_job_info key. For figuring out the time the job ran on the computer you can look at the wallclock_time_seconds:

from aiida import orm, load_profile
load_profile()

calcjob = orm.load_node(2126815)
calcjob.attributes['last_job_info']['wallclock_time_seconds']

If you want to find the total time that all calculation jobs executed by a work chain, you can use the called_descendants attribute, for example:

workchain = orm.load_node(2125618)

total_walltime = 0

for calcjob in [
    process for process in workchain.called_descendants
    if isinstance(process, orm.CalcJobNode)
    ]:
    total_walltime += calcjob.attributes['last_job_info']['wallclock_time_seconds']

print(total_walltime)

If you’re interested in the amount of node hours, you can also look at the num_machines key in the last_job_info attribute.

Hope that helps!

Hi Marnik,

Great, thank you for your help and quick answer!
I am a bit unclear how I know what is the node number (‘2125618’) for my case? I construct a builder and do ‘wc = aiida.engine.submit(builder)’, so how do I get the node from this ?

Thank you for you help!
Vincent

The node number is simply the PK. In your example the work chain node can be obtained using wc.pk. Of course the script above will only work for successfully completed work chains. It’s also possible the total_walltime line will throw a KeyError in case a calculation job failed.

Hey Vincent!

It is unclear whether you use the RASPA/CP2K/Zeo++ workflows we developed a while ago. Just to say, when we developed them, we took great care of saving CPU time by restarting from the previous runs. At this point, the workflows are pretty robust, I would say.

Please have a look at the following links:

Best,
Sasha

Hi Sasha,

I am using the Isotherm work chain. I want to measure the computational time to compare it with other computational methods in terms of runtime.
Thanks for your help !
Vincent

1 Like