2 // Copyright (c) 2016 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <gtest/gtest.h>
20 #include "api/CPP/engine.hpp"
21 #include "test_utils/test_utils.h"
22 #include "api/CPP/input_layout.hpp"
23 #include "api/CPP/network.hpp"
25 using namespace tests;
26 using namespace cldnn;
28 TEST(events_pool, DISABLED_basic_test)
31 This tests if the events pool works and there's no memory leak.
39 topology.add(input_layout("input", { data_types::f32, format::bfyx,{ tensor(spatial(x_size, y_size), feature(feature_num), batch(batch_num))}}));
40 topology.add(activation("relu", "input", activation_relu));
41 topology.add(activation("relu1", "relu", activation_relu));
42 topology.add(activation("relu2", "relu1", activation_relu));
43 topology.add(activation("relu3", "relu2", activation_relu));
44 topology.add(activation("relu4", "relu3", activation_relu));
45 topology.add(activation("relu5", "relu4", activation_relu));
48 bo.set_option(build_option::optimize_data(true));
50 for (int i = 0; i < 20; i++)
52 engine eng;// here we build new engine i times
53 auto input = memory::allocate(eng, { data_types::f32, format::bfyx,{ tensor(spatial(x_size, y_size), feature(feature_num), batch(batch_num)) } });
54 std::vector<float> input_vec = { -1.f, 2.f, -3.f, 4.f };
55 for (int j = 0; j < 20; j++) //then we build network j times
57 network network(eng, topology, bo);
58 network.set_input_data("input", input);
59 for(int k = 0; k < 20; k++) //and execute that network k times
62 EXPECT_EQ(eng.get_max_used_device_memory_size(), (uint64_t)80);