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 1.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "test/atlas/fixture.h"
  2. #include "src/atlas/handle.h"
  3. #include "src/atlas/megcore/device_context.hpp"
  4. #include "src/atlas/utils.h"
  5. #include "test/common/memory_manager.h"
  6. #include "test/common/random_state.h"
  7. #include "test/common/utils.h"
  8. #include "acl/acl.h"
  9. #include <cstdlib>
  10. using namespace megdnn;
  11. using namespace test;
  12. void ATLAS::SetUp() {
  13. RandomState::reset();
  14. // use card 0
  15. megcore_check(megcoreCreateDeviceHandle(&m_dev_handle, megcorePlatformAtlas, 0));
  16. megcoreActivate(m_dev_handle);
  17. megcoreComputingHandle_t comp_handle;
  18. megcore_check(megcoreCreateComputingHandle(&comp_handle, m_dev_handle));
  19. m_handle_atlas = Handle::make(comp_handle);
  20. megdnn_assert(m_handle_atlas);
  21. }
  22. Handle* ATLAS::handle_naive() {
  23. if (!m_handle_naive)
  24. m_handle_naive = create_cpu_handle(2);
  25. return m_handle_naive.get();
  26. }
  27. void ATLAS::TearDown() {
  28. m_handle_naive.reset();
  29. m_handle_atlas.reset();
  30. MemoryManagerHolder::instance()->clear();
  31. megcoreDeactivate(m_dev_handle);
  32. }
  33. // vim: syntax=cpp.doxygen