Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Adding vectors using oneMKL

Nikhil_T
Novice
750 Views

I want to add 2 vectors using the following command:

 

oneapi::mkl::vm::add ( general parameters )

 

The function signature says that it adds vec_a and vec_b and stores the result in vec_y.

However, in my case, I want to perform vec_a = vec_a + vec_b, multiple times. I want to avoid the creation of a new vec_y and then transfer it to vec_a.

Is it possible to call the function with the following signature:

(vec_a , vec_b and vec_y are std::vectors)

oneapi::mkl::vm::add(q, vec_size, vec_a.data(), vec_b.data(),vec_a.data(), {}) 

 

instead of 

 

oneapi::mkl::vm::add(q, vec_size, vec_a.data(), vec_b.data(),vec_y.data(), {}) 

?

 

Also, when trying to add those 2 vectors, I am getting the error as :

E0304 no instance of overloaded function "oneapi::mkl::vm::add" matches the argument list 

0 Kudos
4 Replies
MRajesh_intel
Moderator
722 Views

Hi,


Thanks for posting your query.


>>oneapi::mkl::vm::add(q, vec_size, vec_a.data(), vec_b.data(),vec_a.data(), {}) 


We tried this scenario using CPU as the device and the results were correct.


>>Also, when trying to add those 2 vectors, I am getting the error :


Please refer to the examples provided in /intel/oneapi/mkl/latest/examples/dpcpp/vml. In the directory you can refer to vadd.cpp or vadd_usm.cpp for reference.


Please let us know if you have any issues.


Regards

Rajesh.


0 Kudos
MRajesh_intel
Moderator
690 Views

Hi,


Can you please update us on whether your issue has been resolved or not?


Regards

Rajesh.


0 Kudos
Nikhil_T
Novice
688 Views

@MRajesh_intel  Thank you. Yes the issue has been resolved now. It was the older version of oneapi that was getting stuck. 

 

0 Kudos
MRajesh_intel
Moderator
680 Views

  

Hi,


Thanks for the confirmation!


As this issue has been resolved, we will no longer respond to this thread. If you require any additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.


Have a Good day.


Regards

Rajesh




0 Kudos
Reply