includes.cpp 17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

/*******************************************************************************
* Copyright 2017-2018 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#include <string>
#include <vector>

#include "gtest/gtest.h"

#include "ngraph/codegen/compiler.hpp"
#include "ngraph/log.hpp"
#include "ngraph/util.hpp"

using namespace std;
using namespace ngraph;

TEST(DISABLED_include, complete)
{
    vector<string> include_files = {"ngraph/autodiff/adjoints.hpp",
                                    "ngraph/axis_set.hpp",
                                    "ngraph/axis_vector.hpp",
                                    "ngraph/builder/autobroadcast.hpp",
                                    "ngraph/builder/numpy_transpose.hpp",
                                    "ngraph/builder/reduce_ops.hpp",
                                    "ngraph/codegen/code_writer.hpp",
                                    "ngraph/codegen/compiler.hpp",
                                    "ngraph/codegen/execution_engine.hpp",
                                    "ngraph/coordinate.hpp",
                                    "ngraph/coordinate_diff.hpp",
                                    "ngraph/coordinate_transform.hpp",
                                    "ngraph/descriptor/buffer.hpp",
                                    "ngraph/descriptor/buffer_pos.hpp",
                                    "ngraph/descriptor/input.hpp",
                                    "ngraph/descriptor/layout/dense_tensor_view_layout.hpp",
                                    "ngraph/descriptor/layout/tensor_view_layout.hpp",
                                    "ngraph/descriptor/output.hpp",
                                    "ngraph/descriptor/primary_tensor_view.hpp",
                                    "ngraph/descriptor/tensor.hpp",
                                    "ngraph/descriptor/tensor_view.hpp",
                                    "ngraph/except.hpp",
                                    "ngraph/file_util.hpp",
                                    "ngraph/function.hpp",
                                    "ngraph/graph_util.hpp",
                                    "ngraph/log.hpp",
                                    "ngraph/ngraph.hpp",
                                    "ngraph/node.hpp",
                                    "ngraph/node_vector.hpp",
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
                                    "ngraph/op/abs.hpp",
                                    "ngraph/op/acos.hpp",
                                    "ngraph/op/add.hpp",
                                    "ngraph/op/allreduce.hpp",
                                    "ngraph/op/asin.hpp",
                                    "ngraph/op/atan.hpp",
                                    "ngraph/op/avg_pool.hpp",
                                    "ngraph/op/batch_norm.hpp",
                                    "ngraph/op/broadcast.hpp",
                                    "ngraph/op/ceiling.hpp",
                                    "ngraph/op/concat.hpp",
                                    "ngraph/op/constant.hpp",
                                    "ngraph/op/convert.hpp",
                                    "ngraph/op/convolution.hpp",
                                    "ngraph/op/cos.hpp",
                                    "ngraph/op/cosh.hpp",
                                    "ngraph/op/divide.hpp",
                                    "ngraph/op/dot.hpp",
                                    "ngraph/op/equal.hpp",
                                    "ngraph/op/exp.hpp",
                                    "ngraph/op/floor.hpp",
                                    "ngraph/op/function_call.hpp",
                                    "ngraph/op/get_output_element.hpp",
                                    "ngraph/op/greater.hpp",
                                    "ngraph/op/greater_eq.hpp",
                                    "ngraph/op/less.hpp",
                                    "ngraph/op/less_eq.hpp",
                                    "ngraph/op/log.hpp",
                                    "ngraph/op/max.hpp",
                                    "ngraph/op/maximum.hpp",
                                    "ngraph/op/max_pool.hpp",
                                    "ngraph/op/min.hpp",
                                    "ngraph/op/minimum.hpp",
                                    "ngraph/op/multiply.hpp",
                                    "ngraph/op/negative.hpp",
                                    "ngraph/op/not.hpp",
                                    "ngraph/op/not_equal.hpp",
                                    "ngraph/op/one_hot.hpp",
                                    "ngraph/op/op.hpp",
                                    "ngraph/op/pad.hpp",
                                    "ngraph/op/parameter.hpp",
                                    "ngraph/op/parameter_vector.hpp",
                                    "ngraph/op/power.hpp",
                                    "ngraph/op/product.hpp",
                                    "ngraph/op/reduce.hpp",
                                    "ngraph/op/reduce_window.hpp",
                                    "ngraph/op/relu.hpp",
                                    "ngraph/op/remainder.hpp",
                                    "ngraph/op/replace_slice.hpp",
                                    "ngraph/op/reshape.hpp",
                                    "ngraph/op/reverse.hpp",
                                    "ngraph/op/select.hpp",
                                    "ngraph/op/select_and_scatter.hpp",
                                    "ngraph/op/sign.hpp",
                                    "ngraph/op/sin.hpp",
                                    "ngraph/op/sinh.hpp",
                                    "ngraph/op/slice.hpp",
                                    "ngraph/op/sqrt.hpp",
                                    "ngraph/op/subtract.hpp",
                                    "ngraph/op/sum.hpp",
                                    "ngraph/op/tan.hpp",
                                    "ngraph/op/tanh.hpp",
                                    "ngraph/op/util/arithmetic_reduction.hpp",
                                    "ngraph/op/util/binary_elementwise.hpp",
                                    "ngraph/op/util/binary_elementwise_arithmetic.hpp",
                                    "ngraph/op/util/binary_elementwise_comparison.hpp",
                                    "ngraph/op/util/op_annotations.hpp",
                                    "ngraph/op/util/requires_tensor_view_args.hpp",
                                    "ngraph/op/util/unary_elementwise.hpp",
                                    "ngraph/op/util/unary_elementwise_arithmetic.hpp",
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
                                    "ngraph/pass/assign_layout.hpp",
                                    "ngraph/pass/assign_placement.hpp",
                                    "ngraph/pass/dump_sorted.hpp",
                                    "ngraph/pass/graph_rewrite.hpp",
                                    "ngraph/pass/inliner.hpp",
                                    "ngraph/pass/liveness.hpp",
                                    "ngraph/pass/manager.hpp",
                                    "ngraph/pass/manager_state.hpp",
                                    "ngraph/pass/memory_layout.hpp",
                                    "ngraph/pass/memory_visualize.hpp",
                                    "ngraph/pass/pass.hpp",
                                    "ngraph/pass/reshape_elimination.hpp",
                                    "ngraph/pass/visualize_tree.hpp",
                                    "ngraph/pattern/core_fusion.hpp",
                                    "ngraph/pattern/matcher.hpp",
146
                                    "ngraph/pattern/op/skip.hpp",
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
                                    "ngraph/pattern/op/label.hpp",
                                    "ngraph/pattern/op/pattern.hpp",
                                    "ngraph/placement.hpp",
                                    "ngraph/runtime/aligned_buffer.hpp",
                                    "ngraph/runtime/backend.hpp",
                                    "ngraph/runtime/cpu/cpu_backend.hpp",
                                    "ngraph/runtime/cpu/cpu_call_frame.hpp",
                                    "ngraph/runtime/cpu/cpu_eigen_utils.hpp",
                                    "ngraph/runtime/cpu/cpu_emitter.hpp",
                                    "ngraph/runtime/cpu/cpu_external_function.hpp",
                                    "ngraph/runtime/cpu/cpu_kernels.hpp",
                                    "ngraph/runtime/cpu/cpu_kernel_emitters.hpp",
                                    "ngraph/runtime/cpu/cpu_kernel_utils.hpp",
                                    "ngraph/runtime/cpu/cpu_layout_descriptor.hpp",
                                    "ngraph/runtime/cpu/cpu_manager.hpp",
                                    "ngraph/runtime/cpu/cpu_op_annotations.hpp",
                                    "ngraph/runtime/cpu/cpu_runtime_context.hpp",
                                    "ngraph/runtime/cpu/cpu_tensor_view.hpp",
                                    "ngraph/runtime/cpu/cpu_tensor_view_wrapper.hpp",
                                    "ngraph/runtime/cpu/cpu_tracing.hpp",
                                    "ngraph/runtime/cpu/mkldnn_emitter.hpp",
                                    "ngraph/runtime/cpu/mkldnn_invoke.hpp",
                                    "ngraph/runtime/cpu/mkldnn_utils.hpp",
170 171
                                    "ngraph/runtime/cpu/op/convert_layout.hpp",
                                    "ngraph/runtime/cpu/op/matmul_bias.hpp",
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
                                    "ngraph/runtime/cpu/pass/cpu_assignment.hpp",
                                    "ngraph/runtime/cpu/pass/cpu_fusion.hpp",
                                    "ngraph/runtime/cpu/pass/cpu_layout.hpp",
                                    "ngraph/runtime/external_function.hpp",
                                    // "ngraph/runtime/gpu/gpu_backend.hpp",
                                    // "ngraph/runtime/gpu/gpu_call_frame.hpp",
                                    // "ngraph/runtime/gpu/gpu_cuda_context_manager.hpp",
                                    // "ngraph/runtime/gpu/gpu_cuda_function_builder.hpp",
                                    // "ngraph/runtime/gpu/gpu_cuda_function_pool.hpp",
                                    // "ngraph/runtime/gpu/gpu_cuda_kernel_builder.hpp",
                                    // "ngraph/runtime/gpu/gpu_cuda_kernel_emitters.hpp",
                                    // "ngraph/runtime/gpu/gpu_emitter.hpp",
                                    // "ngraph/runtime/gpu/gpu_external_function.hpp",
                                    // "ngraph/runtime/gpu/gpu_kernel_emitters.hpp",
                                    // "ngraph/runtime/gpu/gpu_manager.hpp",
                                    // "ngraph/runtime/gpu/gpu_tensor_view.hpp",
                                    // "ngraph/runtime/gpu/gpu_tensor_view_wrapper.hpp",
                                    // "ngraph/runtime/gpu/gpu_util.hpp",
                                    "ngraph/runtime/host_tensor_view.hpp",
                                    "ngraph/runtime/interpreter/int_backend.hpp",
                                    "ngraph/runtime/interpreter/int_call_frame.hpp",
                                    "ngraph/runtime/interpreter/int_external_function.hpp",
                                    "ngraph/runtime/interpreter/int_manager.hpp",
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
                                    "ngraph/runtime/reference/abs.hpp",
                                    "ngraph/runtime/reference/acos.hpp",
                                    "ngraph/runtime/reference/add.hpp",
                                    "ngraph/runtime/reference/allreduce.hpp",
                                    "ngraph/runtime/reference/asin.hpp",
                                    "ngraph/runtime/reference/atan.hpp",
                                    "ngraph/runtime/reference/avg_pool.hpp",
                                    "ngraph/runtime/reference/broadcast.hpp",
                                    "ngraph/runtime/reference/ceiling.hpp",
                                    "ngraph/runtime/reference/concat.hpp",
                                    "ngraph/runtime/reference/constant.hpp",
                                    "ngraph/runtime/reference/convert.hpp",
                                    "ngraph/runtime/reference/convolution.hpp",
                                    "ngraph/runtime/reference/copy.hpp",
                                    "ngraph/runtime/reference/cos.hpp",
                                    "ngraph/runtime/reference/cosh.hpp",
                                    "ngraph/runtime/reference/divide.hpp",
                                    "ngraph/runtime/reference/dot.hpp",
                                    "ngraph/runtime/reference/equal.hpp",
                                    "ngraph/runtime/reference/exp.hpp",
                                    "ngraph/runtime/reference/floor.hpp",
                                    "ngraph/runtime/reference/greater.hpp",
                                    "ngraph/runtime/reference/greater_eq.hpp",
                                    "ngraph/runtime/reference/less.hpp",
                                    "ngraph/runtime/reference/less_eq.hpp",
                                    "ngraph/runtime/reference/log.hpp",
                                    "ngraph/runtime/reference/max.hpp",
                                    "ngraph/runtime/reference/maximum.hpp",
                                    "ngraph/runtime/reference/max_pool.hpp",
                                    "ngraph/runtime/reference/min.hpp",
                                    "ngraph/runtime/reference/minimum.hpp",
                                    "ngraph/runtime/reference/multiply.hpp",
                                    "ngraph/runtime/reference/negate.hpp",
                                    "ngraph/runtime/reference/not.hpp",
                                    "ngraph/runtime/reference/not_equal.hpp",
                                    "ngraph/runtime/reference/one_hot.hpp",
                                    "ngraph/runtime/reference/pad.hpp",
                                    "ngraph/runtime/reference/power.hpp",
                                    "ngraph/runtime/reference/product.hpp",
                                    "ngraph/runtime/reference/reduce.hpp",
                                    "ngraph/runtime/reference/reduce_window.hpp",
                                    "ngraph/runtime/reference/relu.hpp",
                                    "ngraph/runtime/reference/replace_slice.hpp",
                                    "ngraph/runtime/reference/reshape.hpp",
                                    "ngraph/runtime/reference/reverse.hpp",
                                    "ngraph/runtime/reference/select.hpp",
                                    "ngraph/runtime/reference/select_and_scatter.hpp",
                                    "ngraph/runtime/reference/sign.hpp",
                                    "ngraph/runtime/reference/sin.hpp",
                                    "ngraph/runtime/reference/sinh.hpp",
                                    "ngraph/runtime/reference/slice.hpp",
                                    "ngraph/runtime/reference/sqrt.hpp",
                                    "ngraph/runtime/reference/subtract.hpp",
                                    "ngraph/runtime/reference/sum.hpp",
                                    "ngraph/runtime/reference/tan.hpp",
                                    "ngraph/runtime/reference/tanh.hpp",
251 252 253 254 255
                                    "ngraph/runtime/manager.hpp",
                                    "ngraph/runtime/tensor_view.hpp",
                                    "ngraph/serializer.hpp",
                                    "ngraph/shape.hpp",
                                    "ngraph/strides.hpp",
256 257
                                    "ngraph/type/element_type.hpp",
                                    "ngraph/type/type.hpp",
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
                                    "ngraph/util.hpp",
                                    "ngraph/uuid.hpp"};

    for (const string& include : include_files)
    {
        string source = "#include <" + include + ">\n ";

        stopwatch timer;
        timer.start();
        codegen::Compiler compiler;
        compiler.add_header_search_path(JSON_INCLUDES);
        auto module = compiler.compile(source);
        timer.stop();
        ASSERT_NE(nullptr, module) << source;
        // NGRAPH_INFO << timer.get_milliseconds() << " " << source;
    }
}