Skip to content

Commit

Permalink
CUB operators (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffburdick authored Mar 24, 2022
1 parent d1d5feb commit 9e9c5c2
Show file tree
Hide file tree
Showing 18 changed files with 733 additions and 474 deletions.
4 changes: 2 additions & 2 deletions bench/00_operators/reduction.cu
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ void reduce_0d_cub(nvbench::state &state, nvbench::type_list<ValueType>)
auto xv2 = make_tensor<ValueType>();
xv.PrefetchDevice(0);

cub_reduce<decltype(xv2), decltype(xv), CustomSum>(xv2, xv, 0.0f, 0);
sum(xv2, xv, 0);

state.exec(
[&xv, &xv2](nvbench::launch &launch) {
cub_reduce<decltype(xv2), decltype(xv), CustomSum>(xv2, xv, 0.0f, (cudaStream_t)launch.get_stream());
sum(xv2, xv, (cudaStream_t)launch.get_stream());
});

}
Expand Down
8 changes: 4 additions & 4 deletions examples/convolution.cu
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
using FilterType = float;

// Create data objects
auto inView = make_static_tensor<InType, batches, numSamples>();
auto outView = make_static_tensor<OutType, batches, numSamples + filterLen - 1>();
auto solView = make_static_tensor<InType, batches, numSamples + filterLen - 1>();
auto inView = make_tensor<InType>({batches, numSamples});
auto outView = make_tensor<OutType>({batches, numSamples + filterLen - 1});
auto solView = make_tensor<InType>({batches, numSamples + filterLen - 1});
auto filterView = make_tensor<FilterType>({filterLen});

auto filterView = make_static_tensor<FilterType, filterLen >();

// initialize input data
for (index_t b = 0; b < batches; b++) {
Expand Down
14 changes: 7 additions & 7 deletions examples/spectrogram.cu
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
std::array<index_t, 1> half_win{nfft / 2 + 1};
std::array<index_t, 1> s_time_shape{(N - noverlap) / nstep};

auto time = make_static_tensor<float, N>();
auto modulation = make_static_tensor<float, N>();
auto carrier = make_static_tensor<float, N>();
auto noise = make_static_tensor<float, N>();
auto x = make_static_tensor<float, N>();
auto time = make_tensor<float>({N});
auto modulation = make_tensor<float>({N});
auto carrier = make_tensor<float>({N});
auto noise = make_tensor<float>({N});
auto x = make_tensor<float>({N});

auto freqs = make_static_tensor<float, nfft / 2 + 1>();
auto freqs = make_tensor<float>({nfft / 2 + 1});
auto fftStackedMatrix = make_tensor<complex>({(N - noverlap) / nstep, nfft / 2 + 1});
auto s_time = make_static_tensor<float,(N - noverlap) / nstep>();
auto s_time = make_tensor<float>({(N - noverlap) / nstep});

randomGenerator_t<float> randData({N}, 0);
auto randDataView = randData.GetTensorView<1>(num_samps, NORMAL);
Expand Down
Loading

0 comments on commit 9e9c5c2

Please sign in to comment.