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’
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.
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:
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.