简体   繁体   中英

Linking C programme with libclBLAS

I'm trying to get started with clBLAS. I'm using clBLAS-2.6.0 Release for ACL 1.0 Beta 1 on linux 64bit. Downloaded binaries from examples directory work fine on my hardware but my effort is to compile the simplest of them from source and link it to shared library. Tree directory looks like this:

.
├── clBlasVersion.c
├── include
│   ├── clAmdBlas.h
│   ├── clAmdBlas.version.h
│   ├── clBLAS-complex.h
│   ├── clBLAS.h
│   └── clBLAS.version.h
└── lib
    └── libclBLAS.so

I'm using gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 and following command:

 gcc -Iinclude -Llib clBlasVersion.c

fails with linking error:

/tmp/ccC9kQ9C.o: In function `main':
clBlasVersion.c:(.text+0x1b): undefined reference to `clblasGetVersion'
collect2: error: ld returned 1 exit status

AMDAPPSDKROOT is set in environment and binary of this file, which is included in release, works showing correct version of clblas. Any suggestion what I'm missing?

You are telling the linker to look into the lib folder for libraries that it may need ( -L ) option, but you are not specifying which library to link against.

Try using the -l option as in

gcc -Iinclude -Llib -lclBLAS clBlasVersion.c

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM