Page 1 of 1

PAPI CUDA make error

PostPosted: Mon Oct 22, 2012 4:49 pm
by braulio
Hi, I am trying to build PAPI with CUDA component, I have configured the CUDA makefile correctly in the components directory. The configure of PAPI with option "--with-components-cuda" seens fine but then I try to run the command make, I get the following error:

gcc -I../testlib -I. -I.. -g -DSTATIC_PAPI_EVENTS_TABLE -DPEINCLUDE="libpfm4/include/perfmon/perf_event.h" -D_REENTRANT -D_GNU_SOURCE -DUSE_COMPILER_TLS -Wall -Ilibpfm4/include -Wextra -I/usr/local/cuda/include -I/usr/local/cuda/extras/CUPTI/include avail.c ../testlib/do_loops.o ../testlib/dummy.o ../testlib/test_utils.o ../libpapi.a -L/usr/local/cuda/extras/CUPTI/lib64 -lcupti -o papi_avail
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: ../libpapi.a(linux-cuda.o): undefined reference to symbol 'cuCtxDestroy_v2'
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: note: 'cuCtxDestroy_v2' is defined in DSO /usr/lib64/libcuda.so.1 so try adding it to the linker command line
/usr/lib64/libcuda.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [papi_avail] Error 1
make[2]: Leaving directory `/home/braulio/Downloads/papi/papi-5.0.1/src/utils'
make[1]: *** [utils] Error 2
make[1]: Leaving directory `/home/braulio/Downloads/papi/papi-5.0.1/src'
make: *** [/home/braulio/Downloads/papi/papi-5.0.1/src/libpfm4/lib/libpfm.a] Error 2

I also have tried different versions of CUDA (4.2.9 and the newest 5.0.35) but the problem persists.
I am using PAPI version 5.0.1, opensuse 12.1 and the GNU compilers are version 4.6.2.

Any hints?
Thanks in advance.

Re: PAPI CUDA make error

PostPosted: Tue Oct 23, 2012 3:02 pm
by jagode00
Can you add the cuda library path to LD_LIBRARY_PATH:
Something similar to:
export LD_LIBRARY_PATH=/<your path>/cuda-5.0.35/lib64:/<your path>/cuda-5.0.35/extras/CUPTI/lib64:$LD_LIBRARY_PATH
Please try to compile again.
thanks,
heike.

Re: PAPI CUDA make error

PostPosted: Wed Oct 24, 2012 9:22 am
by braulio
LD_LIBRARY_PATH was set with these directories before configuring the CUDA component, I also have tried to add the 32 bit libraries but the problem persists

Re: PAPI CUDA make error

PostPosted: Wed Oct 24, 2012 9:28 am
by jagode00
I cannot reproduce the problem yet. We need more information. So, can you please send the configure output for cuda component as well as for papi, please? Also, please provide "echo $LD_LIBRARY_PATH".

thanks!

Re: PAPI CUDA make error

PostPosted: Thu Oct 25, 2012 4:52 pm
by braulio
Problem solved here, the make was not indicating the libraries to compile their binaries, I added the following flags to the compiler on the configure options:
LDFLAGS="-L/usr/lib64 -lcuda -L/usr/local/cuda/extras/CUPTI/lib64 -lcupti -L/usr/local/cuda/lib64 -lcudart"
now all the binaries are correctly compiled, even with just the libraries set on LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:/usr/local/cuda-5.0/extras/CUPTI/lib64:/opt/tau/x86_64/lib:/opt/mpich2/lib64:$LD_LIBRARY_PATH was not enough.

I have had similar problems when compilating tau, and giving configure the right paths to the libraries, it compiled and installed its components correctly.
Now the hardware events are being correctly registered by papi and shown in tau. These softwares are simply awesome.

Thank you very much for the help anyway.
Braulio