- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to calculate element-wise inverse cumulative normal distribution function of a vector using the cdfnorminv function in MKL. For this i have written the following short program:
#include <CL/sycl.hpp>
#include <algorithm>
#include <sys/time.h>
#include <stdio.h>
#include "mkl.h"
#include "oneapi/mkl/vm.hpp"
#include <iostream>
using namespace sycl;
#define RAND_NO 10
int main(){
std::cout<<"Start";
queue device{ gpu_selector{} };
double *h_random1 = malloc_shared<double>(RAND_NO+1, device);
double *h_random2 = malloc_shared<double>(RAND_NO+1, device);
device.submit([&](handler &h){
h.parallel_for(RAND_NO, [=](id<1> i){
h_random1[i] = (i[0]+1.0)/(RAND_NO+1.0);
});
});
oneapi::mkl::vm::cdfnorminv(device, RAND_NO, h_random1, h_random2);
std::cout<<"The numbers generated on the host are :\n ";
for(int i=0; i<RAND_NO; i++)
{
std::cout<< h_random1[i]<<'\n';
}
free(h_random1);
free(h_random2);
return 0;
}
However when I try to compile it i get the following error:
undefined reference to `oneapi::mkl::vm::cdfnorminv(cl::sycl::queue&, long, double*, double*, std::vector<cl::sycl::event, std::allocator<cl::sycl::event> > const&, oneapi::mkl::vm::enums::mode, oneapi::mkl::vm::detail::error_handler<double>)'
dpcpp: error: linker command failed with exit code 1 (use -v to see invocation)
Other parts of MKL work fine (rng for example) so I am having a difficult time figuring out this fails to work.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mikola,
please follow with MKL Linker adviser (https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl/link-line-advisor.html) suggests and you will able to build this example like as follows:
dpcpp -DMKL_ILP64 -qmkl=sequential test_forum.cpp \
-L/opt/intel/oneapi/mkl/2021.3.0/lib/intel64 -lsycl -lOpenCL -lpthread -lm -ldl
make[1]: Leaving directory ...
dpcpp --version
Intel(R) oneAPI DPC++/C++ Compiler 2021.3.0 (2021.3.0.20210619)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2021.3.0/linux/bin
$ echo $MKLROOT/
/opt/intel/oneapi/mkl/2021.3.0/
$ ldd a.out
linux-vdso.so.1 (0x00007ffdf55f3000)
libsycl.so.5 => /opt/intel/oneapi/compiler/2021.3.0/linux/lib/libsycl.so.5 (0x000014af8c6fb000)
libOpenCL.so.1 => /opt/intel/oneapi/compiler/2021.3.0/linux/lib/libOpenCL.so.1 (0x000014af8cbcd000)
…
libmkl_sycl.so.1 => /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_sycl.so.1 (0x000014af4cae9000)
libmkl_intel_ilp64.so.1 => /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_ilp64.so.1 (0x000014af4bdef000)
libmkl_sequential.so.1 => /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_sequential.so.1 (0x000014af4a1e2000)
libmkl_core.so.1 => /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_core.so.1 (0x000014af45b73000)
libtbb.so.12 => /opt/intel/oneapi/tbb/2021.3.0/env/../lib/intel64/gcc4.8/libtbb.so.12 (0x000014af458fa000)
….
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

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