--- stream-one-getregion.orig	2008-12-03 11:44:45.000000000 +0000
+++ stream-one-getregion.c	2008-12-03 11:45:42.000000000 +0000
@@ -45,6 +45,8 @@
 # include <float.h>
 # include <limits.h>
 # include <sys/time.h>
+# include <stdlib.h>
+# include <hugetlbfs.h>
 
 /* INSTRUCTIONS:
  *
@@ -88,9 +90,7 @@
 # define MAX(x,y) ((x)>(y)?(x):(y))
 # endif
 
-static double	a[N+OFFSET],
-		b[N+OFFSET],
-		c[N+OFFSET];
+static double	*a, *b, *c;
 
 static double	avgtime[4] = {0}, maxtime[4] = {0},
 		mintime[4] = {FLT_MAX,FLT_MAX,FLT_MAX,FLT_MAX};
@@ -123,15 +123,26 @@
     int			BytesPerWord;
     register int	j, k;
     double		scalar, t, times[4][NTIMES];
+    size_t		bufsize;
 
-    /* --- SETUP --- determine precision and check timing --- */
+    /* Calculate the size of the arrays */
+    bufsize = sizeof(double) * (N + OFFSET) * 3;
 
+    /* --- SETUP --- determine precision and check timing --- */
+    a = get_hugepage_region(bufsize, GHP_DEFAULT);
+    b = a + N + OFFSET;
+    c = b + N + OFFSET;
+    if (a == NULL) {
+        printf("Failed to alloc arrays\n");
+        exit(-1);
+    }
     printf(HLINE);
     printf("STREAM version $Revision: 5.8 $\n");
     printf(HLINE);
     BytesPerWord = sizeof(double);
     printf("This system uses %d bytes per DOUBLE PRECISION word.\n",
 	BytesPerWord);
+    printf("The work arrays are allocated with get_huge_pages()\n");
 
     printf(HLINE);
     printf("Array size = %d, Offset = %d\n" , N, OFFSET);
@@ -270,6 +281,7 @@
     checkSTREAMresults();
     printf(HLINE);
 
+    free_hugepage_region(a);
     return 0;
 }
 

