Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:46

0001 #include "catch.hpp"
0002 
0003 #include "HeterogeneousCore/CUDAUtilities/interface/host_noncached_unique_ptr.h"
0004 #include "HeterogeneousCore/CUDAUtilities/interface/requireDevices.h"
0005 
0006 TEST_CASE("host_noncached_unique_ptr", "[cudaMemTools]") {
0007   if (not cms::cudatest::testDevices()) {
0008     return;
0009   }
0010 
0011   SECTION("Single element") {
0012     auto ptr1 = cms::cuda::make_host_noncached_unique<int>();
0013     REQUIRE(ptr1 != nullptr);
0014     auto ptr2 = cms::cuda::make_host_noncached_unique<int>(cudaHostAllocPortable | cudaHostAllocWriteCombined);
0015     REQUIRE(ptr2 != nullptr);
0016   }
0017 
0018   SECTION("Multiple elements") {
0019     auto ptr1 = cms::cuda::make_host_noncached_unique<int[]>(10);
0020     REQUIRE(ptr1 != nullptr);
0021     auto ptr2 = cms::cuda::make_host_noncached_unique<int[]>(10, cudaHostAllocPortable | cudaHostAllocWriteCombined);
0022     REQUIRE(ptr2 != nullptr);
0023   }
0024 }