]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/include/boost/compute/detail/nvidia_compute_capability.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / detail / nvidia_compute_capability.hpp
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
11 #ifndef BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP
12 #define BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP
13
14 #include <boost/compute/device.hpp>
15
16 #ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT
17 #include <CL/cl_ext.h>
18 #endif
19
20 namespace boost {
21 namespace compute {
22 namespace detail {
23
24 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
25 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
26 #else
27 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
28 #endif
29
30 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
31 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
32 #else
33 #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
34 #endif
35
36 inline void get_nvidia_compute_capability(const device &device, int &major, int &minor)
37 {
38 if(!device.supports_extension("cl_nv_device_attribute_query")){
39 major = minor = 0;
40 return;
41 }
42
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);
45 }
46
47 inline bool check_nvidia_compute_capability(const device &device, int major, int minor)
48 {
49 int actual_major, actual_minor;
50 get_nvidia_compute_capability(device, actual_major, actual_minor);
51
52 return actual_major > major ||
53 (actual_major == major && actual_minor >= minor);
54 }
55
56 } // end detail namespace
57 } // end compute namespace
58 } // end boost namespace
59
60 #endif // BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP