cannot build clMAGMA:libclBLAS.so: undefined reference to...

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
fossil
Posts: 14
Joined: Sat Nov 14, 2015 6:07 pm

cannot build clMAGMA:libclBLAS.so: undefined reference to...

Post by fossil » Sun Nov 29, 2015 3:25 pm

Dear friends,

please give me the idea, what is going wrong with my build.

I'm trying to build clMAGMA 1.1.0
CPU Phenom 4x 965
2x GPU Radeon HD 6990
OS: ubuntu 14.04.3 desktop
I have acml 6.1.0.31-gfortran
AMDAPPSDK-3.0
amdlibm-3.1-lin64
cblas from libatlas-base-dev-3.10.1-4
clBLAS build from git (make install)

when I run make from inside clmagma-1.1.0 directory I get the following messages:
....
//usr/local/lib64/libclBLAS.so: undefined reference to `pthread_rwlock_unlock'
//usr/local/lib64/libclBLAS.so: undefined reference to `pthread_rwlock_init'
//usr/local/lib64/libclBLAS.so: undefined reference to `pthread_rwlock_rdlock'
//usr/local/lib64/libclBLAS.so: undefined reference to `pthread_rwlock_destroy'
//usr/local/lib64/libclBLAS.so: undefined reference to `pthread_rwlock_wrlock'
collect2: error: ld returned 1 exit status

from my understanding it tries to execute collect2, which depends on libclBLAS.so, which in turn needs pthread_rwlock*
the libclBLAS dependencies are:

~/sandbox/clmagma-1.1.0$ ldd /usr/local/lib64/libclBLAS.so
linux-vdso.so.1 => (0x00007ffe29175000)
libOpenCL.so.1 => /opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so.1 (0x00007ff2d6400000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff2d60fc000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff2d5df6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff2d5be0000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff2d581b000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff2d5613000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff2d540f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff2d51f1000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff2d7f73000)

the symbols are in libpthread:
~/sandbox/clmagma-1.1.0$ nm -D /lib/x86_64-linux-gnu/libpthread.so.0 |grep pthread_rwlock
000000000000c110 T pthread_rwlockattr_destroy
000000000000c150 T pthread_rwlockattr_getkind_np
000000000000c120 T pthread_rwlockattr_getpshared
000000000000c100 T pthread_rwlockattr_init
000000000000c160 T pthread_rwlockattr_setkind_np
000000000000c130 T pthread_rwlockattr_setpshared
000000000000ba30 T __pthread_rwlock_destroy
000000000000ba30 T pthread_rwlock_destroy
000000000000b950 T __pthread_rwlock_init
000000000000b950 T pthread_rwlock_init
000000000000ba40 T __pthread_rwlock_rdlock
000000000000ba40 T pthread_rwlock_rdlock
000000000000bb00 T pthread_rwlock_timedrdlock
000000000000bd80 T pthread_rwlock_timedwrlock
000000000000bf40 T __pthread_rwlock_tryrdlock
000000000000bf40 T pthread_rwlock_tryrdlock
000000000000bfe0 T __pthread_rwlock_trywrlock
000000000000bfe0 T pthread_rwlock_trywrlock
000000000000c070 T __pthread_rwlock_unlock
000000000000c070 T pthread_rwlock_unlock
000000000000bcd0 T __pthread_rwlock_wrlock
000000000000bcd0 T pthread_rwlock_wrlock

Best regards,
Victor

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by mgates3 » Thu Dec 03, 2015 9:56 am

Thanks for including the error message. Can you include the command that generated the error? That shows what libraries you are linking with, in what order. E.g., with an intentional typo in the library name:

Code: Select all

magma> make
g++ -m64     -fPIC -Wl,-rpath,../lib \
	-o testing/testing_dgeqrf testing/testing_dgeqrf.o \
	-L./lib -lmagma \
	-L./testing -ltest \
	-L./testing/lin -llapacktest \
	-L/usr/local/cuda-6.5/lib -L./lib -lblas_fix -framework Accelerate -lstdc++ -lm -lgfortran -lcublas -lcusparse -lcudartt
ld: library not found for -lcudartt
collect2: error: ld returned 1 exit status
make: *** [testing/testing_dgeqrf] Error 1
Also, please include your make.inc file, which includes helpful information about your setup.
-mark

fossil
Posts: 14
Joined: Sat Nov 14, 2015 6:07 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by fossil » Fri Dec 11, 2015 5:48 pm

Hi mgates3,

below is the tail of make output:
....
g++ -fPIC testing_zgesvd.o -o testing_zgesvd \
libtest.a lin/liblapacktest.a -L../lib -lclmagma \
-L/opt/acml-6.1.0.31-gfortran64/gfortran64/lib -L/opt/acml-6.1.0.31-gfortran64/gfortran64_mp/lib -L/usr/local//lib64 -L/opt/CBLAS/lib \
-lacml_mp -lcblas -lclBLAS -lOpenCL -lpthread
g++ -fPIC -O3 -DADD_ -Wall -DHAVE_clAmdBlas -DHAVE_CBLAS -I/usr/local//include -I/opt/AMDAPP/include -I../include -I../control -c testing_zgebrd.cpp -o testing_zgebrd.o
g++ -fPIC testing_zgebrd.o -o testing_zgebrd \
libtest.a lin/liblapacktest.a -L../lib -lclmagma \
-L/opt/acml-6.1.0.31-gfortran64/gfortran64/lib -L/opt/acml-6.1.0.31-gfortran64/gfortran64_mp/lib -L/usr/local//lib64 -L/opt/CBLAS/lib \
-lacml_mp -lcblas -lclBLAS -lOpenCL -lpthread
g++ -fPIC -O3 -DADD_ -Wall -DHAVE_clAmdBlas -DHAVE_CBLAS -I/usr/local//include -I/opt/AMDAPP/include -I../include -I../control -c testing_benchmark.cpp -o testing_benchmark.o
testing_benchmark.cpp: In function 'int main(int, char**)':
testing_benchmark.cpp:176:13: warning: unused variable 'transA' [-Wunused-variable]
int transA = MagmaNoTrans, transB = MagmaNoTrans;
^
testing_benchmark.cpp:176:36: warning: unused variable 'transB' [-Wunused-variable]
int transA = MagmaNoTrans, transB = MagmaNoTrans;
^
testing_benchmark.cpp:440:28: warning: 't_start' may be used uninitialized in this function [-Wmaybe-uninitialized]
t_exec = (t_end-t_start)/count;
^
g++ -fPIC testing_benchmark.o -o testing_benchmark \
libtest.a lin/liblapacktest.a -L../lib -lclmagma \
-L/opt/acml-6.1.0.31-gfortran64/gfortran64/lib -L/opt/acml-6.1.0.31-gfortran64/gfortran64_mp/lib -L/usr/local//lib64 -L/opt/CBLAS/lib \
-lacml_mp -lcblas -lclBLAS -lOpenCL -lpthread
/usr/local//lib64/libclBLAS.so: undefined reference to `pthread_rwlock_unlock'
/usr/local//lib64/libclBLAS.so: undefined reference to `pthread_rwlock_init'
/usr/local//lib64/libclBLAS.so: undefined reference to `pthread_rwlock_rdlock'
/usr/local//lib64/libclBLAS.so: undefined reference to `pthread_rwlock_destroy'
/usr/local//lib64/libclBLAS.so: undefined reference to `pthread_rwlock_wrlock'
collect2: error: ld returned 1 exit status
make[1]: *** [testing_benchmark] Error 1
make[1]: Leaving directory `/home/victor/sandbox/clmagma-1.1.0/testing'
make: *** [test] Error 2

make with wrong library name:
.....
CL_MAGMA_RT.cpp:828:112: warning: '_cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_queue_properties, cl_int*)' is deprecated (declared at /opt/AMDAPP/include/CL/cl.h:1359) [-Wdeprecated-declarations]
commandQueue = clCreateCommandQueue(cxGPUContext, cdDevices[0], CL_QUEUE_PROFILING_ENABLE, &ciErrNum);
^
touch stamp
ar cr ../lib/libclmagma.a magmablas_z.o zauxiliary.o zbcyclic.o zgemm_reduce.o zlacpy.o zlag2c.o clag2z.o zlarfbx.o zlarfgx-v2.o dznrm2.o zpermute.o zswap.o ztranspose.o ztranspose2.o ztranspose_inplace.o magmablas_c.o cauxiliary.o cbcyclic.o cgemm_reduce.o clacpy.o clarfbx.o clarfgx-v2.o scnrm2.o cpermute.o cswap.o ctranspose.o ctranspose2.o ctranspose_inplace.o magmablas_d.o dauxiliary.o dbcyclic.o dgemm_reduce.o dlacpy.o dlag2s.o slag2d.o dlarfbx.o dlarfgx-v2.o dnrm2.o dpermute.o dswap.o dtranspose.o dtranspose2.o dtranspose_inplace.o magmablas_s.o sauxiliary.o sbcyclic.o sgemm_reduce.o slacpy.o slarfbx.o slarfgx-v2.o snrm2.o spermute.o sswap.o stranspose.o stranspose2.o stranspose_inplace.o interface.o strerror.o CL_MAGMA_RT.o
ranlib ../lib/libclmagma.a
g++ -fPIC -O3 -DADD_ -Wall -DHAVE_clAmdBlas -DHAVE_CBLAS -I/usr/local//include -I/opt/AMDAPP/include -I../include -I../control -c clcompile.cpp -o clcompile.o
g++ -fPIC -o clcompile clcompile.o CL_MAGMA_RT.o \
-L/opt/acml-6.1.0.31-gfortran64/gfortran64/lib -L/opt/acml-6.1.0.31-gfortran64/gfortran64_mp/lib -L/usr/local//lib64 -L/opt/CBLAS/lib -lacml_mp -lcblas -lclBLAS -lOpenCL -lpthreadxxx
/usr/bin/ld: cannot find -lpthreadxxx
collect2: error: ld returned 1 exit status
make[1]: *** [clcompile] Error 1
make[1]: Leaving directory `/home/victor/sandbox/clmagma-1.1.0/interface_opencl'
make: *** [libmagma] Error 2


make.inc:

GPU_TARGET = AMD

CC = g++
FORT = gfortran

ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib

OPTS = -fPIC -O3 -DADD_ -Wall
FOPTS = -fPIC -O3 -DADD_ -Wall -x f95-cpp-input
F77OPTS = -fPIC -O3 -DADD_ -Wall
LDOPTS = -fPIC

# define library directories preferably in your environment, or here.
#ACMLDIR ?= /opt/acml-4.4.0
#clBLAS ?= /opt/clAmdBlas-1.11.314
#AMDAPP ?= /opt/AMDAPP
-include make.check-acml
-include make.check-clblas

#LIB = -lacml -lacml_mv
#LIB = -lacml_mp -lacml_mv -lcblas
LIB = -lacml_mp -lcblas
LIB += -lclBLAS -lOpenCL
LIB += -lpthread
#LIB += -lclAmdBlas -lOpenCL

LIBDIR = -L$(ACMLDIR)/gfortran64/lib \
-L$(ACMLDIR)/gfortran64_mp/lib \
-L$(clBLAS)/lib64 \
-L$(CBLASDIR)/lib

INC = -I$(clBLAS)/include \
-I$(AMDAPP)/include


.pam_environment:

export ACML_ROOT=/opt/acml-6.1.0.31-gfortran64
#export ACML_ROOT=/opt/acml5.3.1
export ACMLDIR=$ACML_ROOT
export CBLASDIR=/opt/CBLAS
export clBLAS=/usr/local/
#/home/victor/sandbox/clBLAS
export AMDAPP=/opt/AMDAPP
export CLBLAS_STORAGE_PATH=/home/victor/sandbox/clBLAS-storage

Take care.

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by mgates3 » Sat Dec 12, 2015 11:22 am

Odd. I would have guessed that -lpthread was missing, or in the wrong order, but it is clearly there and properly after -lclBLAS. Also, gcc can find libpthread, since using a bogus name results in a different error.

Your output seems to be indicating the libclBLAS needs those pthread functions. Therefore, I would check libclBLAS.so and libpthread.so for those functions. On our Linux system, libpthread has them (note "T" in nm output), and libclBLAS doesn't reference them, so I'm at a loss what the problem may be on your system.

Code: Select all

prompt>  nm /lib64/libpthread.so.0 | grep ' pthread_rwlock_'
0000003d97c0a9e0 T pthread_rwlock_destroy
0000003d97c0a9a0 T pthread_rwlock_init
0000003d97c0a9f0 T pthread_rwlock_rdlock
0000003d97c0aab0 T pthread_rwlock_timedrdlock
0000003d97c0ad40 T pthread_rwlock_timedwrlock
0000003d97c0af00 T pthread_rwlock_tryrdlock
0000003d97c0af90 T pthread_rwlock_trywrlock
0000003d97c0b010 T pthread_rwlock_unlock
0000003d97c0ac90 T pthread_rwlock_wrlock

Code: Select all

clBLAS-2.4.0-Linux-x64/lib64>  nm libclBLAS.so.2.4.0 | grep pthread
                 U pthread_mutex_destroy@@GLIBC_2.2.5
                 U pthread_mutex_init@@GLIBC_2.2.5
                 U pthread_mutex_lock@@GLIBC_2.2.5
                 U pthread_mutex_unlock@@GLIBC_2.2.5
You can compile a "hello world" program to find where libpthread.so is.

Code: Select all

prompt>  cat hello.c 
    #include <stdio.h>
    int main( int argc, char** argv ) {
        printf( "hello\n" );
        return 0;
    }

prompt>  gcc -o hello hello.c -lpthread
prompt>  ldd hello
	linux-vdso.so.1 =>  (0x00007ffd81338000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003d97c00000)
	libc.so.6 => /lib64/libc.so.6 (0x0000003d97800000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003d97400000)
gcc can also print it, but you may have to look into files a bit then.

Code: Select all

prompt>  gcc -print-file-name=libpthread.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.so

prompt>  readlink -f /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.so
/usr/lib64/libpthread.so

prompt>  less /usr/lib64/libpthread.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib64/libpthread.so.0 /usr/lib64/libpthread_nonshared.a )
Also check if you can compile and link a simple program with clBLAS (excluding MAGMA). Here's one. I didn't need -lpthread, so not sure what function in clBLAS requires pthreads.

Code: Select all

prompt>  cat hello_clblas.c 
#include <stdio.h>
#include <clBLAS.h>

int main( int argc, char** argv ) {
    cl_int err = clblasSetup();
    printf( "hello. err %d\n", err );

    // obviously this won't run, but should return error
    cl_command_queue queue = NULL;
    cl_event event = NULL;
    cl_mem dx = NULL, dy = NULL;
    int n=0, incx=0, incy=0, dx_offset=0, dy_offset=0;
    double alpha=0;
    err = clblasDaxpy(
        n, alpha,
        dx, dx_offset, incx,
        dy, dy_offset, incy,
        1, &queue, 0, NULL, &event );
    printf( "axpy err %d\n", err );
    
    clblasTeardown();
    printf( "done\n" );
    return 0;
}

prompt>  gcc -Wall -I /usr/local/clBLAS-2.4/include -L /usr/local/clBLAS-2.4/lib -o hello_clblas hello_clblas.c -lclBLAS

prompt>  ./hello_clblas 
hello. err 0
Invalid Size for X
axpy err -1017
done
Hope something there leads you to a solution. Let us know.
-mark

fossil
Posts: 14
Joined: Sat Nov 14, 2015 6:07 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by fossil » Wed Dec 16, 2015 4:29 pm

Hallo Mark,

below is the output

hello doesn't show dependency on pthread

hello_clblas was build succesfully but runs only with root privileges.

victor@fossil-dt5:~/sandbox/clmagma-1.1.0/testing$ nm /lib/x86_64-linux-gnu/libpthread.so.0 | grep ' pthread_rwlock_'
000000000000ba30 T pthread_rwlock_destroy
000000000000b950 T pthread_rwlock_init
000000000000ba40 T pthread_rwlock_rdlock
000000000000bb00 T pthread_rwlock_timedrdlock
000000000000bd80 T pthread_rwlock_timedwrlock
000000000000bf40 T pthread_rwlock_tryrdlock
000000000000bfe0 T pthread_rwlock_trywrlock
000000000000c070 T pthread_rwlock_unlock
000000000000bcd0 T pthread_rwlock_wrlock

victor@fossil-dt5:~/sandbox/clmagma-1.1.0/testing$ nm /usr/local/lib64/libclBLAS.so | grep pthread
w __pthread_key_create
U pthread_mutex_destroy@@GLIBC_2.2.5
U pthread_mutex_init@@GLIBC_2.2.5
U pthread_mutex_lock@@GLIBC_2.2.5
U pthread_mutex_unlock@@GLIBC_2.2.5
U pthread_rwlock_destroy
U pthread_rwlock_init
U pthread_rwlock_rdlock
U pthread_rwlock_unlock
U pthread_rwlock_wrlock

victor@fossil-dt5:~/sandbox/test-pthread$ gcc -o hello hello.c -lpthread
victor@fossil-dt5:~/sandbox/test-pthread$ ldd hello
linux-vdso.so.1 => (0x00007ffe3d7a8000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa0e8423000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa0e87e8000)

victor@fossil-dt5:~/sandbox/test-pthread$ gcc -print-file-name=libpthread.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpthread.so

victor@fossil-dt5:~/sandbox/test-pthread$ readlink -f /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpthread.so
/usr/lib/x86_64-linux-gnu/libpthread.so

victor@fossil-dt5:~/sandbox/test-pthread$ less /usr/lib/x86_64-linux-gnu/libpthread.so

/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib/x86_64-linux-gnu/libpthread.so.0 /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a )
/usr/lib/x86_64-linux-gnu/libpthread.so (END)

victor@fossil-dt5:~/sandbox/test-pthread$ gcc -Wall -I /usr/local/include -L /usr/local/lib -o hello_clblas hello_clblas.c -lclBLAS

victor@fossil-dt5:~/sandbox/test-pthread$ ./hello_clblas
Error: No root privilege. Please check with the system-admin.
Error: No root privilege. Please check with the system-admin.
....
Error: No root privilege. Please check with the system-admin.
Error: No root privilege. Please check with the system-admin.
hello. err 0
Invalid Size for X
axpy err -1017
done

victor@fossil-dt5:~/sandbox/test-pthread$ sudo ./hello_clblas
[sudo] password for victor:
hello. err 0
Invalid Size for X
axpy err -1017
done

Take care,
Victor
Last edited by fossil on Wed Dec 16, 2015 6:30 pm, edited 1 time in total.

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by mgates3 » Wed Dec 16, 2015 5:21 pm

Can you use "nm" to look at your pthread and clBLAS libraries? E.g.,

Code: Select all

nm /lib/x86_64-linux-gnu/libpthread.so.0 | grep ' pthread_rwlock_'
nm /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a | grep ' pthread_rwlock_'
nm libclBLAS.so.2.4.0 | grep pthread
Running that OpenCL program shouldn't require root privilege, as far as I know. It doesn't on our machines. Perhaps some tmp or cache folder has overly restrictive privileges.

Attached is a hello_pthread.c that should definitely link in the pthread library. All it does is launch a thread and do a couple mutex locks. Odd that the simple hello.c linked it in on our system but not on yours.

Basically, I'm suggesting trying simple programs that add features (just stdc, add pthreads, add clBLAS, etc.) to determine the minimal circumstances that exhibit the problem. Hope that points you in the right direction to search.

-mark
Attachments
hello_pthread.c
(580 Bytes) Downloaded 124 times

fossil
Posts: 14
Joined: Sat Nov 14, 2015 6:07 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by fossil » Wed Dec 16, 2015 6:33 pm

Hallo Mark,

here is the output

victor@fossil-dt5:~/sandbox$ nm /lib/x86_64-linux-gnu/libpthread.so.0 | grep ' pthread_rwlock_'
000000000000ba30 T pthread_rwlock_destroy
000000000000b950 T pthread_rwlock_init
000000000000ba40 T pthread_rwlock_rdlock
000000000000bb00 T pthread_rwlock_timedrdlock
000000000000bd80 T pthread_rwlock_timedwrlock
000000000000bf40 T pthread_rwlock_tryrdlock
000000000000bfe0 T pthread_rwlock_trywrlock
000000000000c070 T pthread_rwlock_unlock
000000000000bcd0 T pthread_rwlock_wrlock
victor@fossil-dt5:~/sandbox$ nm /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a | grep ' pthread_rwlock_'
victor@fossil-dt5:~/sandbox$ nm /usr/local/lib64/libclBLAS.so | grep pthread
w __pthread_key_create
U pthread_mutex_destroy@@GLIBC_2.2.5
U pthread_mutex_init@@GLIBC_2.2.5
U pthread_mutex_lock@@GLIBC_2.2.5
U pthread_mutex_unlock@@GLIBC_2.2.5
U pthread_rwlock_destroy
U pthread_rwlock_init
U pthread_rwlock_rdlock
U pthread_rwlock_unlock
U pthread_rwlock_wrlock

victor@fossil-dt5:~/sandbox/test-pthread$ gcc -Wall -I /usr/local/include -L /usr/local/lib -o hello_clblas hello_pthread.c -lpthread
victor@fossil-dt5:~/sandbox/test-pthread$ ./hello_clblas
hello
lock
thread

Take care,
Victor

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by mgates3 » Thu Dec 17, 2015 1:22 pm

Then I can't understand why it won't link. It claims that pthread_rwlock_init is undefined, i.e., it can't find it in any library. Yet you've listed -lpthread after -lclBLAS, and libpthread.so.0 does have a definition of pthread_rwlock_init. Based on the error messages, it is actually an issue with clBLAS, not with clMAGMA.

From this point, you could try adding more clBLAS functions to the hello-clblas.c code, presumably until you discover a function that introduces the error. Sorry I can't give any more specific advice.
-mark

fossil
Posts: 14
Joined: Sat Nov 14, 2015 6:07 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by fossil » Fri Dec 18, 2015 7:14 am

Hi Mark,

I rolledback the clBLAS-2.8.0 installation from /usr/local/ and used clBLAS.so.2.3.0 from /opt/acml-6.1.0.31-gfortran64/gfortran64_mp/lib/
Then I was able to successfully run the g++ command.
so, the build doesn't work with clBLAS 2.8.0 from github.

Then I've tried to find the "official" clBLAS build for ubuntu.
There is one in version wily (15.10).
So, I upgraded from 14.04.3 LTS to 15.10 and installed libclblas2, libclblas-dev

+++-======================================-========================-========================-=================================================================================
ii libclblas-bin 2.6-2 amd64 OpenCL BLAS library (executables)
ii libclblas-dev 2.6-2 amd64 OpenCL BLAS library (development files)
ii libclblas2:amd64 2.6-2 amd64 OpenCL BLAS library (shared library)

now build somehow has not found acml_mp and OpenCL

After creating links /usr/lib/libacml_mp.so to /opt/acml-6.1.0.31-gfortran64/gfortran64_mp/lib/libacml_mp.so
and /usr/lib/libOpenCL.so to /opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so I was able to build until interface_opencl.
Settings from /etc/ld.so.conf.d/ somehow don't work.

I get a lot of error messages about permission problems like shown below.

./clcompile stranspose_inplace.cl
Initializing...
Error: No root privilege. Please check with the system-admin.
Error: No root privilege. Please check with the system-admin.
Error: No root privilege. Please check with the system-admin.
Error: No root privilege. Please check with the system-admin.
Error: clGetDeviceIDs at 782 in file CL_MAGMA_RT.cpp!

Then I started sudo make under ./interface_opencl and get the following errors
...
./clcompile stranspose.cl
Initializing...
Device: Cayman
Device: Cayman
Device: Cayman
Device: Cayman
./clcompile stranspose_inplace.cl
Initializing...
Device: Cayman
Device: Cayman
Device: Cayman
Device: Cayman
clBuildProgram error at 1051 in CL_MAGMA_RT.cpp
"/tmp/OCLlqpUS0.cl", line 49: error: invalid combination of type specifiers
__kernel void stranspose_inplace_even_kernel( __global float *matrix, int offset, int lda, int half )
^

"/tmp/OCLlqpUS0.cl", line 49: error: unnamed prototyped parameters not allowed
when body is present
__kernel void stranspose_inplace_even_kernel( __global float *matrix, int offset, int lda, int half )
^

"/tmp/OCLlqpUS0.cl", line 61: error: expected an expression
int ibx = bottom ? (get_group_id(0) - 1) : (get_group_id(1) + half);
^

"/tmp/OCLlqpUS0.cl", line 62: error: expected an expression
int iby = bottom ? (get_group_id(1)) : (get_group_id(0) + half);
^

"/tmp/OCLlqpUS0.cl", line 92: error: invalid combination of type specifiers
__kernel void stranspose_inplace_odd_kernel( __global float *matrix, int offset, int lda, int half )
^

"/tmp/OCLlqpUS0.cl", line 92: error: unnamed prototyped parameters not allowed
when body is present
__kernel void stranspose_inplace_odd_kernel( __global float *matrix, int offset, int lda, int half )
^

"/tmp/OCLlqpUS0.cl", line 104: error: expected an expression
int ibx = bottom ? get_group_id(0) : (get_group_id(1) + half - 1);
^

"/tmp/OCLlqpUS0.cl", line 105: error: expected an expression
int iby = bottom ? get_group_id(1) : (get_group_id(0) + half);
^

8 errors detected in the compilation of "/tmp/OCLlqpUS0.cl".
Frontend phase failed compilation.

any ideas about how to fix that?

Take care,
Victor

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: cannot build clMAGMA:libclBLAS.so: undefined reference t

Post by mgates3 » Sat Dec 19, 2015 6:56 pm

Perhaps your GPU device is accessible only by root? OpenCL should definitely NOT require root privileges.

It's unclear to me what those errors indicate. They are coming from the OpenCL compiler, which is invoked via clcompile.

-mark

Post Reply