This repository was archived by the owner on Jul 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +63
-0
lines changed
Expand file tree Collapse file tree 3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 66from dl_bench .mlp import MlpBenchmark
77from dl_bench .cnn import CnnBenchmark
88from dl_bench .llm import LlmBenchmark
9+ from dl_bench .ops import OpsBenchmark
910from dl_bench .mlp_basic import MlpBasicBenchmark
1011from dl_bench .report .report import BenchmarkDb
1112from dl_bench .utils import Backend
1617 "mlp" : MlpBenchmark ,
1718 "cnn" : CnnBenchmark ,
1819 "llm" : LlmBenchmark ,
20+ "ops" : OpsBenchmark ,
1921}
2022
2123
Original file line number Diff line number Diff line change 1+ from dl_bench .utils import Benchmark , RandomInfDataset
2+
3+ import torch
4+
5+ class Conv2dNoPaddingModule (torch .nn .Module ):
6+
7+ def __init__ (self ):
8+ super ().__init__ ()
9+ torch .manual_seed (0 )
10+ self .conv = torch .nn .Conv2d (2 , 10 , 3 , bias = False )
11+ self .train (False )
12+
13+ def forward (self , x ):
14+ return self .conv (x )
15+
16+ def get_op (name ):
17+
18+ name2model = {
19+ "conv210" : Conv2dNoPaddingModule ,
20+ }
21+ if name in name2model :
22+ return name2model [name ]()
23+ else :
24+ raise ValueError (f"Unknown name { name } " )
25+
26+
27+ class OpsBenchmark (Benchmark ):
28+ def __init__ (self , params ) -> None :
29+ batch_size = int (params .get ("batch_size" , 1024 ))
30+
31+ in_shape = (2 , 10 , 20 )
32+ min_batches = 10
33+ DATASET_SIZE = max (10_240 , batch_size * min_batches )
34+ dataset = RandomInfDataset (DATASET_SIZE , in_shape )
35+
36+ name = params .get ("name" , "conv210" )
37+ net = get_op (name = name )
38+
39+ super ().__init__ (
40+ net = net , in_shape = in_shape , dataset = dataset , batch_size = batch_size
41+ )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -x
4+
5+ export ONEDNN_VERBOSE=0
6+
7+ if [[ -z " ${DL_BENCH_ARGS} " ]]; then
8+ echo " Please, provide DL_BENCH_ARGS environment variable"
9+ exit 1
10+ fi
11+
12+ CNNS=(conv210)
13+ for BS in 0001 0032 0128
14+ do
15+ for name in " ${CNNS[@]} "
16+ do
17+ echo " Benchmark $name "
18+ benchmark-run -b ops -p " name='${name} ',batch_size='$BS '" --benchmark_desc " ${name} _bs$BS " ${DL_BENCH_ARGS} || echo Failed
19+ done
20+ done
You can’t perform that action at this time.
0 commit comments