1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP
12 #define BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP
14 #include <boost/compute/device.hpp>
16 #ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT
17 #include <boost/compute/detail/cl_versions.hpp>
18 #include <CL/cl_ext.h>
25 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
26 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
28 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
31 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
32 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
34 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
37 inline void get_nvidia_compute_capability(const device &device, int &major, int &minor)
39 if(!device.supports_extension("cl_nv_device_attribute_query")){
44 major = device.get_info<uint_>(BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV);
45 minor = device.get_info<uint_>(BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV);
48 inline bool check_nvidia_compute_capability(const device &device, int major, int minor)
50 int actual_major, actual_minor;
51 get_nvidia_compute_capability(device, actual_major, actual_minor);
53 return actual_major > major ||
54 (actual_major == major && actual_minor >= minor);
57 } // end detail namespace
58 } // end compute namespace
59 } // end boost namespace
61 #endif // BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP