<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated on Fri, 25 May 2012 22:11:16 -0700 -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <atom:link href="http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/feed/" rel="self" type="application/rss+xml" />
    <title>Intel Software Network Comments Feed</title>
    <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>By Oleg Golubovsky</title>
      <description><![CDATA[ >> Example: nmake ia32 MKLROOT="c:\program files\intel\mkl\10.1.1.015\ia32\lib"

value of MKLROOT environment variable should be reduced to "C:\Program Files\Intel\MKL\RR.r.y.xxx", where RR.r is the version number, y is the release-update number, and xxx is the package number, for
example, "C:\Program Files\Intel\MKL\10.1.0.004", otherwise you will get compilation and linkage errors.


 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-22151</link>
      <pubDate>Fri, 03 Apr 2009 04:16:09 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-22151</guid>
    </item>
    <item>
      <title>By Vladimir Koldakov (Intel)</title>
      <description><![CDATA[ Thank you, Oleg! Of course, MKL root directory should be in command line.
 -Vladimir
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-22424</link>
      <pubDate>Thu, 09 Apr 2009 21:09:30 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-22424</guid>
    </item>
    <item>
      <title>By michasspamgmx.de</title>
      <description><![CDATA[ Hi, the example does not work on my system.
As you can see in the errorcode below I am working with MKL 10.0.1.015. I am using Visual Studio 2005 Framework 2.0. Are there any known solutions to this?
Best regards Micha
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-27668</link>
      <pubDate>Thu, 16 Jul 2009 06:32:43 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-27668</guid>
    </item>
    <item>
      <title>By michasspamgmx.de</title>
      <description><![CDATA[ Sorry, here comes the error code:
D:CsharpTestUmgebungMKL_Einbinden>nmake ia32 MKLROOT="C:ProgrammeIntelMKL10.0.1.015"

Microsoft (R) Program Maintenance Utility, Version 8.00.50727.42
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Add path of the MKL libraries to the lib environment variable
        set lib=%MKLROOT%ia32lib;%lib%
MKL entries for custom dll
Workaround for pardiso
Microsoft (R) 32-Bit C/C++-Optimierungscompiler Version 14.00.50727.42 für 80x86
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

_fseeki64.c
Build MKL custom dll
        nmake mkl.dll MACHINE=IX86  MKL_LIB="mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib"  MSL

Microsoft (R) Program Maintenance Utility, Version 8.00.50727.42
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

        link /DLL /MACHINE:IX86 /def:user.def _fseeki64.obj mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_cor
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

   Bibliothek "mkl.lib" und Objekt "mkl.exp" werden erstellt.
mkl_intel_c_dll.lib(_pardiso.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_mkl_solver_pa
mkl.dll : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.
NMAKE : fatal error U1077: ""C:ProgrammeMicrosoft Visual Studio 8VCBINlink.EXE"": Rückgabe-Code "0x460"
Stop.
NMAKE : fatal error U1077: ""C:ProgrammeMicrosoft Visual Studio 8VCBINnmake.EXE"": Rückgabe-Code "0x2"
Stop. ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-27669</link>
      <pubDate>Thu, 16 Jul 2009 06:33:46 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-27669</guid>
    </item>
    <item>
      <title>By Vladimir Koldakov (Intel)</title>
      <description><![CDATA[ Hello, Micha,

Thank you for the interest to these examples. For MKL 10.0 you need add one more library:

44c44
<          MKL_LIB="mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib" 
---
>          MKL_LIB="mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib mkl_solver.lib" 

And replace OMP library:

99c99
<           libiomp5md.lib $(MSLIB) /out:mkl.dll
---
>           libguide40.lib $(MSLIB) /out:mkl.dll

It’s better also to run examples on the drive C: The security permission problem can be appeared otherwise:

Run dgemm example
<…skipped…>
Unhandled Exception: System.Security.SecurityException: System.Security.Permissions.SecurityPermission
   at mkl.CBLAS.dgemm(Int32 Order, Int32 TransA, Int32 TransB, Int32 M, Int32 N, Int32 K, Double alpha, Double[] A, Int32 lda, Double[] B, Int32 ldb, Double beta, Double[] C, Int32 ldc)
   at test_dgemm.Main(String[] args)

Best regards,
 -Vladimir
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-27810</link>
      <pubDate>Fri, 17 Jul 2009 05:00:17 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-27810</guid>
    </item>
    <item>
      <title>By Tommy</title>
      <description><![CDATA[ Hi,
Is there going to be an official wrapper release for C#?

Thanks,
Tommy
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-31486</link>
      <pubDate>Thu, 24 Sep 2009 09:04:25 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-31486</guid>
    </item>
    <item>
      <title>By Jo Cotterell</title>
      <description><![CDATA[ Hi MKL gurus,

We have successfully linked a C# program to MKL thanks to your examples, but a problem remain: It seems that MKL can't span multiple threads when being called from our managed environment. When calling cblas_dgemm from a freshly built DLL, the linkage is successfully done (pinning, ...) and the Matrix-Matrix multiplication is processed, but on an Intel Xeon 5130, we attained only 25% of CPU Usage, even after setting some environment variables (MKL_DYNAMIC=FALSE, MKL_NUM_THREADS=x) which seemed to have no impact on this issue...

Of course we were expecting some overhead coming from the C#->C transition, but such a behavior seems strange. Is it expected or have we gone wrong on something? Does C# constrain the use of unmanaged code to only one thread?

Best Regards. ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-31852</link>
      <pubDate>Wed, 30 Sep 2009 03:24:50 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-31852</guid>
    </item>
    <item>
      <title>By Vladimir Koldakov (Intel)</title>
      <description><![CDATA[ Hi, Jo.
I've checked on an 8 core Xeon - it is ok with MKL_NUM_THREADS=2 or 4 or (default) 8.
I used the makefile attached to the examples to build custom dll and run example with N=9000, K=8000, M=6000.
Could you please provide more details how do you build dll? And a small test if it is possible.
Thanks,
 Vladimir
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-33805</link>
      <pubDate>Mon, 02 Nov 2009 03:18:29 -0800</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-33805</guid>
    </item>
    <item>
      <title>By Shivesh Wangrungvichaisri</title>
      <description><![CDATA[ If I had a C# program running on mono/linux, can I use the MKL Linux version with my program since this solution is relying on a DLL? ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34516</link>
      <pubDate>Wed, 11 Nov 2009 14:26:25 -0800</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34516</guid>
    </item>
    <item>
      <title>By shachris23</title>
      <description><![CDATA[ I have a C# program running on Mono/Linux platform. Does Intel MKL Linux version allow me to integrate the MKL into the Mono implementation as well? If so, is the instruction pretty similar?

Thanks. ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34517</link>
      <pubDate>Wed, 11 Nov 2009 14:28:06 -0800</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34517</guid>
    </item>
    <item>
      <title>By Vladimir Koldakov (Intel)</title>
      <description><![CDATA[ Hi,
We do not support Mono at the moment.
I believe it will work if you build custom dynamic library (<mkl_root>/tools/builder) and call it via P/Invoke.
Thanks,
 Vladimir
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34546</link>
      <pubDate>Thu, 12 Nov 2009 00:54:41 -0800</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34546</guid>
    </item>
    <item>
      <title>By to work this sample</title>
      <description><![CDATA[ only for this version:
nmake ia32 MKLROOT="C:ProgramFileIntelCompile11.1 .51mkl"
and  i need to coy libiomp5md.dll & libiomp5md.lib to de folder IntelCompiler11.1 51mklia32lib ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34649</link>
      <pubDate>Fri, 13 Nov 2009 02:43:49 -0800</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34649</guid>
    </item>
    <item>
      <title>By shachris23</title>
      <description><![CDATA[ Just a feedback that as Mono platform grows, it would be real nice if MKL supports that platform. Thanks!! ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34774</link>
      <pubDate>Mon, 16 Nov 2009 19:00:49 -0800</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-34774</guid>
    </item>
    <item>
      <title>By fritzfranz</title>
      <description><![CDATA[ I downloaded MKL for evaluation, and I also downloaded the examples above.
The source code is pretty clear - but I do NOT manage to properly set up the links from the C# project to the MKL DLLs

Using the Visual studio command for project links, I can find the DLLs, but setting up links is not accepted. 

What is the nature of the DLLs? COM or .NET? 
Is there anything else I have to do to set up the links ??


The makefile was not helpful at all, I have a Windows 7 64-bit computer, and I can not find nmake on my machine .... ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-42626</link>
      <pubDate>Mon, 26 Apr 2010 11:26:19 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-42626</guid>
    </item>
    <item>
      <title>By Janene Pappas-mccrillis</title>
      <description><![CDATA[ I'm attempting to run the examples on my machine, Windows-7 VS 2010. I need to eventually integrate a good FFT library into my product and this one was recommended, but I can't get the examples to run. I've set up nmake, added paths of the MKL redistributable to my main path environment variable, etc. 

The makefile execution fails:

C:projectsMKL Examples>nmake ia32 mklredist="C:Program Files (x86)IntelComposerXE-2011redist"

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Add path of the MKL redistributable to the path environment variable
        set path=%MKLREDIST%ia32mkl;%MKLREDIST%ia32compiler;%path%
Build and run examples
        nmake /a dgemm.exe dgeev.exe dfti_d1.exe pardiso.exe vddiv.exe

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Compile dgemm.cs
        csc  .dgemm.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.

Run dgemm example
        dgemm.exe
MKL cblas_dgemm example

alpha=1
beta=-1
Matrix A
        1       2       3
        4       5       6
Matrix B
        0       1       0       1
        1       0       0       1
        1       0       1       0
Initial C
        5       1       3       3
        11      4       6       9
MKL FATAL ERROR: Cannot load mkl_intel_thread.dll
NMAKE : fatal error U1077: '.dgemm.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio 10.0VCBINnmake.EXE"' : return code '0x2'
Stop.


I am totally unable to add references to the MKL DLL's in VS2010. The standard "Add Reference" simply ignores my attempt. 

How does one use this library with a C# project?

Janene ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-54069</link>
      <pubDate>Mon, 27 Dec 2010 11:45:27 -0800</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-54069</guid>
    </item>
    <item>
      <title>By Eric</title>
      <description><![CDATA[ Hi,
I am using eigen values/vectors decomposition DSYEV in mkl for a university project and I need results to be reproductible.
I wrote a little wrapper (according to examples) to call DSYEV from C# :

[code=c-sharp]
namespace Front_toolbox_v2
{
    class Solve
    {
        public double[,] decompo(double[,] A)
        {
            int lwork = -1;
            int n = A.GetLength(0);
            int lda = n;

            double[] A_bis = new double[n * n];
            double[] w = new double[n];
            for (int i = 0; i < n; i++)
            {
                int cte = i * n;
                for (int j = 0; j < n; j++)
                {
                    A_bis[cte + j] = A[j, i];
                }
            }

            lwork = -1;
            double[] work_1 = new double[1];
            int info = LAPACK_mkl.dsyev('V', 'U', n, A_bis, lda, w, work_1, lwork);
            lwork = (int)work_1[0];
            double[] work = new double[lwork];
            info = LAPACK_mkl.dsyev('V', 'U', n, A_bis, lda, w, work, lwork);

            double[,] res2 = new double[n, n + 1];
            for (int i = 0; i < n; i++)
            {
                res2[i, 0] = w[i];
                for (int j = 0; j < n; j++)
                {
                    res2[i, j + 1] = A_bis[i + j * n];
                }
            }
            GC.Collect(0);
            return res2;
        }
    }
}

namespace mkl
{
    public sealed class LAPACK_mkl
    {
        private LAPACK_mkl() { }

        public static int dsyev(char jobz, char uplo, int N, double[] A, int LDA, double[] w, double[] work, int lwork)
        {
            LAPACKNative.kmp_set_warnings_off();
            int num = Environment.ProcessorCount;
            LAPACKNative.omp_set_num_threads(ref num);

            int info = -1;
            LAPACKNative.dsyev(ref jobz, ref uplo, ref N, A, ref LDA, w, work, ref lwork, ref info);
            return info;
        }
    }

    /** LAPACK native declarations */
    [SuppressUnmanagedCodeSecurity]
    internal sealed class LAPACKNative
    {

        [DllImport("libiomp5md", EntryPoint = "omp_set_num_threads")]
        internal static extern void omp_set_num_threads(ref int num);

        [DllImport("libiomp5md", EntryPoint = "kmp_set_warnings_off")]
        internal static extern void kmp_set_warnings_off();

        [DllImport("mkl", EntryPoint = "DSYEV", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
        internal static extern void dsyev(ref char jobz, ref char uplo, ref int n, double[] A, ref int lda, double[] w, double[] work, ref int lwork, ref int info);        

        private LAPACKNative()
        {
            kmp_set_warnings_off();
            int num = Environment.ProcessorCount; 
            omp_set_num_threads(ref num); 
        }
    }
}
[/code]

I red something about memory alignment and 16-byte boundaries... does this apply here ?
Thank you for any answer or comment on my code
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-58544</link>
      <pubDate>Tue, 12 Apr 2011 02:03:41 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-58544</guid>
    </item>
    <item>
      <title>By trombif</title>
      <description><![CDATA[ Hi,
I am using eigen values/vectors decomposition DSYEV in mkl for a university project and I need results to be reproductible.
I wrote a little wrapper (according to examples) to call DSYEV from C# :

[code=c-sharp]
namespace Front_toolbox_v2
{
    class Solve
    {
        public double[,] decompo(double[,] A)
        {
            int lwork = -1;
            int n = A.GetLength(0);
            int lda = n;

            double[] A_bis = new double[n * n];
            double[] w = new double[n];
            for (int i = 0; i < n; i++)
            {
                int cte = i * n;
                for (int j = 0; j < n; j++)
                {
                    A_bis[cte + j] = A[j, i];
                }
            }

            lwork = -1;
            double[] work_1 = new double[1];
            int info = LAPACK_mkl.dsyev('V', 'U', n, A_bis, lda, w, work_1, lwork);
            lwork = (int)work_1[0];
            double[] work = new double[lwork];
            info = LAPACK_mkl.dsyev('V', 'U', n, A_bis, lda, w, work, lwork);

            double[,] res2 = new double[n, n + 1];
            for (int i = 0; i < n; i++)
            {
                res2[i, 0] = w[i];
                for (int j = 0; j < n; j++)
                {
                    res2[i, j + 1] = A_bis[i + j * n];
                }
            }
            GC.Collect(0);
            return res2;
        }
    }
}

namespace mkl
{
    public sealed class LAPACK_mkl
    {
        private LAPACK_mkl() { }

        public static int dsyev(char jobz, char uplo, int N, double[] A, int LDA, double[] w, double[] work, int lwork)
        {
            LAPACKNative.kmp_set_warnings_off();
            int num = Environment.ProcessorCount;
            LAPACKNative.omp_set_num_threads(ref num);

            int info = -1;
            LAPACKNative.dsyev(ref jobz, ref uplo, ref N, A, ref LDA, w, work, ref lwork, ref info);
            return info;
        }
    }

    /** LAPACK native declarations */
    [SuppressUnmanagedCodeSecurity]
    internal sealed class LAPACKNative
    {

        [DllImport("libiomp5md", EntryPoint = "omp_set_num_threads")]
        internal static extern void omp_set_num_threads(ref int num);

        [DllImport("libiomp5md", EntryPoint = "kmp_set_warnings_off")]
        internal static extern void kmp_set_warnings_off();

        [DllImport("mkl", EntryPoint = "DSYEV", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
        internal static extern void dsyev(ref char jobz, ref char uplo, ref int n, double[] A, ref int lda, double[] w, double[] work, ref int lwork, ref int info);        

        private LAPACKNative()
        {
            kmp_set_warnings_off();
            int num = Environment.ProcessorCount; 
            omp_set_num_threads(ref num); 
        }
    }
}
[/code]

I red something about memory alignment and 16-byte boundaries... does this apply here ?
Thank you for any answer or comment on my code
 ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-58546</link>
      <pubDate>Tue, 12 Apr 2011 02:10:21 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-58546</guid>
    </item>
    <item>
      <title>By Ying H (Intel)</title>
      <description><![CDATA[ Hello  trombif,

Your question look not about how to call MKL functioon in C#, but the run result is not inconsistant in run and run on same platform, right? 

Could you submit the problem to MKL forum <http://software.intel.com/en-us/forums/intel-math-kernel-library/>? 
where many users may be share their ideas. 

Regards,
Ying H. ]]></description>
      <link>http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-61574</link>
      <pubDate>Wed, 06 Jul 2011 00:46:04 -0700</pubDate>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/#comment-61574</guid>
    </item>
  </channel></rss>
