Deep Neural Network Library (DNNL)
1.90.1
Performance library for Deep Learning
examples
example_macros.h
1
/*******************************************************************************
2
* Copyright 2019 Intel Corporation
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*******************************************************************************/
16
17
#ifndef EXAMPLE_MACROS_H
18
#define EXAMPLE_MACROS_H
19
20
#include <stdio.h>
21
22
#include "
dnnl.h
"
23
24
#define CHECK(f) \
25
do { \
26
dnnl_status_t s_ = f; \
27
if (s_ != dnnl_success) { \
28
printf("[%s:%d] error: %s returns %d\n", __FILE__, __LINE__, #f, \
29
s_); \
30
exit(2); \
31
} \
32
} while (0)
33
34
#define CHECK_TRUE(expr) \
35
do { \
36
int e_ = expr; \
37
if (!e_) { \
38
printf("[%s:%d] %s failed\n", __FILE__, __LINE__, #expr); \
39
exit(2); \
40
} \
41
} while (0)
42
43
#define CHECK_NULL(m) \
44
do { \
45
if (!m) { \
46
printf("[%s:%d] unable to allocate memory for %s\n", __FILE__, \
47
__LINE__, #m); \
48
exit(2); \
49
} \
50
} while (0)
51
52
#endif
dnnl.h
C API.