You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cpuinfo.cpp 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * \file dnn/test/x86/cpuinfo.cpp
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied.
  11. */
  12. #include "src/common/utils.h"
  13. #if defined(MGB_ENABLE_CPUINFO_CHECK) && MGB_ENABLE_CPUINFO
  14. #include <cpuinfo.h>
  15. #include <inttypes.h>
  16. #include "gtest/gtest.h"
  17. namespace megdnn {
  18. namespace test {
  19. TEST(X86_RUNTIME, CPUINFO_XEON6130) {
  20. ASSERT_TRUE(cpuinfo_initialize());
  21. int right_cpu = strcmp(cpuinfo_get_package(0)->name, "Intel Xeon Gold 6130");
  22. if (!right_cpu) {
  23. ASSERT_TRUE(cpuinfo_get_processors());
  24. ASSERT_TRUE(cpuinfo_has_x86_avx2());
  25. ASSERT_TRUE(cpuinfo_has_x86_avx512f());
  26. ASSERT_TRUE(cpuinfo_has_x86_sse4_2());
  27. ASSERT_TRUE(cpuinfo_has_x86_avx());
  28. } else {
  29. printf("detect cpu: %s ,skip test.\n", cpuinfo_get_package(0)->name);
  30. }
  31. }
  32. } // namespace test
  33. } // namespace megdnn
  34. #endif
  35. // vim: syntax=cpp.doxygen