Hi Amit,
I can think of a few ways to do this (from hardest to easiest): 1. Your C++ program must link to slurm shared library. Then inside your jobscirpt you have to pass the jobID to your program as a parameter. And inside your code you should call some slurm methods like slurm_get_rem_time() or slurm_load_job() and implement the logic you want. 2. You could have another process running in parallel that is doing the above actions and you have to implement a way that process to contact the c++ programm (with IPC like sockets, pipes, shmem or signals, etc) and inside the c++ code you have to handle the IPC message. 3. Just use the the --signal option of sbatch where slurm will send the signal you specify to your c++ program when you are close to the walltime. Your c++ program must handle that signal. Best Regards, Chrysovalantis Paschoulas On 04/12/2016 01:03 PM, Amit Goel wrote:
Hi Let us say I have a C++ code that is scheduled for 12 hours and is now running on a SLURM cluster. How do I find out the remaining time for this c++ program, from inside the program ? Can c++ code interact with scheduler and report how much time is left. Regards Amit =
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------
