Extended CUDA Library (ecuda)
2.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Macros
include
ecuda
memory.hpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 2014-2016, Scott Zuyderduyn
3
All rights reserved.
4
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions are met:
7
8
1. Redistributions of source code must retain the above copyright notice, this
9
list of conditions and the following disclaimer.
10
2. Redistributions in binary form must reproduce the above copyright notice,
11
this list of conditions and the following disclaimer in the documentation
12
and/or other materials provided with the distribution.
13
14
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25
The views and conclusions contained in the software and documentation are those
26
of the authors and should not be interpreted as representing official policies,
27
either expressed or implied, of the FreeBSD Project.
28
*/
29
30
//----------------------------------------------------------------------------
31
// memory.hpp
32
//
33
// CUDA implementations from STL header <memory> and additional helper
34
// templates and functions for compile-time manipulation of the ecuda
35
// pointer specializations.
36
//
37
// Author: Scott D. Zuyderduyn, Ph.D. (scott.zuyderduyn@utoronto.ca)
38
//----------------------------------------------------------------------------
39
40
#ifndef ECUDA_DEVICE_PTR_HPP
41
#define ECUDA_DEVICE_PTR_HPP
42
43
#include "
global.hpp
"
44
45
/*
46
#ifdef ECUDA_CPP11_AVAILABLE
47
#include <memory>
48
#else
49
50
namespace std {
51
52
template<class Alloc>
53
struct allocator_traits {
54
typedef Alloc allocator_type;
55
typedef typename Alloc::value_type value_type;
56
typedef typename Alloc::pointer pointer;
57
typedef typename Alloc::const_pointer const_pointer;
58
typedef void* void_pointer;
59
typedef const void* const_void_pointer;
60
typedef typename Alloc::difference_type difference_type;
61
typedef typename Alloc::size_type size_type;
62
//propagate_on_container_copy_assignment
63
//TODO: finish this
64
static __HOST__ __DEVICE__ allocator_type select_on_container_copy_construction( const allocator_type& alloc ) { return alloc; }
65
};
66
67
} // namespace std
68
69
#endif
70
*/
71
90
91
// #include "ptr/naked_ptr.hpp" // deprecated
92
#include "
ptr/padded_ptr.hpp
"
93
#include "
ptr/shared_ptr.hpp
"
94
#include "
ptr/striding_ptr.hpp
"
95
#include "
ptr/unique_ptr.hpp
"
96
#include "
ptr/striding_padded_ptr.hpp
"
97
98
namespace
ecuda {
99
100
template
<
typename
T>
struct
owner_less
;
101
114
template
<
typename
T>
115
struct
owner_less
<
shared_ptr
<T> >
116
{
117
typedef
bool
result_type
;
118
typedef
shared_ptr<T>
first_argument_type
;
119
typedef
shared_ptr<T>
second_argument_type
;
126
__HOST__
__DEVICE__
inline
bool
operator()
(
const
shared_ptr<T>
& lhs,
const
shared_ptr<T>
& rhs )
const
{
return
lhs.
owner_before
(rhs); }
127
};
128
129
}
// namespace ecuda
130
131
132
#endif
ecuda::shared_ptr
A smart pointer that retains shared ownership of an object in device memory.
Definition:
shared_ptr.hpp:122
ecuda::owner_less
Definition:
memory.hpp:100
ecuda::shared_ptr::owner_before
__HOST__ __DEVICE__ bool owner_before(const shared_ptr< U > &other) const
Definition:
shared_ptr.hpp:473
striding_ptr.hpp
ecuda::owner_less< shared_ptr< T > >::result_type
bool result_type
Definition:
memory.hpp:117
__HOST__
#define __HOST__
Definition:
global.hpp:150
shared_ptr.hpp
unique_ptr.hpp
striding_padded_ptr.hpp
ecuda::owner_less< shared_ptr< T > >::second_argument_type
shared_ptr< T > second_argument_type
Definition:
memory.hpp:119
ecuda::owner_less< shared_ptr< T > >::first_argument_type
shared_ptr< T > first_argument_type
Definition:
memory.hpp:118
global.hpp
padded_ptr.hpp
ecuda::owner_less< shared_ptr< T > >::operator()
__HOST__ __DEVICE__ bool operator()(const shared_ptr< T > &lhs, const shared_ptr< T > &rhs) const
Compares lhs and rhs using owner-based semantics.
Definition:
memory.hpp:126
__DEVICE__
#define __DEVICE__
Definition:
global.hpp:151
Generated on Thu Jan 28 2016 14:05:58 for Extended CUDA Library (ecuda) by
1.8.6