how to solve linking problem for magma_opts::magma_opts

9 views
Skip to first unread message

Chiang-Heng Chien

unread,
Mar 17, 2021, 1:05:28 AMMar 17
to MAGMA User

Hi,

I just installed magma 2.5.4 and had successfully run the testing drivers in build/testing.
(Specifically, I want to solve many linear systems of tiny matrices, so I am using magma_dgesv_batched)

Now I want to use the code from magma_dgesv_batched to my project with a CMakeLists linking libraries like the followings:

target_link_libraries(minus
    -L/usr/local/magma/lib magma_sparse magma
    -L/usr/lib/cuda/lib64 cublas cudart cusparse
    -L/usr/lib/x86_64-linux-gnu/openblas-pthread/cmake/openblas openblas
    pthread   
 )

However, when I try to compile, I met some undefined reference errors:

tmpxft_00003500_00000000-5_minus_cuda.cudafe1.cpp:(.text+0x506): undefined reference to `magma_opts::magma_opts(magma_opts_t)'
/usr/bin/ld: tmpxft_00003500_00000000-5_minus_cuda.cudafe1.cpp:(.text+0x514): undefined reference to `magma_opts::parse_opts(int, char**)'
/usr/bin/ld: tmpxft_00003500_00000000-5_minus_cuda.cudafe1.cpp:(.text+0xfce): undefined reference to `magma_opts::cleanup()'
collect2: error: ld returned 1 exit status

It seems that the linking for referencing magma_opts_t and others are missing.
However, I have no idea what I miss or what I can do to solve such a problem.

If there is any other information I need to provide, please let me know.


Thank you very much in advance!

Stanimire Tomov

unread,
Mar 17, 2021, 1:27:52 AMMar 17
to MAGMA User, chiang-h...@brown.edu
Hello,
These undefined references are in file magma_util.cpp. Along with some other files, these define some utilities for the testing drivers. These utilities are not part of the magma library; they get grouped together in libtest.a library that we link to when building the testers.
If you want to use these somewhere else, you can take a look at the magma's CMakeLists.txt to see how we build the testers - you probably will have something similar:

# ----------------------------------------
# compile tester library
add_library( tester ${libtest_all} )
target_link_libraries( tester
    magma
    lapacktest
    ${blas_fix}
    ${LAPACK_LIBRARIES}
)

Stan

Chiang-Heng Chien

unread,
Mar 17, 2021, 8:36:01 PMMar 17
to MAGMA User, to...@icl.utk.edu, Chiang-Heng Chien
HI Shan,

Thank you very very much for your answer!

Now I get it. I indeed do not need to use opt.queue in magma_dgesv_batched, but I can alternatively use magma_queue_create and magma_queue_destroy to handle that issue.
This suggestion is given by Dr. Abdelfattah, and I'd like to credit his help and appreciate very much for his time and kindness.

Thank you again Stan!
Reply all
Reply to author
Forward
0 new messages