memory_limits.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
  3. //
  4. // Distributed under the Boost Software License, Version 1.0
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. //
  8. // See http://boostorg.github.com/compute for more information.
  9. //---------------------------------------------------------------------------//
  10. #include <iostream>
  11. #include <boost/compute/core.hpp>
  12. namespace compute = boost::compute;
  13. int main()
  14. {
  15. // get the default device
  16. compute::device device = compute::system::default_device();
  17. std::cout << "device: " << device.name() << std::endl;
  18. std::cout << " global memory size: "
  19. << device.get_info<cl_ulong>(CL_DEVICE_GLOBAL_MEM_SIZE) / 1024 / 1024
  20. << " MB"
  21. << std::endl;
  22. std::cout << " local memory size: "
  23. << device.get_info<cl_ulong>(CL_DEVICE_LOCAL_MEM_SIZE) / 1024
  24. << " KB"
  25. << std::endl;
  26. std::cout << " constant memory size: "
  27. << device.get_info<cl_ulong>(CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024
  28. << " KB"
  29. << std::endl;
  30. return 0;
  31. }