Skip to content

Commit 08078ae

Browse files
authored
change random number range for fp stability (#45)
1 parent d979d5b commit 08078ae

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

drivers/cpp/benchmarks/reduce/26_reduce_product_of_inverses/cpu.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct Context {
2323
};
2424

2525
void reset(Context *ctx) {
26-
fillRand(ctx->x, 0.0, 100.0);
26+
fillRand(ctx->x, 1.0, 100.0);
2727
BCAST(ctx->x, DOUBLE);
2828
}
2929

@@ -58,7 +58,7 @@ bool validate(Context *ctx) {
5858
const size_t numTries = MAX_VALIDATION_ATTEMPTS;
5959
for (int trialIter = 0; trialIter < numTries; trialIter += 1) {
6060
// set up input
61-
fillRand(x, 0.0, 100.0);
61+
fillRand(x, 1.0, 100.0);
6262
BCAST(x, DOUBLE);
6363

6464
// compute correct result

drivers/cpp/benchmarks/reduce/26_reduce_product_of_inverses/gpu.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct Context {
2727
};
2828

2929
void reset(Context *ctx) {
30-
fillRand(ctx->h_x, 0.0, 100.0);
30+
fillRand(ctx->h_x, 1.0, 100.0);
3131
COPY_H2D(ctx->d_x, ctx->h_x.data(), ctx->N * sizeof(double));
3232

3333
double tmp = 1.0;
@@ -73,7 +73,7 @@ bool validate(Context *ctx) {
7373
const size_t numTries = MAX_VALIDATION_ATTEMPTS;
7474
for (int trialIter = 0; trialIter < numTries; trialIter += 1) {
7575
// set up input
76-
fillRand(h_x, 0.0, 100.0);
76+
fillRand(h_x, 1.0, 100.0);
7777
COPY_H2D(d_x, h_x.data(), TEST_SIZE * sizeof(double));
7878

7979
double tmp = 1.0;

drivers/cpp/benchmarks/reduce/26_reduce_product_of_inverses/kokkos.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct Context {
3030
};
3131

3232
void reset(Context *ctx) {
33-
fillRand(ctx->x_host, 0.0, 100.0);
33+
fillRand(ctx->x_host, 1.0, 100.0);
3434

3535
copyVectorToView(ctx->x_host, ctx->xNonConst);
3636
ctx->x = ctx->xNonConst;
@@ -68,7 +68,7 @@ bool validate(Context *ctx) {
6868
const size_t numTries = MAX_VALIDATION_ATTEMPTS;
6969
for (int trialIter = 0; trialIter < numTries; trialIter += 1) {
7070
// set up input
71-
fillRand(x_host, 0.0, 100.0);
71+
fillRand(x_host, 1.0, 100.0);
7272
copyVectorToView(x_host, xNonConst);
7373
Kokkos::View<const double*> x = xNonConst;
7474

0 commit comments

Comments
 (0)