MCPcopy Create free account
hub / github.com/LeapLabTHU/DAT / throughput

Function throughput

slurm_main.py:299–315  ·  view source on GitHub ↗
(data_loader, model, logger)

Source from the content-addressed store, hash-verified

297
298@torch.no_grad()
299def throughput(data_loader, model, logger):
300 model.eval()
301
302 for _, (images, _) in enumerate(data_loader):
303 images = images.cuda(non_blocking=True)
304 batch_size = images.shape[0]
305 for i in range(50):
306 model(images)
307 torch.cuda.synchronize()
308 logger.info(f"throughput averaged with 30 times")
309 tic1 = time.time()
310 for i in range(30):
311 model(images)
312 torch.cuda.synchronize()
313 tic2 = time.time()
314 logger.info(f"batch_size {batch_size} throughput {30 * batch_size / (tic2 - tic1)}")
315 return
316if __name__ == '__main__':
317 main()

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected