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.

fixture.cpp 846 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "test/naive/fixture.h"
  2. #include "test/common/memory_manager.h"
  3. #include "test/common/random_state.h"
  4. #include "test/common/utils.h"
  5. namespace megdnn {
  6. namespace test {
  7. void NAIVE::SetUp() {
  8. RandomState::reset();
  9. m_handle = create_cpu_handle(2);
  10. }
  11. void NAIVE::TearDown() {
  12. m_handle.reset();
  13. MemoryManagerHolder::instance()->clear();
  14. }
  15. void NAIVE_MULTI_THREADS::SetUp() {
  16. #if MEGDNN_ENABLE_MULTI_THREADS
  17. TaskExecutorConfig config;
  18. size_t nr_threads = std::min<size_t>(get_cpu_count(), 2);
  19. config.nr_thread = nr_threads;
  20. m_handle = create_cpu_handle(2, true, &config);
  21. #else
  22. m_handle = create_cpu_handle(2);
  23. #endif
  24. }
  25. void NAIVE_MULTI_THREADS::TearDown() {
  26. m_handle.reset();
  27. MemoryManagerHolder::instance()->clear();
  28. }
  29. } // namespace test
  30. } // namespace megdnn
  31. // vim: syntax=cpp.doxygen