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 <CL/cl_ext.h>
24 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
25 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
27 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
30 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
31 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
33 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
36 inline void get_nvidia_compute_capability(const device &device, int &major, int &minor)
38 if(!device.supports_extension("cl_nv_device_attribute_query")){
43 major = device.get_info<uint_>(BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV);
44 minor = device.get_info<uint_>(BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV);
47 inline bool check_nvidia_compute_capability(const device &device, int major, int minor)
49 int actual_major, actual_minor;
50 get_nvidia_compute_capability(device, actual_major, actual_minor);
52 return actual_major > major ||
53 (actual_major == major && actual_minor >= minor);
56 } // end detail namespace
57 } // end compute namespace
58 } // end boost namespace
60 #endif // BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP