I tested MLK with the following simple code
Both runs are in Release mode.
Why is my code slower with MKL set?
Control.LinearAlgebraProvider = new MklLinearAlgebraProvider();
ContinuousUniform uniform = new ContinuousUniform(-0.5, 0.5);
DenseVector a = DenseVector.CreateRandom(10000, uniform);
DenseVector b = DenseVector.CreateRandom(10000, uniform);
Stopwatch watch = new Stopwatch();
watch.Start();
var c = a * b;
watch.Stop();
Console.WriteLine(watch.Elapsed);
I ran the code above first, and the result on the console is 00:00:01.0080696. Then I commented the provider setting line (the first line above) out, and the result on the console is 00:00:00.0021271.Both runs are in Release mode.
Why is my code slower with MKL set?