magma_get_dpotrf_nb is defined in file get_nb.cpp that you have in the testing directory. Just putting
extern "C" int magma_dpotrf( ...
may not work because the library is already compiled as if it is cpp code and the functions are defined in certain way. For example, I get the following
- Code: Select all
[tomov@cumin testing]$ nm ../lib/libmagma.a | grep magma_dgetrf
0000000000000000 T _Z12magma_dgetrfPiS_PdS_S_S0_S0_S_
0000000000000000 T _Z16magma_dgetrf_gpuPiS_PdS_S_S0_S_
Now, if I check what I need in my testing_dgetrf.o in order to compile it
- Code: Select all
[tomov@cumin testing]$ nm testing_dgetrf.o | grep magma_dgetrf
U _Z12magma_dgetrfPiS_PdS_S_S0_S0_S_
i.e. I can link the above code with the library. But if I do
- Code: Select all
[tomov@cumin testing]$ cp testing_dgetrf.cpp testing_dgetrf.c
[tomov@cumin testing]$ gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dgetrf.c -o testing_dgetrf.o
[tomov@cumin testing]$ nm testing_dgetrf.o | grep magma_dgetrf
U magma_dgetrf
and try to link this code with the library it will fail because of the name mangling that is going on (just magma_dgetrf is not defined in the library; what is defined is _Z12magma_dgetrf...). That's why I am saying the easiest way may be if you don't change anything in the magma library but name the file from where you call magma_dgetrf with a .cpp extension. Than magma_dgetrf would be defined as it is in the library and you would be able to link it.