- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey everyone,
I am currently optimising code that performs a series of Hadamard (element-wise) divisions (1 ./ matrix) and matrix multiplications.
For example:
C = A[1 ⊘ B]
1, B ∈ R^d×d
A ∈ R^d×d
Currently, I implement the calculation in two steps:
vdDiv(d*d, mOnes, B, temp_M);
// mOnes is a matrix with all elements equal 1
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans,
d, d, d, alpha, A, d, temp_M, d, beta, C, d);
I want to avoid doing d^2+ d^3 operations and do instead just d^3 operations.
In theory, both steps could be performed in one procedure by defining C as:
(c_ij) = a_i1 / b_1j + a_2i / b_2j + ... + a_id / b_dj
Is there a way to implement this in MKL efficiently?
Many thanks and best,
Chris
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Chris,
Thanks for reaching out to us.
Could you please refer to the below link which contains the details of some functions of MKL which i guess might help you?
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Chris,
As we haven't heard back from you, could you please provide us with an update regarding your issue?
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vidya,
Thank you for your reply!
I could not find any function in the documentation that provides the operation that I am seeking. Could you point me to a specific function that might solve the problem?
Many thanks and best,
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Chris,
The links in the earlier post lists out the routines which are extensions of BLAS that are available in MKL (i guess there is no direct routine available in MKL which combines both the cases hadamard division and gemm operation and as I mentioned you can refer to the extended functionalities of BLAS)
They may not exactly match the use case of yours but might help you for further stages.
Maybe using this function cblas-gemm-batch might help you but not sure https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-like-extensions/cblas-gemm-batch.html
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vidya,
Thank you!
It seems that it is not possible to perform the exact operation that I envisioned. I will try to find a work around. The question is answered for me, thank you.
Best,
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Chris,
>>The question is answered for me,
Thanks for the confirmation.
Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.
Have a Nice Day!
Regards,
Vidya.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page