From 614638fc122f31fcb6c5336002dda9aca4e0acc6 Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Mon, 15 May 2023 01:09:00 +0800 Subject: feat(exp): Add visual output Signed-off-by: KunoiSayami --- expt_0510.cu | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/expt_0510.cu b/expt_0510.cu index 063c6ba..17e104d 100644 --- a/expt_0510.cu +++ b/expt_0510.cu @@ -52,8 +52,7 @@ __global__ void initNormalSample(key_type *normal_sample) { cudaNormalSampleItem = normal_sample; } -__global__ void kernel(unsigned long step, const double slice_size, - const unsigned long split_size) { +__global__ void kernel(unsigned long step, const double slice_size) { auto custom_sort = CustomSort(cuda_sample_length, sizeof(key_type) * 8); // printf("kernel1 step: %ld\n", step); for (int i = 0; i < step; i++) { @@ -119,7 +118,7 @@ void initCustomSampleCPU() { delete[] tmp; } -void run_kernel(size_t test_size, bool normal = true) { +void run_kernel(size_t test_size, bool custom = true) { dim3 grid_dim = 32, block_dim = 32; unsigned long step = test_size / (grid_dim.x * block_dim.x); auto scale = 2; @@ -129,8 +128,8 @@ void run_kernel(size_t test_size, bool normal = true) { cudaEventCreate(&start); cudaEventCreate(&stop); cudaEventRecord(start, nullptr); - if (normal) { - kernel<<>>(step, slice_size, split_size); + if (custom) { + kernel<<>>(step, slice_size); } else { kernel2<<>>(step, slice_size); } @@ -145,7 +144,7 @@ void run_kernel(size_t test_size, bool normal = true) { if (time == 0) { // printf("last error: %u\n", cudaGetLastError()); } - printf("time: %lf\n", time); + printf("%stime: %lf ", custom ? "custom " : "", time); cudaDeviceSynchronize(); print_function<<<1, 1>>>(); @@ -199,7 +198,7 @@ int main(int argc, char const *argv[]) { read_file("normal_distribution.txt", test_size); - printf("population: %zu, test size: %zu, sample length: %zu\n", + printf("population: %zu, test size: %zu, sample length: %zu | ", population_vector.size(), test_size, sample_length); sample_vector = std::vector( @@ -248,6 +247,7 @@ int main(int argc, char const *argv[]) { run_kernel(test_size, false); // check_items<<<1, 1>>>(); // cudaDeviceSynchronize(); + puts(""); freeStorageStage2<<<1, 1>>>(); cudaDeviceSynchronize(); -- cgit v1.3.1