Community
cancel
Showing results for 
Search instead for 
Did you mean: 
LaurentPlagne
Novice
348 Views

Link issue for parallel oneMKL

Hi,

I am able to compile the joined snippet with the sequential version of oneMKL

dpcpp -O3 -fsycl -std=c++17 -DMKL_ILP64 -g -DNDEBUG -lOpenCL -lsycl -lmkl_sycl -lmkl_core -lmkl_sequential -lmkl_intel_lp64 ../src/portable_main.cpp

but it fails when I try to use the parallel version. I tried to follow this  for the link options;

 

dpcpp  -lmkl_sycl -lmkl_intel_ilp64 -lmkl_tbb_thread -lmkl_core -lsycl -lOpenCL -ltbb -lpthread -ldl -lm ../src/portable_main.cpp

 

which results in numerous undefined references :

/usr/bin/ld : /opt/intel/oneapi/mkl/2021.1-beta08/lib/intel64/libmkl_tbb_thread.so : référence indéfinie vers « tbb::detail::r1::wait_bounded_queue_monitor(tbb::detail::r1::concurrent_monitor*, unsigned long, long, tbb::detail::d1::delegate_base&) »
/usr/bin/ld : /opt/intel/oneapi/mkl/2021.1-beta08/lib/intel64/libmkl_tbb_thread.so : référence indéfinie vers « tbb::detail::r1::execute_and_wait(tbb::detail::d1::task&, tbb::detail::d1::task_group_context&, tbb::detail::d1::wait_context&, tbb::detail::d1::task_group_context&) »
/usr/bin/ld : /opt/intel/oneapi/mkl/2021.1-beta08/lib/intel64/libmkl_tbb_thread.so : référence indéfinie vers « tbb::detail::r1::cache_aligned_deallocate(void*) »
/usr/bin/ld : /opt/intel/oneapi/mkl/2021.1-beta08/lib/intel64/libmkl_tbb_thread.so : référence indéfinie vers « tbb::detail::r1::terminate(tbb::detail::d1::task_arena_base&) »
...

 

Here is the file portable_main.cpp

 

#include <fstream>
#include <iostream>
#include <CL/sycl.hpp>
#include <chrono>
#include <cmath>
#include <cstring>
#include <stdio.h>
#include <iostream>
#include <random>
#include <fstream>
#include <chrono>
#include "mkl_sycl.hpp"
#include "dpc_common.hpp"


using namespace cl::sycl;
using namespace std;

constexpr size_t NITER=100; //amortize device/host communication
using Scalar=float;

template <class T>
void bench_axpy(size_t N){

  std::vector<T> a(N,1);
  std::vector<T> b(N,2);
  gpu_selector device_selector;
  queue q(device_selector, dpc_common::exception_handler);
  
  auto start=std::chrono::high_resolution_clock::now();
  {  // Begin buffer scope
    buffer buf_a(&a[0], range(N));// Create buffers using DPC++ class buffer
    buffer buf_b(&b[0], range(N));

    const T alpha=0.5;
    try{
        for (size_t iter=0; iter<NITER; iter++) {
            mkl::blas::axpy(q, N, alpha, buf_a, 1, buf_b, 1);
        }
    }
    catch(cl::sycl::exception const& e) {
        std::cout << "\t\tCaught synchronous SYCL exception during AXPY:\n"
          << e.what() << std::endl;
    }
  }
  auto end = std::chrono::high_resolution_clock::now();
  std::chrono::duration<double> elapsed_seconds = end-start;
  double time = elapsed_seconds.count();
  double GBs=double(3*N)*sizeof(T)*NITER/(time*1.e9);//2R+1W
  std::cout <<"GBs="<<GBs<<std::endl; 
}


int main(int argc, char* argv[]) {

  bench_axpy<float>(2<<27);

  return 0;
}
0 Kudos
4 Replies
GouthamK_Intel
Moderator
334 Views

Hi,

Thanks for reaching out to us!

Since your issue is related to oneMKL, we are moving this query to the Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library forum for a faster response.


Regards

Goutham


LaurentPlagne
Novice
323 Views

Do you have a suggestion for this link issue ?
Ruqiu_C_Intel
Employee
199 Views

Dear Laurent Plagne,

Intel oneAPI 2021.1 was officially released in Dec 8th. Have you tried it? And let us know if the link issue is still exist.

Regards,

Ruqiu


Ruqiu_C_Intel
Employee
99 Views

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.  Thanks

Reply