def iteration_report(opts, time): return "{:5f} items/sec".format(opts.batch_size * opts.batches_per_step / time) if __name__ == '__main__': sys.path.insert(1, '../../../utils/benchmarks/popart') import benchmark module = benchmark.Benchmark( graph_builder, add_args, iteration_report ) opts = benchmark.parse_opts(module) opts.train = opts.mode == "train" # Log Benchmark Message print("Popart Multi-IPU {} Synthetic benchmark.\n" " Batch size {}.\n" " Batches per Step {}.\n" " Steps {}.\n" " {} IPUs." .format( {"infer": "Inference", "eval": "Evaluation", "train": "Training"}[opts.mode], opts.batch_size, opts.batches_per_step if not opts.report else "n/a", opts.steps if not opts.report else "n/a", opts.shards))
if __name__ == '__main__': # Add benchmark module to path cwd = os.path.dirname(os.path.abspath(inspect.stack()[0][1])) sys.path.insert(1, os.path.join(cwd, '..', '..', '..', 'utils', 'benchmarks', 'tensorflow')) import benchmark module = benchmark.Benchmark( graph_builder, inputs, initializer, add_args, iteration_report ) options = benchmark.parse_opts(module, False) if options.shards > 1: raise NotImplementedError( "--shards option has not been implemented with this example") # Log Benchmark Message print("Multi-layer LSTM with a dense final layer, {} Benchmark.\n" " Batch size {}.\n" " Batches per Step {}.\n" " Steps {}.\n" " Hidden size {}.\n" " Number of layers {}.\n" " Timesteps {}.\n" .format( "Training" if options.train else "Inference",
parser.set_defaults(batches_per_step=1000, steps=5, convolution_options=None) return parser def iteration_report(opts, time): return "{:5f} images/sec.".format(opts.batch_size * opts.batches_per_step / time) if __name__ == '__main__': module = Benchmark(graph_builder, inputs, initializer, add_args, iteration_report) opts = parse_opts(module, False) if opts.shards > 1: raise NotImplementedError( "--shards option has not been implemented with this example") # Temporary setting for ResNet18 before this option is automated. if opts.size == 18: opts.convolution_options = '{"availableMemoryProportion": "0.4"}' # Log Benchmark Message print("TensorFlow ResNet{} {} Synthetic benchmark.\n" " Batch size {}.\n" " Batches per Step {}.\n" " Steps {}.".format(opts.size, "Training" if opts.train else "Inference",