This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Add more models to benchmark_score #12780
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a51ba4b
add models to cnn benchmark
xinyu-intel 6be4b37
improve benchmark score
xinyu-intel 1c583df
add benchmark_gluon
xinyu-intel a3d7926
improve lint
xinyu-intel 1c2fd17
improve lint
xinyu-intel 6725cd1
add licsence for script
xinyu-intel 1cb5290
improve script lint
xinyu-intel 0b17d6f
mv benchmark_gluon to new location
xinyu-intel d5e8a5d
support multi-gpus
xinyu-intel bca8573
Merge remote-tracking branch 'upstream/master' into benchmark_model
xinyu-intel 1298025
Add a new parameter 'global batchsize' for the batch size multiplicat…
9b43b33
Merge remote-tracking branch 'upstream/master' into benchmark_model
xinyu-intel 3983411
add batch size argument help
xinyu-intel 68e8009
improve help and change default batchsize
xinyu-intel ada3038
Merge remote-tracking branch 'upstream/master' into benchmark_model
xinyu-intel e21c8f5
simplify benchmark_gluon
xinyu-intel 0e1d30b
Merge remote-tracking branch 'upstream/master' into benchmark_model
xinyu-intel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add a new parameter 'global batchsize' for the batch size multiplicat…
…ion for multi-gpu case
- Loading branch information
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,11 +41,14 @@ | |
parser.add_argument('--num-batches', type=int, default=10) | ||
parser.add_argument('--gpus', type=str, default='', | ||
help='ordinates of gpus to use, can be "0,1,2" or empty for cpu only.') | ||
parser.add_argument('--global-batchsize', type=bool, default=True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than adding an option, I think you can just pick one convention. |
||
help='for multi-gpu case, the batchsize will not be multiplied with GPU number if set true.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional. Set this to True if batch-size should be used as is. |
||
parser.add_argument('--type', type=str, default='inference', choices=['all', 'training', 'inference']) | ||
|
||
opt = parser.parse_args() | ||
|
||
num_batches = opt.num_batches | ||
global_bs = opt.global_batchsize | ||
dry_run = 10 # use 10 iterations to warm up | ||
batch_inf = [1, 16, 32, 64, 128, 256] | ||
batch_train = [1, 2, 4, 8, 16, 32, 64, 126, 256] | ||
|
@@ -143,25 +146,37 @@ def train(network, batch_size, ctx): | |
logging.info('device: %s', devs) | ||
if runtype == 'inference' or runtype == 'all': | ||
if bs != 0: | ||
batch_sizes = bs * max(1, num_gpus) | ||
if not global_bs: | ||
batch_sizes = bs * max(1, num_gpus) | ||
else: | ||
batch_sizes = bs | ||
fwd_time = score(network, batch_sizes, devs) | ||
fps = (batch_sizes * num_batches)/fwd_time | ||
logging.info(network + ' inference perf for BS %d is %f img/s', bs, fps) | ||
else: | ||
for batch_size in batch_inf: | ||
batch_sizes = batch_size * max(1, num_gpus) | ||
if not global_bs: | ||
batch_sizes = batch_size * max(1, num_gpus) | ||
else: | ||
batch_sizes = batch_size | ||
fwd_time = score(network, batch_sizes, devs) | ||
fps = (batch_sizes * num_batches) / fwd_time | ||
logging.info(network + ' inference perf for BS %d is %f img/s', batch_size, fps) | ||
if runtype == 'training' or runtype == 'all': | ||
if bs != 0: | ||
batch_sizes = bs * max(1, num_gpus) | ||
if not global_bs: | ||
batch_sizes = bs * max(1, num_gpus) | ||
else: | ||
batch_sizes = bs | ||
bwd_time = train(network, batch_sizes, devs) | ||
fps = (batch_sizes * num_batches) / bwd_time | ||
logging.info(network + ' training perf for BS %d is %f img/s', bs, fps) | ||
else: | ||
for batch_size in batch_train: | ||
batch_sizes = batch_size * max(1, num_gpus) | ||
if not global_bs: | ||
batch_sizes = batch_size * max(1, num_gpus) | ||
else: | ||
batch_sizes = batch_size | ||
bwd_time = train(network, batch_sizes, devs) | ||
fps = (batch_sizes * num_batches) / bwd_time | ||
logging.info(network + ' training perf for BS %d is %f img/s', batch_size, fps) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GPU IDs to use for this benchmark task. Example: --gpus=0,1,2,3 to use 4 GPUs. By default, use CPU only.