[PATCH] D103065: [AIX][test-suite] Utilize `INT_MAX` instead of `RAND_MAX` on AIX (ocean and srad benchmarks)
Amy Kwan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 25 07:26:10 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rT66ac0dcd149a: [AIX][test-suite] Utilize `INT_MAX` instead of `RAND_MAX` on AIX (ocean and… (authored by amyk).
Repository:
rT test-suite
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103065/new/
https://reviews.llvm.org/D103065
Files:
MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp
MultiSource/Benchmarks/Rodinia/srad/main.c
Index: MultiSource/Benchmarks/Rodinia/srad/main.c
===================================================================
--- MultiSource/Benchmarks/Rodinia/srad/main.c
+++ MultiSource/Benchmarks/Rodinia/srad/main.c
@@ -4,6 +4,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef _AIX
+#define AIX_RAND_MAX 2147483647
+#endif
void random_matrix(float I[ROWS][COLS]);
void srad_kernel(float dN[ROWS][COLS], float dS[ROWS][COLS],
float dW[ROWS][COLS], float dE[ROWS][COLS],
@@ -80,7 +83,11 @@
glibc_compat_srand(SEED);
for (int i = 0; i < ROWS; i++) {
for (int j = 0; j < COLS; j++) {
+ #ifdef _AIX
+ I[i][j] = glibc_compat_rand() / (float)AIX_RAND_MAX;
+ #else
I[i][j] = glibc_compat_rand() / (float)RAND_MAX;
+ #endif
}
}
}
Index: MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp
===================================================================
--- MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp
+++ MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp
@@ -12,6 +12,9 @@
#if defined(__XS1B__)
#include "xcoretestsuite.h"
#endif
+#ifdef _AIX
+#define AIX_RAND_MAX 2147483647
+#endif
//cell.cc
Cell *Cell::getCellAt(Coordinate aCoord) {
@@ -127,11 +130,19 @@
#define MAX 32767
float Random::randReal(void) {
+#ifdef _AIX
+ return random()/(float)AIX_RAND_MAX;
+#else
return random()/(float)RAND_MAX;
+#endif
}
unsigned Random::nextIntBetween(int low, int high) {
+#ifdef _AIX
+ return (long long)(random())* high / AIX_RAND_MAX;
+#else
return (long long)(random())* high / RAND_MAX;
+#endif
}
//ocean.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103065.389786.patch
Type: text/x-patch
Size: 1624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211125/dd21d7e3/attachment.bin>
More information about the llvm-commits
mailing list