- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am trying to use mkl_malloc() in Golang.
I have created a package which wraps mkl_malloc(). I called the wrapper from other Go file.
The problem comes when I am calling the wrapper. The package is build fine.
This is the error when I use the wrapper:
/tmp/go-build655247984/blasl1.a(blasl1.cgo2.o)(.text): MKL_malloc: not defined
MKL_malloc(0): not defined
The wrapper:
func Mal(x int,y int)unsafe.Pointer{
return unsafe.Pointer(C.mkl_malloc(C.size_t(x),C.int(y)))
}
Using the wrapper:
x := blasl1.MKLMal(1024,64)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the first time I've seen MKL being used with Go. It is interesting! Maybe someone on this forum has had experience with Go can help?
Meanwhile, please share the command line and options you used to build the wrapper and link with MKL. Also, suppose you are on Linux, you can try 'ldd' on the binary to see if there's any broken dependence.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aditya, I do not know about Go, but it seems to me that you may have overlooked the point that on Linux external symbols need to match as to upper/lower case. You probably need to avoid MKL_malloc, using instead the name mkl_malloc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Zhang. I took the compiler options from MKL-Linking-Advisor. The issue comes at linking.
Hi mecej4, I have changed the name of the Wrapper Go function. But, it is still showing the same error. Does it mean that Go mapped the name permanently to the file?
Can some one help me with the linking? Any blogs or whitepapers?
Also, my installation took place in /opt/intel/. There are 2 mkl/include and 2 mkl/lib folders.
The first one is /opt/intel/mkl/include
The second one is /opt/intel/composerxe*2013spe1*16.1/mkl/include
Which one should is use during compilation and linking?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aditya Avinash Atluri wrote:
Also, my installation took place in /opt/intel/. There are 2 mkl/include and 2 mkl/lib folders.
The first one is /opt/intel/mkl/include
The second one is /opt/intel/composerxe*2013spe1*16.1/mkl/include
Which one should is use during compilation and linking?
Unless you installed two different versions of MKL side-by-side, there should only be one 'include' and one 'lib'. Can you check and see if one of the folders you mentioned is actually symbolic link to the other?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page