2
* Copyright 2008-2011 NVIDIA Corporation
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
34
template<typename InputType,
35
typename InputIterator,
36
typename AssociativeOperator>
38
InputType scan(const unsigned int thread_lane, InputType val, InputIterator sdata, AssociativeOperator binary_op)
40
sdata[threadIdx.x] = val;
42
if (thread_lane >= 1) sdata[threadIdx.x] = val = binary_op(sdata[threadIdx.x - 1], val);
43
if (thread_lane >= 2) sdata[threadIdx.x] = val = binary_op(sdata[threadIdx.x - 2], val);
44
if (thread_lane >= 4) sdata[threadIdx.x] = val = binary_op(sdata[threadIdx.x - 4], val);
45
if (thread_lane >= 8) sdata[threadIdx.x] = val = binary_op(sdata[threadIdx.x - 8], val);
46
if (thread_lane >= 16) sdata[threadIdx.x] = val = binary_op(sdata[threadIdx.x - 16], val);
51
} // end namespace warp
53
} // end namespace cuda
55
} // end namespace device
57
} // end namespace detail
59
} // end namespace thrust