OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / thrust / system / detail / generic / memory.inl
1 /*
2  *  Copyright 2008-2013 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
17 #include <thrust/detail/config.h>
18 #include <thrust/detail/type_traits/pointer_traits.h>
19 #include <thrust/system/detail/generic/memory.h>
20 #include <thrust/system/detail/generic/select_system.h>
21 #include <thrust/system/detail/adl/malloc_and_free.h>
22 #include <thrust/detail/static_assert.h>
23 #include <thrust/detail/malloc_and_free.h>
24
25 namespace thrust
26 {
27 namespace system
28 {
29 namespace detail
30 {
31 namespace generic
32 {
33
34
35 template<typename DerivedPolicy, typename Size>
36   void malloc(thrust::execution_policy<DerivedPolicy> &, Size)
37 {
38   // unimplemented
39   THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Size, false>::value) );
40 }
41
42
43 template<typename T, typename DerivedPolicy>
44   thrust::pointer<T,DerivedPolicy>
45     malloc(thrust::execution_policy<DerivedPolicy> &exec, std::size_t n)
46 {
47   thrust::pointer<void,DerivedPolicy> void_ptr = thrust::malloc(exec, sizeof(T) * n);
48
49   return pointer<T,DerivedPolicy>(static_cast<T*>(void_ptr.get()));
50 } // end malloc()
51
52
53 template<typename DerivedPolicy, typename Pointer>
54   void free(thrust::execution_policy<DerivedPolicy> &, Pointer)
55 {
56   // unimplemented
57   THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer, false>::value) );
58 }
59
60
61 template<typename DerivedPolicy, typename Pointer1, typename Pointer2>
62 __host__ __device__
63 void assign_value(thrust::execution_policy<DerivedPolicy> &, Pointer1, Pointer2)
64 {
65   // unimplemented
66   THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer1, false>::value) );
67 }
68
69
70 template<typename DerivedPolicy, typename Pointer>
71 __host__ __device__
72 void get_value(thrust::execution_policy<DerivedPolicy> &, Pointer)
73 {
74   // unimplemented
75   THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer, false>::value) );
76 }
77
78
79 template<typename Pointer1, typename Pointer2>
80 __host__ __device__
81 void iter_swap(tag, Pointer1, Pointer2)
82 {
83   // unimplemented
84   THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<Pointer1, false>::value) );
85 }
86
87
88 } // end generic
89 } // end detail
90 } // end system
91 } // end thrust
92