<?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 BLAS-like extensions cause segmentation fault for me (regular BLAS routines work) in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/BLAS-like-extensions-cause-segmentation-fault-for-me-regular/m-p/1646678#M36700</link>
    <description>&lt;P&gt;I have written many &lt;A href="https://julialang.org/" target="_self"&gt;Julia&lt;/A&gt; wrapper-functions that call routines from various parts of Intel oneAPI without issue, such as &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/blas-routines.html" target="_self"&gt;BLAS&lt;/A&gt; routines, &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/lapack-routines.html" target="_self"&gt;LAPACK&lt;/A&gt; routines and &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-0/vm-mathematical-functions.html" target="_self"&gt;vector mathematical functions&lt;/A&gt;&amp;nbsp;using &lt;A href="https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/" target="_self"&gt;ccall&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;However, when I try to do the same thing with functions that are from the "&lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/blas-like-extensions.html" target="_self"&gt;BLAS-like Extensions&lt;/A&gt;" category of Intel oneAPI I get segmentation faults. I have tried two routines that are BLAS-like extensions: &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/mkl-imatcopy.html" target="_self"&gt;mkl_dimatcopy&lt;/A&gt; and &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/mkl-omatadd.html" target="_self"&gt;mkl_domatadd&lt;/A&gt;, both crash in the same way.&lt;/P&gt;&lt;P&gt;Here is a minimal example showing how I call the mkl_dimatcopy routine from the MKL library file libmkl_rt.so using Julia:&lt;/P&gt;&lt;LI-CODE lang="none"&gt;# Path to MKL library file.
const libmklSo = "/opt/intel/oneapi/mkl/latest/lib/libmkl_rt.so"
@assert(isfile(libmklSo))

# Random 10 x 10 matrix to transpose.
AB = rand(10, 10)

# Verify that AB is 64-byte aligned which is a requirement of mkl_dimatcopy. 
@assert((UInt(pointer(AB)) % 64) == 0)

# Call the mkl_dimatcopy routine.
ccall((:mkl_dimatcopy, libmklSo), Cvoid,
    (
        Cchar,        # ordering ('C')
        Cchar,        # trans ('T')
        Csize_t,      # rows (10)
        Csize_t,      # cols (10)
        Cdouble,      # alpha (1.0)
        Ptr{Cdouble}, # AB
        Csize_t,      # lda (10)
        Csize_t,      # ldb (10)
    ),
    'C', 'T', 10, 10, 1.0, AB, 10, 10)&lt;/LI-CODE&gt;&lt;P&gt;Running this code causes a segfault for me.&lt;/P&gt;&lt;P&gt;I have also tried to verify that the mkl_dimatcopy symbol is in the libmkl_rt.so file I am using, and it seems to be:&lt;/P&gt;&lt;LI-CODE lang="none"&gt;$ nm -D /opt/intel/oneapi/mkl/latest/lib/libmkl_rt.so | grep mkl_dimatcopy
00000000005ff510 T mkl_dimatcopy
00000000005ff510 T mkl_dimatcopy_
00000000005ff640 T mkl_dimatcopy_batch
00000000005ff640 T mkl_dimatcopy_batch_
00000000005ff770 T mkl_dimatcopy_batch_strided
00000000005ff770 T mkl_dimatcopy_batch_strided_&lt;/LI-CODE&gt;&lt;P&gt;Does anyone understand why this is happening and how I can fix the issue?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Dec 2024 08:59:28 GMT</pubDate>
    <dc:creator>NatSpring</dc:creator>
    <dc:date>2024-12-01T08:59:28Z</dc:date>
    <item>
      <title>BLAS-like extensions cause segmentation fault for me (regular BLAS routines work)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/BLAS-like-extensions-cause-segmentation-fault-for-me-regular/m-p/1646678#M36700</link>
      <description>&lt;P&gt;I have written many &lt;A href="https://julialang.org/" target="_self"&gt;Julia&lt;/A&gt; wrapper-functions that call routines from various parts of Intel oneAPI without issue, such as &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/blas-routines.html" target="_self"&gt;BLAS&lt;/A&gt; routines, &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/lapack-routines.html" target="_self"&gt;LAPACK&lt;/A&gt; routines and &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-0/vm-mathematical-functions.html" target="_self"&gt;vector mathematical functions&lt;/A&gt;&amp;nbsp;using &lt;A href="https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/" target="_self"&gt;ccall&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;However, when I try to do the same thing with functions that are from the "&lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/blas-like-extensions.html" target="_self"&gt;BLAS-like Extensions&lt;/A&gt;" category of Intel oneAPI I get segmentation faults. I have tried two routines that are BLAS-like extensions: &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/mkl-imatcopy.html" target="_self"&gt;mkl_dimatcopy&lt;/A&gt; and &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/mkl-omatadd.html" target="_self"&gt;mkl_domatadd&lt;/A&gt;, both crash in the same way.&lt;/P&gt;&lt;P&gt;Here is a minimal example showing how I call the mkl_dimatcopy routine from the MKL library file libmkl_rt.so using Julia:&lt;/P&gt;&lt;LI-CODE lang="none"&gt;# Path to MKL library file.
const libmklSo = "/opt/intel/oneapi/mkl/latest/lib/libmkl_rt.so"
@assert(isfile(libmklSo))

# Random 10 x 10 matrix to transpose.
AB = rand(10, 10)

# Verify that AB is 64-byte aligned which is a requirement of mkl_dimatcopy. 
@assert((UInt(pointer(AB)) % 64) == 0)

# Call the mkl_dimatcopy routine.
ccall((:mkl_dimatcopy, libmklSo), Cvoid,
    (
        Cchar,        # ordering ('C')
        Cchar,        # trans ('T')
        Csize_t,      # rows (10)
        Csize_t,      # cols (10)
        Cdouble,      # alpha (1.0)
        Ptr{Cdouble}, # AB
        Csize_t,      # lda (10)
        Csize_t,      # ldb (10)
    ),
    'C', 'T', 10, 10, 1.0, AB, 10, 10)&lt;/LI-CODE&gt;&lt;P&gt;Running this code causes a segfault for me.&lt;/P&gt;&lt;P&gt;I have also tried to verify that the mkl_dimatcopy symbol is in the libmkl_rt.so file I am using, and it seems to be:&lt;/P&gt;&lt;LI-CODE lang="none"&gt;$ nm -D /opt/intel/oneapi/mkl/latest/lib/libmkl_rt.so | grep mkl_dimatcopy
00000000005ff510 T mkl_dimatcopy
00000000005ff510 T mkl_dimatcopy_
00000000005ff640 T mkl_dimatcopy_batch
00000000005ff640 T mkl_dimatcopy_batch_
00000000005ff770 T mkl_dimatcopy_batch_strided
00000000005ff770 T mkl_dimatcopy_batch_strided_&lt;/LI-CODE&gt;&lt;P&gt;Does anyone understand why this is happening and how I can fix the issue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Dec 2024 08:59:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/BLAS-like-extensions-cause-segmentation-fault-for-me-regular/m-p/1646678#M36700</guid>
      <dc:creator>NatSpring</dc:creator>
      <dc:date>2024-12-01T08:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: BLAS-like extensions cause segmentation fault for me (regular BLAS routines work)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/BLAS-like-extensions-cause-segmentation-fault-for-me-regular/m-p/1647183#M36712</link>
      <description>&lt;P&gt;This is similar to &lt;A href="https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-domatcopy-segfaults-and-or-produces-incorrect-results/m-p/1507478#M34855" target="_self"&gt;a previous issue.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Briefly, the symbol for the C interface is MKL_Dimatcopy while the symbol for the fortran interface is mkl_dimatcopy, they differ in whether certain parameters are passed by value or as pointers. Users who include C header files do not see this distinction but calling directly via the Julia ccall interface reveals it.&lt;/P&gt;&lt;P&gt;The simplest way to resolve your issue would be to replace line 12 in your code with&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;ccall((:MKL_Dimatcopy, libmklSo), Cvoid,&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 03 Dec 2024 20:51:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/BLAS-like-extensions-cause-segmentation-fault-for-me-regular/m-p/1647183#M36712</guid>
      <dc:creator>Andrew_Barker</dc:creator>
      <dc:date>2024-12-03T20:51:13Z</dc:date>
    </item>
  </channel>
</rss>

