vendor.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifndef BOOST_COMPUTE_DETAIL_VENDOR_HPP
  11. #define BOOST_COMPUTE_DETAIL_VENDOR_HPP
  12. #include <boost/compute/device.hpp>
  13. #include <boost/compute/platform.hpp>
  14. namespace boost {
  15. namespace compute {
  16. namespace detail {
  17. // returns true if the device is an nvidia gpu
  18. inline bool is_nvidia_device(const device &device)
  19. {
  20. std::string nvidia("NVIDIA");
  21. return device.vendor().compare(0, nvidia.size(), nvidia) == 0;
  22. }
  23. // returns true if the device is an amd cpu or gpu
  24. inline bool is_amd_device(const device &device)
  25. {
  26. return device.platform().vendor() == "Advanced Micro Devices, Inc.";
  27. }
  28. // returns true if the platform is Apple OpenCL platform
  29. inline bool is_apple_platform(const platform &platform)
  30. {
  31. return platform.name() == "Apple";
  32. }
  33. // returns true if the device is from Apple OpenCL Platform
  34. inline bool is_apple_platform_device(const device &device)
  35. {
  36. return is_apple_platform(device.platform());
  37. }
  38. } // end detail namespace
  39. } // end compute namespace
  40. } // end boost namespace
  41. #endif // BOOST_COMPUTE_DETAIL_VENDOR_HPP