Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 46 additions & 9 deletions examples/resample_poly_bench.cu
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ using namespace matx;
// length, input signal length, up/down factors) will be adjusted to a range of interest
// and the benchmark will be run with and without the proposed kernel changes.

constexpr int NUM_WARMUP_ITERATIONS = 2;
constexpr int NUM_WARMUP_ITERATIONS = 10;

// Number of iterations per timed test. Iteration times are averaged in the report.
constexpr int NUM_ITERATIONS = 20;
Expand All @@ -61,29 +61,60 @@ void ResamplePolyBench()
matx::index_t down;
} test_cases[] = {
{ 1, 256, 384, 3125 },
{ 1, 256, 384, 175 },
{ 1, 256, 4, 5 },
{ 1, 256, 1, 4 },
{ 1, 256, 1, 16 },
{ 1, 3000, 384, 3125 },
{ 1, 3000, 384, 175 },
{ 1, 3000, 4, 5 },
{ 1, 3000, 1, 4 },
{ 1, 3000, 1, 16 },
{ 1, 31000, 384, 3125 },
{ 1, 31000, 384, 175 },
{ 1, 31000, 4, 5 },
{ 1, 31000, 1, 4 },
{ 1, 31000, 1, 16 },
{ 1, 256000, 384, 3125 },
{ 1, 256000, 384, 175 },
{ 1, 256000, 64, 37 },
{ 1, 256000, 2, 3 },
{ 1, 256000, 4, 5 },
{ 1, 256000, 7, 64 },
{ 1, 256000, 7, 128 },
{ 1, 256000, 1, 4 },
{ 1, 256000, 1, 8 },
{ 1, 256000, 1, 16 },
{ 1, 256000, 1, 64 },
{ 1, 256000, 4, 1 },
{ 1, 256000, 8, 1 },
{ 1, 256000, 16, 1 },
{ 1, 256000, 64, 1 },
{ 1, 256000, 4, 1 },
{ 1, 256000, 8, 1 },
{ 1, 256000, 16, 1 },
{ 42, 256000, 384, 3125 },
{ 42, 256000, 384, 175 },
{ 42, 256000, 2, 3 },
{ 42, 256000, 4, 5 },
{ 42, 256000, 1, 4 },
{ 42, 256000, 1, 8 },
{ 42, 256000, 1, 16 },
{ 128, 256000, 384, 3125 },
{ 128, 256000, 4, 5 },
{ 128, 256000, 1, 4 },
{ 128, 256000, 1, 16 },
{ 42, 256000, 1, 64 },
{ 1, 100000000, 384, 3125 },
{ 1, 100000000, 384, 175 },
{ 1, 100000000, 2, 3 },
{ 1, 100000000, 4, 5 },
{ 1, 100000000, 7, 64 },
{ 1, 100000000, 7, 128 },
{ 1, 100000000, 1, 2 },
{ 1, 100000000, 1, 4 },
{ 1, 100000000, 1, 8 },
{ 1, 100000000, 1, 16 },
{ 1, 100000000, 1, 192 },
{ 1, 100000000, 4, 1 },
{ 1, 100000000, 8, 1 },
{ 1, 100000000, 16, 1 },
};

cudaStream_t stream;
Expand All @@ -104,9 +135,14 @@ void ResamplePolyBench()
const index_t up_len = input_len * up;
const index_t output_len = up_len / down + ((up_len % down) ? 1 : 0);

auto input = matx::make_tensor<InType, 2>({num_batches, input_len});
auto filter = matx::make_tensor<InType, 1>({filter_len});
auto output = matx::make_tensor<InType, 2>({num_batches, output_len});
auto input = matx::make_tensor<InType, 2>({num_batches, input_len}, MATX_DEVICE_MEMORY);
auto filter = matx::make_tensor<InType, 1>({filter_len}, MATX_DEVICE_MEMORY);
auto output = matx::make_tensor<InType, 2>({num_batches, output_len}, MATX_DEVICE_MEMORY);

(input = static_cast<InType>(1.0)).run(stream);
(filter = static_cast<InType>(1.0)).run(stream);

cudaStreamSynchronize(stream);

for (int k = 0; k < NUM_WARMUP_ITERATIONS; k++) {
(output = matx::resample_poly(input, filter, up, down)).run(stream);
Expand All @@ -126,7 +162,8 @@ void ResamplePolyBench()

const double gflops = static_cast<double>(num_batches*(2*filter_len_per_phase-1)*output_len) / 1.0e9;
const double avg_elapsed_us = (static_cast<double>(elapsed_ms)/NUM_ITERATIONS)*1.0e3;
printf("Batches: %5lld FilterLen: %5lld InputLen: %7lld OutputLen: %7lld Up/Down: %4lld/%4lld Elapsed Usecs: %12.1f GFLOPS: %10.3f\n",
printf("Batches: %5" INDEX_T_FMT " FilterLen: %5" INDEX_T_FMT " InputLen: %9" INDEX_T_FMT " OutputLen: %8" INDEX_T_FMT
" Up/Down: %4" INDEX_T_FMT "/%4" INDEX_T_FMT " Elapsed Usecs: %12.1f GFLOPS: %10.3f\n",
num_batches, filter_len, input_len, output_len, up, down, avg_elapsed_us, gflops/(avg_elapsed_us/1.0e6));
}

Expand Down
Loading