0

I am trying to run a program on Ubuntu 16.04 using npp library. In order to link library and the program, I wrote this command on terminal :

nvcc -L/home/usr/local/cuda-9.0/targets/x86_64-linux/lib  main.cu 

However, this error occurs :

/tmp/tmpxft_000048ee_00000000-10_main.o: In function `main':
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0xaf): undefined reference to `nppiMalloc_8u_C1'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0xc6): undefined reference to `nppiMalloc_8u_C1'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x16f): undefined reference to `nppiMinMaxGetBufferHostSize_8u_C1R'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x1a9): undefined reference to `nppiMinMax_8u_C1R'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x20a): undefined reference to `nppiSubC_8u_C1RSfs'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x2c9): undefined reference to `nppiMulC_8u_C1IRSfs'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x3a4): undefined reference to `nppiFree'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x3b0): undefined reference to `nppiFree'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x3c8): undefined reference to `nppiFree'
tmpxft_000048ee_00000000-5_main.cudafe1.cpp:(.text+0x3d4): undefined reference to `nppiFree'
collect2: error: ld returned 1 exit status

I did not find anything on the internet and I am new at gpu programming.

Is there an idea how I can fix the problem please?

Meloman
  • 3,558
  • 3
  • 41
  • 51

1 Answers1

0

nvcc links only cudart library by default. If you want to use any other library included with the toolkit such as NPP, you have to link its relevant libraries explicitely as follows:

nvcc -L/home/usr/local/cuda-9.0/targets/x86_64-linux/lib main.cu -lnppc -lnppi -lnppial

sgarizvi
  • 16,623
  • 9
  • 64
  • 98