]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/compute/test/test_device.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / compute / test / test_device.cpp
index 871a9b812e82998d96924eaec077a5798c57c43d..164e3f781e3ee25c4716a58fab537101b14dd957 100644 (file)
@@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(get_max_work_item_sizes)
     BOOST_CHECK_GE(max_work_item_sizes[2], size_t(1));
 }
 
-#ifdef CL_VERSION_1_2
+#ifdef BOOST_COMPUTE_CL_VERSION_1_2
 
 // returns true if the device supports the partitioning type
 bool supports_partition_type(const boost::compute::device &device,
@@ -111,10 +111,10 @@ BOOST_AUTO_TEST_CASE(partition_device_equally)
     // ensure device is not a sub-device
     BOOST_CHECK(device.is_subdevice() == false);
 
-    // partition default device into sub-devices with two compute units each
+    // partition default device into sub-devices with one compute unit each
     std::vector<boost::compute::device>
-        sub_devices = device.partition_equally(2);
-    BOOST_CHECK_EQUAL(sub_devices.size(), size_t(device.compute_units() / 2));
+        sub_devices = device.partition_equally(1);
+    BOOST_CHECK_EQUAL(sub_devices.size(), size_t(device.compute_units()));
 
     // verify each of the sub-devices
     for(size_t i = 0; i < sub_devices.size(); i++){
@@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(partition_device_equally)
         BOOST_CHECK(sub_device.is_subdevice() == true);
 
         // check number of compute units
-        BOOST_CHECK_EQUAL(sub_device.compute_units(), size_t(2));
+        BOOST_CHECK_EQUAL(sub_device.compute_units(), size_t(1));
     }
 }
 
@@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(partition_by_affinity_domain)
     BOOST_CHECK(sub_devices.size() > 0);
     BOOST_CHECK(sub_devices[0].is_subdevice() == true);
 }
-#endif // CL_VERSION_1_2
+#endif // BOOST_COMPUTE_CL_VERSION_1_2
 
 BOOST_AUTO_TEST_CASE(nvidia_compute_capability)
 {
@@ -232,3 +232,54 @@ BOOST_AUTO_TEST_CASE(get_info_specializations)
 
     std::cout << device.get_info<CL_DEVICE_NAME>() << std::endl;
 }
+
+#ifdef BOOST_COMPUTE_CL_VERSION_2_1
+BOOST_AUTO_TEST_CASE(get_host_timer)
+{
+    boost::compute::device device = boost::compute::system::default_device();
+    BOOST_CHECK(device.get_host_timer() != 0);
+
+    #ifndef BOOST_COMPUTE_NO_HDR_CHRONO
+    typedef std::chrono::milliseconds stdms;
+    BOOST_CHECK(device.get_host_timer<stdms>().count() != 0);
+    #endif
+
+    #ifndef BOOST_COMPUTE_NO_BOOST_CHRONO
+    typedef boost::chrono::milliseconds bms;
+    BOOST_CHECK(device.get_host_timer<bms>().count() != 0);
+    #endif
+}
+
+BOOST_AUTO_TEST_CASE(get_device_and_host_timer)
+{
+    boost::compute::device device = boost::compute::system::default_device();
+    typedef std::pair<boost::compute::ulong_, boost::compute::ulong_> dah_timer;
+    dah_timer timer;
+    BOOST_CHECK_NO_THROW(timer = device.get_device_and_host_timer());
+    BOOST_CHECK(timer.first != 0);
+    BOOST_CHECK(timer.second != 0);
+
+    #ifndef BOOST_COMPUTE_NO_HDR_CHRONO
+    typedef std::chrono::milliseconds stdms;
+    BOOST_CHECK(device.get_device_and_host_timer<stdms>().first.count() != 0);
+    BOOST_CHECK(device.get_device_and_host_timer<stdms>().second.count() != 0);
+    #endif
+
+    #ifndef BOOST_COMPUTE_NO_BOOST_CHRONO
+    typedef boost::chrono::milliseconds bms;
+    BOOST_CHECK(device.get_device_and_host_timer<bms>().first.count() != 0);
+    BOOST_CHECK(device.get_device_and_host_timer<bms>().second.count() != 0);
+    #endif
+}
+
+BOOST_AUTO_TEST_CASE(get_info_opencl21_queries)
+{
+    boost::compute::device device = boost::compute::system::default_device();
+
+    BOOST_CHECK(!device.get_info<CL_DEVICE_IL_VERSION>().empty());
+    BOOST_CHECK(device.get_info<CL_DEVICE_MAX_NUM_SUB_GROUPS>() > 0);
+    BOOST_CHECK_NO_THROW(
+        device.get_info<CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS>()
+    );
+}
+#endif // BOOST_COMPUTE_CL_VERSION_2_1