Undeclared variable error when compiling HPC Challenge Benchmark

90 Views Asked by At

I want to compile and run HPC Challenge benchmark on my server. When I want to make hpcc-1.5.0 with mpicc compiler I get this error:

../../../../STREAM/stream.c:178:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘a’
 static double * restrict a, * restrict b, * restrict c;
                          ^
../../../../STREAM/stream.c: In function ‘checkSTREAMresults’:
../../../../STREAM/stream.c:263:16: error: ‘a’ undeclared (first use in this function)
       if (fabs(a[j]/aj-1.0) > epsilon) {
                ^
../../../../STREAM/stream.c:263:16: note: each undeclared identifier is reported only once for each function it appears in
../../../../STREAM/stream.c:280:16: error: ‘b’ undeclared (first use in this function)
       if (fabs(b[j]/bj-1.0) > epsilon) {
                ^
../../../../STREAM/stream.c:297:16: error: ‘c’ undeclared (first use in this function)
       if (fabs(c[j]/cj-1.0) > epsilon) {
                ^
../../../../STREAM/stream.c: In function ‘computeSTREAMerrors’:
../../../../STREAM/stream.c: In function ‘HPCC_Stream’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Copy’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Scale’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Add’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Triad’:

make[1]: *** [../../../../STREAM/stream.o] Error 1
make[1]: Leaving directory `/root/hpcc-1.5.0/hpl/lib/arch/build'
make: *** [all] Error 2

It seems STREAM uses some variables that is not declared.

1

There are 1 best solutions below

0
On BEST ANSWER

This is because of using restrict keywords for the array. To compile stream, you have to use -std=c99 option.

Add -std=c99 flag in your Make.$(arch) file in CCFLAGS section. Like this:

CCFLAGS      = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -std=c99

Source: https://anilmaurya.wordpress.com/2016/04/26/hpc-1-5-0-compile-time-error/