strange compile error

36 views
Skip to first unread message

Tahir Malas

unread,
Jan 19, 2021, 6:39:51 PM1/19/21
to MAGMA User
Hi,

When I tried to use magma SVD functions (e.g., magma_cgesvd) I got a strange error like this:

/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: .../output/Linux/3rd_party_rpms/Install/cuda/lib64/libblas.a(cgemm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: final link failed: Bad value  

I was using LU routines without any problem so far. We do use -fPIC flag in our makefile. Does anyone came acrros with this error or have any idea on how to fix it?

Thanks in advance,

Tahir

Mark Gates

unread,
Jan 20, 2021, 11:54:41 AM1/20/21
to Tahir Malas, MAGMA User
How did you compile MAGMA, with CMake or using Makefile? If with Makefile, what is your make.inc file? What CPU BLAS & LAPACK library are you linking with?

Does this error occur when linking your application? What is your link command line?

Mark

Tahir Malas

unread,
Jan 20, 2021, 12:41:18 PM1/20/21
to Mark Gates, MAGMA User
We used make.inc.mkl-gcc-ilp64, and only changed GPU_TARGET as Kepler Maxwell Pascal Volta. We link with MKL library. 

It happens during linking and here is the command:  /opt/rh/devtoolset-7/root/usr/bin/g++ -shared -o /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/bin/peakview_core1.so.part /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/peakview/python/SIPDIR/sippeakview_core1AccuracyDefaultSetting.o /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/peakview/python/SIPDIR/sippeakview_core1CustomAccuracySet.o /home/loc
//many files
 /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/peakview/python/SIPDIR/sippeakview_core1dcomplexVector.o /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/lib/libthreadpool.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/lib/libcache.a -L /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7 -Bstatic -lgcc -lquadmath -lstdc++_nonshared -Bdynamic -O3 -ggdb -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/bin -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/lib -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/slib -L/home/local1/Scratch/tahir.malas/Work/peakview/lib64/Static_library/Static_Linux /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/magma/lib/libmagma_sparse.a  /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/magma/lib/libmagma.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcudart_static.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcusparse_static.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcusolver_static.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcublas_static.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libblas.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libbsd.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcom_err.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcublas_static.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcublasLt_static.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libculibos.a -Bstatic  -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/geompack/lib -lgeompack -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/sqlite3/lib -lsqlite3  -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/tbb/lib_debug -ltbb_debug -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/ippcp/lib -Bstatic -lippcp -Bdynamic -lpeakview_license -lcrypt -lQtCore -lpeakview_common -Wl,--start-group -Bstatic -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/binutils/lib -lbfd -liberty -Wl,--end-group -lpeakview_logger -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/gfortran-4.0.0 -Bstatic -lgfortran -Bdynamic -Wl,--start-group -Bstatic /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libumfpack.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libcholmod.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libcamd.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libklu.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libccolamd.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libcolamd.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libamd.a /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib/libsuitesparseconfig.a -Wl,--end-group -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/suite_sparse/lib -lmetis -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/trilinos/lib -lbelos -lbelosepetra -lteuchosremainder  -lteuchosnumerics -lepetra -lteuchoscomm -lteuchosparameterlist -lteuchoscore  -L/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2 -L/home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/mkl/lib -fPIC -Wl,--no-as-needed -lmkl_rt_small_ilp64 -Bstatic -lgomp -Bdynamic -lpthread -lm -ldl  

Thanks,

Tahir

Mark Gates

unread,
Jan 23, 2021, 12:59:26 AM1/23/21
to Tahir Malas, MAGMA User
It looks like you're creating a shared library, but linking in static libraries such as:

    /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcudart_static.a
    /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcusparse_static.a
    /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcusolver_static.a
    /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libcublas_static.a
    /home/local1/Scratch/tahir.malas/Work/peakview/output/Linux/3rd_party_rpms/Install/cuda/lib64/libblas.a

If those aren't compiled with -fPIC, then linking the shared library won't work.

It's a bit unclear to me why you're linking with libblas.a and later with libmkl.

In any case, the issue doesn't seem specific to MAGMA.

Mark

Reply all
Reply to author
Forward
0 new messages