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.

test_layout_options.cpp 2.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #include <gtest/gtest.h>
  2. #include <string.h>
  3. #include <memory>
  4. #include "test_common.h"
  5. #include "test_options.h"
  6. using namespace lar;
  7. DECLARE_bool(lite);
  8. DECLARE_bool(cpu);
  9. #if LITE_WITH_CUDA
  10. DECLARE_bool(cuda);
  11. #endif
  12. DECLARE_bool(enable_nchw4);
  13. DECLARE_bool(enable_chwn4);
  14. DECLARE_bool(enable_nchw44);
  15. DECLARE_bool(enable_nchw88);
  16. DECLARE_bool(enable_nchw32);
  17. DECLARE_bool(enable_nchw64);
  18. DECLARE_bool(enable_nhwcd4);
  19. DECLARE_bool(enable_nchw44_dot);
  20. DECLARE_bool(fast_run);
  21. namespace {
  22. BOOL_OPTION_WRAP(enable_nchw4);
  23. BOOL_OPTION_WRAP(enable_chwn4);
  24. BOOL_OPTION_WRAP(enable_nchw44);
  25. BOOL_OPTION_WRAP(enable_nchw88);
  26. BOOL_OPTION_WRAP(enable_nchw32);
  27. BOOL_OPTION_WRAP(enable_nchw64);
  28. BOOL_OPTION_WRAP(enable_nhwcd4);
  29. BOOL_OPTION_WRAP(enable_nchw44_dot);
  30. BOOL_OPTION_WRAP(fast_run);
  31. BOOL_OPTION_WRAP(lite);
  32. BOOL_OPTION_WRAP(cpu);
  33. #if LITE_WITH_CUDA
  34. BOOL_OPTION_WRAP(cuda);
  35. #endif
  36. } // anonymous namespace
  37. TEST(TestLarLayout, X86_CPU) {
  38. DEFINE_WRAP(cpu);
  39. std::string model_path = "./shufflenet.mge";
  40. TEST_BOOL_OPTION(enable_nchw4);
  41. TEST_BOOL_OPTION(enable_chwn4);
  42. TEST_BOOL_OPTION(enable_nchw44);
  43. TEST_BOOL_OPTION(enable_nchw44_dot);
  44. TEST_BOOL_OPTION(enable_nchw64);
  45. TEST_BOOL_OPTION(enable_nchw32);
  46. TEST_BOOL_OPTION(enable_nchw88);
  47. }
  48. TEST(TestLarLayout, X86_CPU_LITE) {
  49. DEFINE_WRAP(cpu);
  50. DEFINE_WRAP(lite);
  51. std::string model_path = "./shufflenet.mge";
  52. TEST_BOOL_OPTION(enable_nchw4);
  53. TEST_BOOL_OPTION(enable_nchw44);
  54. TEST_BOOL_OPTION(enable_nchw44_dot);
  55. TEST_BOOL_OPTION(enable_nchw64);
  56. TEST_BOOL_OPTION(enable_nchw32);
  57. TEST_BOOL_OPTION(enable_nchw88);
  58. }
  59. TEST(TestLarLayoutFastRun, CPU_LITE) {
  60. DEFINE_WRAP(cpu);
  61. DEFINE_WRAP(lite);
  62. std::string model_path = "./shufflenet.mge";
  63. {
  64. DEFINE_WRAP(enable_nchw44);
  65. DEFINE_WRAP(fast_run);
  66. run_NormalStrategy(model_path);
  67. }
  68. }
  69. #if LITE_WITH_CUDA
  70. TEST(TestLarLayout, CUDA) {
  71. DEFINE_WRAP(cuda);
  72. std::string model_path = "./shufflenet.mge";
  73. TEST_BOOL_OPTION(enable_nchw4);
  74. TEST_BOOL_OPTION(enable_chwn4);
  75. TEST_BOOL_OPTION(enable_nchw64);
  76. TEST_BOOL_OPTION(enable_nchw32);
  77. FLAGS_cuda = false;
  78. }
  79. TEST(TestLarLayout, CUDA_LITE) {
  80. DEFINE_WRAP(cuda);
  81. DEFINE_WRAP(lite);
  82. std::string model_path = "./shufflenet.mge";
  83. TEST_BOOL_OPTION(enable_nchw4);
  84. TEST_BOOL_OPTION(enable_nchw64);
  85. TEST_BOOL_OPTION(enable_nchw32);
  86. }
  87. #endif
  88. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}