All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
resource_ref.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <rmm/detail/error.hpp>
19 #include <rmm/detail/export.hpp>
20 
21 #include <cuda/memory_resource>
22 
23 namespace RMM_NAMESPACE {
24 
35 using device_resource_ref = cuda::mr::resource_ref<cuda::mr::device_accessible>;
36 
41 using device_async_resource_ref = cuda::mr::async_resource_ref<cuda::mr::device_accessible>;
42 
47 using host_resource_ref = cuda::mr::resource_ref<cuda::mr::host_accessible>;
48 
53 using host_async_resource_ref = cuda::mr::async_resource_ref<cuda::mr::host_accessible>;
54 
60  cuda::mr::resource_ref<cuda::mr::host_accessible, cuda::mr::device_accessible>;
61 
67  cuda::mr::async_resource_ref<cuda::mr::host_accessible, cuda::mr::device_accessible>;
68 
78 template <class Resource>
80 {
81  RMM_EXPECTS(res, "Unexpected null resource pointer.");
82  return device_async_resource_ref{*res};
83 }
84  // end of group
86 } // namespace RMM_NAMESPACE
cuda::mr::resource_ref< cuda::mr::host_accessible > host_resource_ref
Alias for a cuda::mr::resource_ref with the property cuda::mr::host_accessible.
Definition: resource_ref.hpp:47
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
Alias for a cuda::mr::async_resource_ref with the property cuda::mr::device_accessible.
Definition: resource_ref.hpp:41
cuda::mr::async_resource_ref< cuda::mr::host_accessible > host_async_resource_ref
Alias for a cuda::mr::async_resource_ref with the property cuda::mr::host_accessible.
Definition: resource_ref.hpp:53
cuda::mr::async_resource_ref< cuda::mr::host_accessible, cuda::mr::device_accessible > host_device_async_resource_ref
Alias for a cuda::mr::async_resource_ref with the properties cuda::mr::host_accessible and cuda::mr::...
Definition: resource_ref.hpp:67
cuda::mr::resource_ref< cuda::mr::host_accessible, cuda::mr::device_accessible > host_device_resource_ref
Alias for a cuda::mr::resource_ref with the properties cuda::mr::host_accessible and cuda::mr::device...
Definition: resource_ref.hpp:60
cuda::mr::resource_ref< cuda::mr::device_accessible > device_resource_ref
Alias for a cuda::mr::resource_ref with the property cuda::mr::device_accessible.
Definition: resource_ref.hpp:35
device_async_resource_ref to_device_async_resource_ref_checked(Resource *res)
Convert pointer to memory resource into device_async_resource_ref, checking for nullptr
Definition: resource_ref.hpp:79