Skip to content

Commit f7a12af

Browse files
committed
fix factor of 16384 bug
Signed-off-by: Steven Hahn <hahnse@ornl.gov>
1 parent b59d12b commit f7a12af

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

bin/cuda/gpu_benchmark.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ float getElapsedTime(const cudaEvent_t &gpu_start, cudaEvent_t &gpu_stop) {
2929
// Function to run the GPU benchmark with no time limit
3030
void runBenchmark(long max_work) {
3131
uint32_t n = 256 * 256;
32-
uint64_t m = max_work * 16384 / n;
32+
uint64_t m = (max_work + n - 1) / n;
3333

3434
unsigned long long int *d_count;
3535
curandState *d_state;
@@ -88,7 +88,7 @@ void runBenchmark(long max_work) {
8888
void runBenchmarkTime(long max_work, int runtime_in_seconds) {
8989

9090
uint32_t n = 256 * 256;
91-
uint64_t m = max_work * 16384 / n;
91+
uint64_t m = (max_work + n - 1) / n;
9292

9393
// allocate memory
9494
unsigned long long int *d_count;

bin/hip/gpu_benchmark.hip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ float getElapsedTime(const hipEvent_t &gpu_start, hipEvent_t &gpu_stop) {
2727
// Function to run the GPU benchmark with no time limit
2828
void runBenchmark(long max_work) {
2929
uint32_t n = 256 * 256;
30-
uint64_t m = max_work * 16384 / n;
30+
uint64_t m = (max_work + n - 1) / n;
3131

3232
unsigned long long int *d_count;
3333
hiprandState *d_state;
@@ -86,7 +86,7 @@ void runBenchmark(long max_work) {
8686
void runBenchmarkTime(long max_work, int runtime_in_seconds) {
8787

8888
uint32_t n = 256 * 256;
89-
uint64_t m = max_work * 16384 / n;
89+
uint64_t m = (max_work + n - 1) / n;
9090

9191
// allocate memory
9292
unsigned long long int *d_count;

0 commit comments

Comments
 (0)