problem in linking cudpp to my code

196 views
Skip to first unread message

grimFandango

unread,
Aug 9, 2015, 11:16:29 PM8/9/15
to CUDPP
Hi all,

I've followed all the steps in https://github.com/cudpp/cudpp/wiki/BuildingCUDPPwithCMake but when I run the simpleCUDPP I get these errors :

/tmp/tmpxft_0000c323_00000000-17_test1.o: In function `runTest(int, char**)':
tmpxft_0000c323_00000000-4_test1.cudafe1.cpp:(.text+0x1d9): undefined reference to `cudppCreate'
tmpxft_0000c323_00000000-4_test1.cudafe1.cpp:(.text+0x24a): undefined reference to `cudppPlan'
tmpxft_0000c323_00000000-4_test1.cudafe1.cpp:(.text+0x274): undefined reference to `cudppScan'
tmpxft_0000c323_00000000-4_test1.cudafe1.cpp:(.text+0x2d0): undefined reference to `computeSumScanGold'
tmpxft_0000c323_00000000-4_test1.cudafe1.cpp:(.text+0x322): undefined reference to `cudppDestroyPlan'
tmpxft_0000c323_00000000-4_test1.cudafe1.cpp:(.text+0x337): undefined reference to `cudppDestroy'

This is how I compile the code :

nvcc -O3 -arch=sm_35 simpleCUDPP.cu -o att1


Cheers,

John Owens

unread,
Aug 9, 2015, 11:20:25 PM8/9/15
to cu...@googlegroups.com
I think you need a -l (link library) command, something like

> nvcc -O3 -arch=sm_35 simpleCUDPP.cu -lcudpp -L/path/to/cudpp/library -o att1

JDO
> --
> You received this message because you are subscribed to the Google Groups "CUDPP" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cudpp+un...@googlegroups.com.
> To post to this group, send email to cu...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cudpp.
> For more options, visit https://groups.google.com/d/optout.

grimFandango

unread,
Aug 10, 2015, 3:24:18 PM8/10/15
to CUDPP
So I did that but now I get  
 /usr/bin/ld: cannot find -lcudpp

John Owens

unread,
Aug 10, 2015, 4:18:25 PM8/10/15
to cu...@googlegroups.com
And that's what the -L is for: telling the compiler where the CUDPP library is located. For me, that library is called libcudpp.a, and I would say -L/home/jowens/Documents/working/cudpp-build/lib in my compiler call.

Here's the -L flag docs for gcc:


JDO
Message has been deleted

John Owens

unread,
Aug 11, 2015, 11:58:46 AM8/11/15
to cu...@googlegroups.com
I encourage you, and others on this list, to use cmake if possible rather than rolling your own command lines; we've put a lot of effort into making CUDPP work nicely with cmake, and it is a good tool for avoiding the kinds of issues you're having. 

JDO

On Mon, Aug 10, 2015 at 7:02 PM, grimFandango <sepid....@gmail.com> wrote:
Thank you, the problem was that I used ~ instead of /home/... Now I get undefined reference to `computeSumScanGold'. Everything else seems to work fine. Sorry for all the troubles.   
Reply all
Reply to author
Forward
0 new messages