I have a java code that as part of the code it handles a very big matrix (1 million by 4 million) and it takes several hours to run, before it crashes!
I would like to monitor the progress of the code, so know when it runs out of memory and crashes what percentage of matrix was already processes.
I am thinking of adding a command to print on screen a counter (relative to the main operation loop) every 1000 iteration. or logging the counter in a text file.
Is this a good idea? Or will it slow down my already-slow code even further? After all I am adding a condition verification check (to check 1000th iteration) and file-write operation.
Any standard solution in java?
If there is no standard method or function for monitoring the progress, which would be more efficient, writing my own log to a file or printing on screen?
Bonus question: what about in Python? Any internal or standard library for this purspose?
thanks