diff options
Diffstat (limited to 'lib/oeqa/runtime/miutils/tests/mkl_dnn_test.py')
-rw-r--r-- | lib/oeqa/runtime/miutils/tests/mkl_dnn_test.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/miutils/tests/mkl_dnn_test.py b/lib/oeqa/runtime/miutils/tests/mkl_dnn_test.py new file mode 100644 index 00000000..13afd1a4 --- /dev/null +++ b/lib/oeqa/runtime/miutils/tests/mkl_dnn_test.py | |||
@@ -0,0 +1,57 @@ | |||
1 | |||
2 | class MkldnnTest(object): | ||
3 | mkldnn_target_test_filename = 'mkl-dnn-c' | ||
4 | |||
5 | def __init__(self, target): | ||
6 | self.target = target | ||
7 | |||
8 | def tear_down(self): | ||
9 | self.target.run('rm /tmp/%s' % self.mkldnn_target_test_filename) | ||
10 | |||
11 | def test_mkldnn_can_compile_and_execute(self): | ||
12 | mkldnn_src_dir = '/usr/src/debug/mkl-dnn/' | ||
13 | mkldnn_src_test_filename = 'api.c' | ||
14 | mkldnn_src_test_file = '' | ||
15 | |||
16 | (status, output) = self.target.run('cd %s; find -name %s' % (mkldnn_src_dir, mkldnn_src_test_filename)) | ||
17 | if status: | ||
18 | return status, output | ||
19 | |||
20 | mkldnn_src_test_file = os.path.join(mkldnn_src_dir, output) | ||
21 | (status, output) = self.target.run('gcc %s -o /tmp/%s -ldnnl' % (mkldnn_src_test_file, self.mkldnn_target_test_filename)) | ||
22 | if status: | ||
23 | return status, output | ||
24 | |||
25 | (status, output) = self.target.run('cd /tmp; ./%s' % self.mkldnn_target_test_filename) | ||
26 | return status, output | ||
27 | |||
28 | def test_mkldnn_benchdnn_package_available(self): | ||
29 | (status, output) = self.target.run('ls /usr/bin/mkl-dnn/tests/benchdnn') | ||
30 | return status, output | ||
31 | |||
32 | def _run_mkldnn_benchdnn_test(self, cmd): | ||
33 | (status, output) = self.target.run('cd /usr/bin/mkl-dnn/tests/benchdnn; %s' % cmd) | ||
34 | return status, output | ||
35 | |||
36 | def test_mkldnn_conv_api(self): | ||
37 | return self._run_mkldnn_benchdnn_test('./benchdnn --conv --batch=inputs/conv/test_conv_3d') | ||
38 | |||
39 | def test_mkldnn_bnorm_api(self): | ||
40 | return self._run_mkldnn_benchdnn_test('./benchdnn --bnorm --batch=inputs/bnorm/test_bnorm_regressions') | ||
41 | |||
42 | def test_mkldnn_deconv_api(self): | ||
43 | return self._run_mkldnn_benchdnn_test('./benchdnn --deconv --batch=inputs/deconv/test_deconv_bfloat16') | ||
44 | |||
45 | def test_mkldnn_ip_api(self): | ||
46 | return self._run_mkldnn_benchdnn_test('./benchdnn --ip --batch=inputs/ip/test_ip_bfloat16') | ||
47 | |||
48 | def test_mkldnn_reorder_api(self): | ||
49 | return self._run_mkldnn_benchdnn_test('./benchdnn --reorder --batch=inputs/reorder/test_reorder_bfloat16') | ||
50 | |||
51 | def test_mkldnn_rnn_api(self): | ||
52 | # test_rnn_inference was not yet ready and was expected to fail | ||
53 | # while waiting it to be ready, use test_rnn_small for now | ||
54 | return self._run_mkldnn_benchdnn_test('./benchdnn --rnn --batch=inputs/rnn/test_rnn_small') | ||
55 | |||
56 | def test_mkldnn_shuffle_api(self): | ||
57 | return self._run_mkldnn_benchdnn_test('./benchdnn --shuffle --batch=inputs/shuffle/test_shuffle_bfloat16') \ No newline at end of file | ||