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

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