From e596c5cd7c958eb4b8d5343da109e2f141d37578 Mon Sep 17 00:00:00 2001 From: lidanqing-intel Date: Mon, 28 Sep 2020 04:06:52 +0200 Subject: [PATCH] improve omp test --- deploy/cpp_infer/src/main.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/deploy/cpp_infer/src/main.cpp b/deploy/cpp_infer/src/main.cpp index 51e90544..3f3cae9a 100644 --- a/deploy/cpp_infer/src/main.cpp +++ b/deploy/cpp_infer/src/main.cpp @@ -69,17 +69,10 @@ int main(int argc, char **argv) { config.char_list_file); #ifdef USE_MKL - int i; - std::cout << ">>>>>>>>>>>>>>> Testing MKL <<<<<<<<<<<<<<<<< " << std::endl; -#pragma omp parallel for private(i) - for (i = 0; i < 50; i++) { - std::cout << "omp_get_num_threads(): " << omp_get_num_threads() - << std::endl; - int tid = omp_get_thread_num(); - std::cout << "Log from omp thread " << tid << std::endl; +#pragma omp parallel + for (auto i = 0; i < 10; i++) { + assert(config.cpu_math_library_num_threads == omp_get_num_threads()); } - std::cout << ">>>>>>>>>>>>>>> Testing MKL Finished <<<<<<<<<<<<<<<<< " - << std::endl; #endif auto start = std::chrono::system_clock::now();