exec_policy.hpp
前往此文件的文档。
1 /*
2  * Copyright (c) 2020-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  * https://apache.ac.cn/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 
22 #pragma once
23 
24 #include <rmm/cuda_stream_view.hpp>
25 #include <rmm/detail/export.hpp>
26 #include <rmm/detail/thrust_namespace.h>
28 #include <rmm/resource_ref.hpp>
29 
30 #include <thrust/system/cuda/execution_policy.h>
31 #include <thrust/version.h>
32 
33 namespace RMM_NAMESPACE {
44  thrust::detail::execute_with_allocator<mr::thrust_allocator<char>,
45  thrust::cuda_cub::execute_on_stream_base>;
46 
52  public
62  thrust::cuda::par(mr::thrust_allocator<char>(stream, mr)).on(stream.value()))
63  {
64  }
65 };
66 
67 #if THRUST_VERSION >= 101600
68 
73  thrust::detail::execute_with_allocator<mr::thrust_allocator<char>,
74  thrust::cuda_cub::execute_on_stream_nosync_base>;
82  public
83  explicit exec_policy_nosync(cuda_stream_view stream = cuda_stream_default,
86  thrust::cuda::par_nosync(mr::thrust_allocator<char>(stream, mr)).on(stream.value()))
87  {
88  }
89 };
90 
91 #else
92 
98 #endif
99  // end of group
101 } // namespace RMM_NAMESPACE
用于 CUDA 流的强类型非拥有包装器,带默认构造函数。
定义: cuda_stream_view.hpp:39
可用作 Thrust CUDA 执行策略的辅助类,它使用 RMM 进行临时内存分配或...
定义: exec_policy.hpp:51
exec_policy(cuda_stream_view stream=cuda_stream_default, device_async_resource_ref mr=mr::get_current_device_resource_ref())
构造新的执行策略对象。
定义: exec_policy.hpp:59
static constexpr cuda_stream_view cuda_stream_default
默认流(流 0)的静态 cuda_stream_view,方便使用。
定义: cuda_stream_view.hpp:125
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
带有属性 cuda::mr::device_accessible 的 cuda::mr::async_resource_ref 的别名。
定义: resource_ref.hpp:40
device_async_resource_ref get_current_device_resource_ref()
获取当前设备的 device_async_resource_ref。
定义: per_device_resource.hpp:411
thrust_exec_policy_t thrust_exec_policy_nosync_t
定义: exec_policy.hpp:95
thrust::detail::execute_with_allocator< mr::thrust_allocator< char >, thrust::cuda_cub::execute_on_stream_base > thrust_exec_policy_t
使用 thrust 进行分配的同步执行策略。
定义: exec_policy.hpp:45
exec_policy exec_policy_nosync
当与 Thrust < 1.16.0 一起使用时,exec_policy_nosync 是 exec_policy 的别名。
定义: exec_policy.hpp:97