[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
grid [2018/03/08 18:25]
vidra Add info about profiling RAM by `time -v`
grid [2018/03/09 23:28]
vidra [Profiling]
Line 272: Line 272:
  
 ===== Profiling ===== ===== Profiling =====
-As stated above, you should always specify the exact memory limits when running your tasks, so that you neither waste RAM nor starve others of memory by using more that you requested. However, memory requirements can be difficult to estimate in advance. That's why you should profile your tasks first.+As stated above, you should always specify the exact memory limits when running your tasks, so that you neither waste RAM nor starve others of memory by using more than you requested. However, memory requirements can be difficult to estimate in advance. That's why you should profile your tasks first.
  
-A simple method is to run the task and observe the memory usage reported in the epilog, but SGE may not record transient allocations. The kernel doesthough, and you can view the exact stats by looking into /proc/$PID/status while the task is running.+A simple method is to run the task and observe the memory usage reported in the epilog, but SGE may not record transient allocations. As documented in ''man 5 accounting''SGE only collects stats every ''accounting_flush_time''. If this is not set, it defaults to ''flush_time'', which is preset to 15 seconds. But the kernel records all info immediately without polling, and you can view these exact stats by looking into /proc/$PID/status while the task is running.
  
 You can still miss allocations made shortly before the program exits – which often happens when trying to debug why your program gets killed by SGE after exhausting the reserved space. To record these, use ''/usr/bin/time -v'' (the actual binary, not the shell-builtin command ''time''). Be aware that unlike the builtin, it cannot measure shell functions and behaves differently on pipelines. You can still miss allocations made shortly before the program exits – which often happens when trying to debug why your program gets killed by SGE after exhausting the reserved space. To record these, use ''/usr/bin/time -v'' (the actual binary, not the shell-builtin command ''time''). Be aware that unlike the builtin, it cannot measure shell functions and behaves differently on pipelines.
Line 281: Line 281:
  
 If you program in C and need to know the peak memory usage of your children, you can also use the ''wait4()'' syscall and calculate the stats yourself. If you program in C and need to know the peak memory usage of your children, you can also use the ''wait4()'' syscall and calculate the stats yourself.
 +
 +If your job is the only one on a given machine, you can also look how much free memory is left when running the job (e.g. with ''htop'' if you know when is the peak moment).
  
  

[ Back to the navigation ] [ Back to the content ]