栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

CUDA初学者-Thrust - Memory Management(13)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CUDA初学者-Thrust - Memory Management(13)

本人 CUDA小白一枚,要是有什么不对,还望各位大佬指点。
本文及后面的几篇将分别从几个方面来大概阐述一下Thrust的一些接口。原来的网址在这里

6.Memory manage

6.1 Allocators

template 
class thrust::device_ptr_memory_resource;


template 
class thrust::device_allocator;

template 
class thrust::device_malloc_allocator;

template 
class thrust::device_new_allocator;

template 
class thrust::mr::allocator;

template 
class thrust::mr::stateless_resource_allocator;

template 
using thrust::mr::polymorphic_allocator = see below;

template 
__host__ __device__ bool
thrust::mr::operator==(const allocator< T, MR > & lhs,
  const allocator< T, MR > & rhs);

template 
__host__ __device__ bool
thrust::mr::operator!=(const allocator< T, MR > & lhs,
  const allocator< T, MR > & rhs);

6.2 Memory Resources

template 
class thrust::mr::disjoint_unsynchronized_pool_resource;

template 
struct thrust::mr::disjoint_synchronized_pool_resource;

template 
class thrust::mr::memory_resource;

class thrust::mr::memory_resource< void * >;

class thrust::mr::new_delete_resource;

template 
class thrust::mr::unsynchronized_pool_resource;

struct thrust::mr::pool_options;

template 
struct thrust::mr::synchronized_pool_resource;

6.3 device_ptr

template 
class thrust::device_reference;


template 
class thrust::device_ptr;

// 删除 device_reference
template 
void thrust::device_delete(thrust::device_ptr< T > ptr,
  const size_t n = 1);

// 释放 device_reference
void thrust::device_free(thrust::device_ptr< void > ptr);

// malloc device_reference   与   device_free
thrust::device_ptr< void >
thrust::device_malloc(const std::size_t n);

// malloc device_reference    与   device_free
template 
thrust::device_ptr< T >
thrust::device_malloc(const std::size_t n);

// new device_reference    与  device_delete
template 
device_ptr< T > thrust::device_new(
	device_ptr< void > p,
  	const size_t n = 1);

// new device_reference    与  device_delete
template 
device_ptr< T > thrust::device_new(
	device_ptr< void > p,
  	const T & exemplar,
  	const size_t n = 1);

template 
device_ptr< T > thrust::device_new(const size_t n = 1);

template 
__host__ std::basic_ostream< CharT, Traits > &
thrust::operator<<(std::basic_ostream< CharT, Traits > & os,
  device_ptr< T > const & dp);

// 类型转换
template 
__host__ __device__ device_ptr< T >
thrust::device_pointer_cast(T * ptr);

// 类型转换
template 
__host__ __device__ device_ptr< T >
thrust::device_pointer_cast(device_ptr< T > const & dptr);

// 元素交换
template 
__host__ __device__ void
thrust::swap(
	device_reference< T > & x,
  	device_reference< T > & y);

template 
std::basic_ostream< charT, traits > &
thrust::operator<<(std::basic_ostream< charT, traits > & os,
  const device_reference< T > & y);

// malloc
template 
__host__ __device__ pointer< void, DerivedPolicy >
thrust::malloc(
	const thrust::detail::execution_policy_base< DerivedPolicy > & system,
  	std::size_t n);

// malloc
template 
__host__ __device__ pointer< T, DerivedPolicy >
thrust::malloc(
	const thrust::detail::execution_policy_base< DerivedPolicy > & system,
  	std::size_t n);

template 
__host__ __device__ thrust::pair< thrust::pointer< T, DerivedPolicy >, typename thrust::pointer< T, DerivedPolicy >::difference_type >
thrust::get_temporary_buffer(
	const thrust::detail::execution_policy_base< DerivedPolicy > & system,
  	typename thrust::pointer< T, DerivedPolicy >::difference_type n);

// free 与 malloc 对应
template 
__host__ __device__ void
thrust::free(
	const thrust::detail::execution_policy_base< DerivedPolicy > & system,
  	Pointer ptr);

template 
__host__ __device__ void
thrust::return_temporary_buffer(
	const thrust::detail::execution_policy_base< DerivedPolicy > & system,
  	Pointer p,
  	std::ptrdiff_t n);

template 
__host__ __device__ thrust::detail::pointer_traits< Pointer >::raw_pointer
thrust::raw_pointer_cast(Pointer ptr);

template 
__host__ __device__ detail::raw_reference< T >::type
thrust::raw_reference_cast(T & ref);

template 
__host__ __device__ detail::raw_reference< constT >::type
thrust::raw_reference_cast(const T & ref);
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/926280.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号