From 41bce03783537fc0f714e123e5a439847e16f5ae Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Wed, 21 Jun 2017 08:53:08 +0200 Subject: [PATCH] Added some memory-related diagnosis. --- svrtset.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/svrtset.py b/svrtset.py index 4022752..ead6083 100755 --- a/svrtset.py +++ b/svrtset.py @@ -111,6 +111,7 @@ class CompressedVignetteSet: acc = 0.0 acc_sq = 0.0 + usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss for b in range(0, self.nb_batches): target = torch.LongTensor(self.batch_size).bernoulli_(0.5) input = svrt.generate_vignettes(problem_number, target) @@ -134,6 +135,10 @@ class CompressedVignetteSet: print('Memory leak?!') raise + mem = (resource.getrusage(resource.RUSAGE_SELF).ru_maxrss - usage) * 1024 + print('Using ' + str(mem / (1024 * 1024)) + 'Gb / ' + + str(mem / self.nb_samples) + ' bytes per sample') + self.mean = acc / self.nb_batches self.std = sqrt(acc_sq / self.nb_batches - self.mean * self.mean) -- 2.39.5