Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / mkl-dnn / tests / benchdnn / CMakeLists.txt
1 #===============================================================================
2 # Copyright 2017-2018 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 file(GLOB_RECURSE HEADERS
18     ${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h
19     ${CMAKE_CURRENT_SOURCE_DIR}/../include/*.hpp
20     )
21 file(GLOB_RECURSE SOURCES
22     ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
23     )
24 include_directories(
25     ${CMAKE_CURRENT_SOURCE_DIR}
26     ${CMAKE_CURRENT_SOURCE_DIR}/conv
27     ${CMAKE_CURRENT_SOURCE_DIR}/ip
28     ${CMAKE_CURRENT_SOURCE_DIR}/shuffle
29     ${CMAKE_CURRENT_SOURCE_DIR}/reorder
30     )
31
32 if(BENCHDNN_USE_RDPMC)
33     add_definitions(-DBENCHDNN_USE_RDPMC)
34 endif()
35
36 if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
37     append_if(WIN32 CMAKE_CXX_FLAGS "-Qprec-div")
38     append_if(UNIX  CMAKE_CXX_FLAGS "-prec-div -fp-model precise")
39 endif()
40
41 if(UNIX AND NOT APPLE)
42     find_library(LIBRT rt)
43 endif()
44 register_exe(benchdnn "${SOURCES}" "" "${LIBRT}")
45
46 file(COPY inputs DESTINATION .)
47
48 # register benchdnn test case
49 function(register_benchdnn_test name cmd)
50     string(REPLACE " " ";" cmd ${cmd})
51     string(REPLACE " " ";" ARGV2 "${ARGV2}")
52     add_custom_target(${name}
53         COMMAND ${cmd}
54         COMMAND ${ARGV2} # if any
55         DEPENDS benchdnn
56         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
57     )
58     maybe_configure_windows_test(${name} TARGET)
59 endfunction()
60
61 register_benchdnn_test(test_conv "benchdnn -v1 --conv --batch=inputs/test_conv_all")
62 register_benchdnn_test(test_benchdnn_conv "benchdnn -v1 --conv --batch=inputs/test_conv_all")
63 register_benchdnn_test(test_benchdnn_deconv "benchdnn -v1 --deconv --batch=inputs/deconv/test_deconv_all")
64 register_benchdnn_test(test_benchdnn_rnn "benchdnn -v1 --rnn --batch=inputs/rnn/test_rnn_small")
65 register_benchdnn_test(test_benchdnn_reorder "benchdnn --reorder --batch=inputs/reorder/test_default")
66 register_benchdnn_test(test_benchdnn_bnorm "benchdnn --bnorm  --batch=inputs/bnorm/test_bnorm_topo")
67 register_benchdnn_test(test_benchdnn_ip "benchdnn --ip --batch=inputs/ip/test_ip_all")
68 register_benchdnn_test(test_benchdnn_regression
69     "benchdnn --conv --batch=inputs/test_conv_regression"
70     "benchdnn --bnorm --batch=inputs/bnorm/test_bnorm_regressions"
71     )
72 register_benchdnn_test(test_benchdnn_regression_large
73     "benchdnn --bnorm --batch=inputs/bnorm/test_bnorm_regressions_large"
74     )