Cant run some openmp benchmarks

Hi every one,
I am new to OpenMP. when I create a simple file. it comple and run

nvc arraybench.c -mp -o mm

but when i try to run a bench mark I fond long message<< i dont know what I miss

this is the message:
undefined reference to init' /usr/bin/ld: ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:51: undefined reference to reference’
/usr/bin/ld: …EPCC-OpenMP-micro-benchmarks-master/arraybench.c:57: undefined reference to benchmark' /usr/bin/ld: ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:61: undefined reference to benchmark’
/usr/bin/ld: …EPCC-OpenMP-micro-benchmarks-master/arraybench.c:71: undefined reference to benchmark' /usr/bin/ld: ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:73: undefined reference to finalise’
/usr/bin/ld: /tmp/nvclL1iH_VF3DFd.o: in function refer': ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:82: undefined reference to innerreps’
/usr/bin/ld: …EPCC-OpenMP-micro-benchmarks-master/arraybench.c:82: undefined reference to delaylength' /usr/bin/ld: ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:83: undefined reference to array_delay’
/usr/bin/ld: /tmp/nvclL1iH_VF3DFd.o: in function testfirstprivnew': ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:89: undefined reference to innerreps’
/usr/bin/ld: …EPCC-OpenMP-micro-benchmarks-master/arraybench.c:(.text+0x1ac): undefined reference to delaylength' /usr/bin/ld: /tmp/nvclL1iH_VF3DFd.o: in function __nv_testfirstprivnew_F1L91_1’:
…EPCC-OpenMP-micro-benchmarks-master/arraybench.c:92: undefined reference to delaylength' /usr/bin/ld: ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:92: undefined reference to array_delay’
/usr/bin/ld: /tmp/nvclL1iH_VF3DFd.o: in function testprivnew': ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:99: undefined reference to innerreps’
/usr/bin/ld: …EPCC-OpenMP-micro-benchmarks-master/arraybench.c:(.text+0x2ac): undefined reference to delaylength' /usr/bin/ld: /tmp/nvclL1iH_VF3DFd.o: in function __nv_testprivnew_F1L101_2’:
…EPCC-OpenMP-micro-benchmarks-master/arraybench.c:102: undefined reference to delaylength' /usr/bin/ld: ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:102: undefined reference to array_delay’
/usr/bin/ld: /tmp/nvclL1iH_VF3DFd.o: in function testthrprivnew': ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:126: undefined reference to innerreps’
/usr/bin/ld: …EPCC-OpenMP-micro-benchmarks-master/arraybench.c:(.text+0x38a): undefined reference to delaylength' /usr/bin/ld: /tmp/nvclL1iH_VF3DFd.o: in function __nv_testthrprivnew_F1L128_3’:
…EPCC-OpenMP-micro-benchmarks-master/arraybench.c:129: undefined reference to delaylength' /usr/bin/ld: ..EPCC-OpenMP-micro-benchmarks-master/arraybench.c:129: undefined reference to array_delay’

Hi Huda,

The error is because you’re missing the other object files on the link line so the linker can’t find the symbols that are used in this file.

Best to use the include Makefile to build the benchmark binaries. Doesn’t look like they’ve updated the example Makefile.def files, so you’ll want to first edit this so that nvc is used as the compiler with the appropriated compiler flags. For example:

# Uncomment the following line to use OpenMP 2.0 features
#OMPFLAG = -DOMPVER2
# Uncomment the following line to use OpenMP 3.0 features
OMPFLAG = -DOMPVER2 -DOMPVER3

CC=nvc
CFLAGS = -mp -fast
LDFLAGS = -mp -fast
CPP = /usr/bin/cpp
LIBS =

The from the command line type “make” to build the binaries which will be stored under the “bin” directory.

Hope this helps,
Mat

Thank you very much for replay
I’m new to OpenMP and Ubuntu.
This is the first time to use it<< my first use for this

make clean && make all 

The original make file:

# Uncomment the following line to use OpenMP 2.0 features
#OMPFLAG = -DOMPVER2
# Uncomment the following line to use OpenMP 3.0 features
OMPFLAG = -DOMPVER2 -DOMPVER3

CC=clang
CFLAGS = -fopenmp -O3
LDFLAGS = -fopenmp -O3 -L$(OMP_TR4_DIR) -lomp -Wl,-rpath=$(OMP_TR4_DIR)
CPP = /usr/bin/cpp
LIBS = 

I modify it as in your example and run the command ‘make clean && make all’
I do this for the first time<< there is a new error:

$ make clean && make allrm bin/arraybench_* bin/syncbench bin/schedbench bin/taskbench *.o
rm: cannot remove 'bin/arraybench_*': No such file or directory
rm: cannot remove 'bin/syncbench': No such file or directory
rm: cannot remove 'bin/schedbench': No such file or directory
rm: cannot remove 'bin/taskbench': No such file or directory
make: [Makefile:64: clean] Error 1 (ignored)
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c syncbench.c 
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c common.c 
nvc -o bin/syncbench -mp -fast -O3 -lomp -Wl,-rpath= syncbench.o common.o    -lm
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c schedbench.c 
nvc -mp -fast -O3 -DSCHEDBENCH -DOMPVER2 -DOMPVER3 -o common_sched.o -c common.c
nvc -o bin/schedbench  -mp -fast -O3 -lomp -Wl,-rpath= schedbench.o common_sched.o    -lm 
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c taskbench.c 
nvc -o bin/taskbench -mp -fast -O3 -lomp -Wl,-rpath= -DOMPVER2 -DOMPVER3 taskbench.o common.o    -lm 
make IDA=1 prog
make[1]: Entering directory '/home/oliver/EPCC-OpenMP-micro-benchmarks-master'
nvc -mp -fast -O3 -DIDA=1 -DOMPVER2 -DOMPVER3 arraybench.c -c -o arraybench_1.o
"arraybench.c", line 40: error: expected an identifier
  const int IDA=100;
            ^

1 error detected in the compilation of "arraybench.c".
make[1]: *** [Makefile:54: arraybench_1.o] Error 2
make[1]: Leaving directory '/home/oliver/EPCC-OpenMP-micro-benchmarks-master'
make: *** [Makefile:18: all] Error 2
oliver@victus:~/EPCC-OpenMP-micro-benchmarks-master$ make clean && make allrm bin/arraybench_* bin/syncbench bin/schedbench bin/taskbench *.o
rm: cannot remove 'bin/arraybench_*': No such file or directory
make: [Makefile:64: clean] Error 1 (ignored)
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c syncbench.c 
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c common.c 
nvc -o bin/syncbench -mp -fast -O3  syncbench.o common.o    -lm
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c schedbench.c 
nvc -mp -fast -O3 -DSCHEDBENCH -DOMPVER2 -DOMPVER3 -o common_sched.o -c common.c
nvc -o bin/schedbench  -mp -fast -O3  schedbench.o common_sched.o    -lm 
nvc -mp -fast -O3 -DOMPVER2 -DOMPVER3 -c taskbench.c 
nvc -o bin/taskbench -mp -fast -O3  -DOMPVER2 -DOMPVER3 taskbench.o common.o    -lm 
make IDA=1 prog
make[1]: Entering directory '/home/oliver/EPCC-OpenMP-micro-benchmarks-master'
nvc -mp -fast -O3 -DIDA=1 -DOMPVER2 -DOMPVER3 arraybench.c -c -o arraybench_1.o
"arraybench.c", line 40: error: expected an identifier
  const int IDA=100;
            ^

1 error detected in the compilation of "arraybench.c".
make[1]: *** [Makefile:54: arraybench_1.o] Error 2
make[1]: Leaving directory '/home/oliver/EPCC-OpenMP-micro-benchmarks-master'
make: *** [Makefile:18: all] Error 2

Sorry if I take time<< but I am new to OpenMP

Have you modified the code?

The version I used doesn’t set the IDA macro in the source and instead lets the makefile set it so that multiple binaries are created for various sized arrays.

The actual error is because the macro “-DIDA=1” will replace the “IDA” variable causing the code to be “const int 1=100”. So if you did modify the code, remove this line or stash your changes.

-Mat

1 Like

Thank you for your helpful information

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.