<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Declaring BLAS functions from mkl_rt.dll in VBA Excel in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1093299#M23388</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px;"&gt;The stdcall requirement normally needed for dlls to work in VBA only applies to 32bit dlls. In 64bit dlls there is only one calling convention, I think.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;So, for example, With 64-bits&lt;SPAN style="font-size: 1em;"&gt;&amp;nbsp;OpenBLAS I am able to do declare a call to a fortran BLAS function (not cblas) and it works fine:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:;"&gt;Public Declare PtrSafe Sub dgemm Lib "libopenblas.dll" (ByVal transa As String, _
                                                        ByVal transb As String, _
                                                        ByRef m As Long, _
                                                        ByRef n As Long, _
                                                        ByRef k As Long, _
                                                        ByRef alpha As Double, _
                                                        ByRef a As Double, _
                                                        ByRef lda As Long, _
                                                        ByRef b As Double, _
                                                        ByRef ldb As Long, _
                                                        ByRef beta As Double, _
                                                        ByRef c As Double, _
                                                        ByRef ldc As Long)&lt;/PRE&gt;

&lt;P&gt;But whichever way I tried the same does not work with 64bit mkl_rt.dll. Excel just quietly quits.&lt;/P&gt;

&lt;P&gt;Do I have to compile a BLAS-only 64bit dll to be used with VBA Excel? If yes, how exaclty (I urge you to explain in detail)?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;MKL headers are slightly different from OpenBLAS, not sure if its somehow related to this:&lt;/P&gt;

&lt;P&gt;MKL:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;void __stdcall DGEMM(const char *transa, int transa_len, const char *transb, int transb_len, const MKL_INT *m, const MKL_INT *n, const MKL_INT *k,
                     const double *alpha, const double *a, const MKL_INT *lda, const double *b, const MKL_INT *ldb,
                     const double *beta, double *c, const MKL_INT *ldc);&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;OpenBLAS:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;void BLASFUNC(dgemm)(char *, char *, blasint *, blasint *, blasint *, double *,
	   double *, blasint *, double *, blasint *, double *, double *, blasint *);&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Any tips?&lt;/P&gt;</description>
    <pubDate>Sat, 11 Feb 2017 17:28:42 GMT</pubDate>
    <dc:creator>Mikhail_K_</dc:creator>
    <dc:date>2017-02-11T17:28:42Z</dc:date>
    <item>
      <title>Declaring BLAS functions from mkl_rt.dll in VBA Excel</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1093299#M23388</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px;"&gt;The stdcall requirement normally needed for dlls to work in VBA only applies to 32bit dlls. In 64bit dlls there is only one calling convention, I think.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;So, for example, With 64-bits&lt;SPAN style="font-size: 1em;"&gt;&amp;nbsp;OpenBLAS I am able to do declare a call to a fortran BLAS function (not cblas) and it works fine:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:;"&gt;Public Declare PtrSafe Sub dgemm Lib "libopenblas.dll" (ByVal transa As String, _
                                                        ByVal transb As String, _
                                                        ByRef m As Long, _
                                                        ByRef n As Long, _
                                                        ByRef k As Long, _
                                                        ByRef alpha As Double, _
                                                        ByRef a As Double, _
                                                        ByRef lda As Long, _
                                                        ByRef b As Double, _
                                                        ByRef ldb As Long, _
                                                        ByRef beta As Double, _
                                                        ByRef c As Double, _
                                                        ByRef ldc As Long)&lt;/PRE&gt;

&lt;P&gt;But whichever way I tried the same does not work with 64bit mkl_rt.dll. Excel just quietly quits.&lt;/P&gt;

&lt;P&gt;Do I have to compile a BLAS-only 64bit dll to be used with VBA Excel? If yes, how exaclty (I urge you to explain in detail)?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;MKL headers are slightly different from OpenBLAS, not sure if its somehow related to this:&lt;/P&gt;

&lt;P&gt;MKL:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;void __stdcall DGEMM(const char *transa, int transa_len, const char *transb, int transb_len, const MKL_INT *m, const MKL_INT *n, const MKL_INT *k,
                     const double *alpha, const double *a, const MKL_INT *lda, const double *b, const MKL_INT *ldb,
                     const double *beta, double *c, const MKL_INT *ldc);&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;OpenBLAS:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;void BLASFUNC(dgemm)(char *, char *, blasint *, blasint *, blasint *, double *,
	   double *, blasint *, double *, blasint *, double *, double *, blasint *);&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Any tips?&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 17:28:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1093299#M23388</guid>
      <dc:creator>Mikhail_K_</dc:creator>
      <dc:date>2017-02-11T17:28:42Z</dc:date>
    </item>
    <item>
      <title>Hi, false alarm figured it</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1093300#M23389</link>
      <description>&lt;P style="margin-bottom: 1em; border: 0px; font-size: 15px; clear: both; color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;"&gt;Hi, false alarm figured it out.&lt;/P&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-size: 15px; clear: both; color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;"&gt;Dependecy Walker showed that mkl_rt.dll does not rely on other dlls, but I gathered all MKL dlls in one directory anyway. When looking at what other dlls load up when calling for example cblas_drotg, the following shows up:&lt;/P&gt;

&lt;PRE class="lang-vb prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-size: 13px; width: auto; max-height: 600px; overflow: auto; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; background-color: rgb(239, 240, 241); color: rgb(57, 51, 24); word-wrap: normal;"&gt;&lt;CODE style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; white-space: inherit;"&gt;&lt;SPAN class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;libiomp5md&lt;/SPAN&gt;&lt;SPAN class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;dll
mkl_avx2&lt;/SPAN&gt;&lt;SPAN class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;dll
mkl_core&lt;/SPAN&gt;&lt;SPAN class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;dll
mkl_intel_thread&lt;/SPAN&gt;&lt;SPAN class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;dll
mkl_rt&lt;/SPAN&gt;&lt;SPAN class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"&gt;dll&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Feb 2017 15:10:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1093300#M23389</guid>
      <dc:creator>Mikhail_K_</dc:creator>
      <dc:date>2017-02-13T15:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Hi, false alarm figured it</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1188702#M29663</link>
      <description>&lt;P&gt;Hi Mikhail,&lt;/P&gt;
&lt;P&gt;I have the same problem, my excel is crashed when the call is made too.&lt;/P&gt;
&lt;P&gt;I have posted the question:&amp;nbsp;&lt;A href="https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Cannot-Invert-Matrix-using-Lapack-DGETRF-DGETRI-in-VBA/m-p/1188023#M29646" target="_blank"&gt;https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Cannot-Invert-Matrix-using-Lapack-DGETRF-DGETRI-in-VBA/m-p/1188023#M29646&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Could you review and give the instruction?&lt;/P&gt;
&lt;P&gt;Thank you a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 08:30:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1188702#M29663</guid>
      <dc:creator>Ngo__Nhan</dc:creator>
      <dc:date>2020-07-01T08:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Hi, false alarm figured it</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1189737#M29682</link>
      <description>&lt;P&gt;one notes regarding the single dynamic library - this mode, by default provides support of LP64 and Intel threading mode. Please refer to the MKL's Developer Guide follow this link:&lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/mkl-linux-developer-guide/top/linking-your-application-with-the-intel-math-kernel-library/linking-quick-start/using-the-single-dynamic-library.html" target="_blank"&gt;https://software.intel.com/content/www/us/en/develop/documentation/mkl-linux-developer-guide/top/linking-your-application-with-the-intel-math-kernel-library/linking-quick-start/using-the-single-dynamic-library.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 03:43:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1189737#M29682</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-07-06T03:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Hi, false alarm figured it</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1190479#M29710</link>
      <description>&lt;P&gt;Hi Gennady,&lt;/P&gt;
&lt;P&gt;Could you help me to provide the documents which show how we d&lt;SPAN&gt;eclare the function in mkl_rt for window and excel 32bit? I used ByRel for all variables used for DGETRF/DGETR which work in Window and Excel 64bit but 32 bit.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for giving instructions.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 02:02:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Declaring-BLAS-functions-from-mkl-rt-dll-in-VBA-Excel/m-p/1190479#M29710</guid>
      <dc:creator>Ngo__Nhan</dc:creator>
      <dc:date>2020-07-08T02:02:44Z</dc:date>
    </item>
  </channel>
</rss>

