Skip to content

Commit 52ee74a

Browse files
committed
Add a workaround for the tests hanging while loading MKL.
The workaround is to ensure the MKL library is loaded very early in the test process, so it doesn't cause the deadlock. Also moving the test queue back to the hosted windows pool. Workaround dotnet#1073
1 parent 759ac33 commit 52ee74a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.vsts-dotnet-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ phases:
1010
name: Windows_NT
1111
buildScript: build.cmd
1212
queue:
13-
name: DotNetCore-Windows
13+
name: Hosted VS2017
1414

1515
- template: /build/ci/phase-template.yml
1616
parameters:

test/Microsoft.ML.TestFramework/GlobalBase.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// }
1212

1313
using System;
14+
using System.Runtime.InteropServices;
1415
using Xunit;
1516

1617
namespace Microsoft.ML.Runtime.Internal.Internallearn.Test
@@ -22,6 +23,28 @@ public static void AssemblyInit()
2223
System.Diagnostics.Debug.WriteLine("*** Setting test assertion handler");
2324
var prev = Contracts.SetAssertHandler(AssertHandler);
2425
Contracts.Check(prev == null, "Expected to replace null assertion handler!");
26+
27+
// HACK: ensure MklImports is loaded very early in the tests so it doesn't deadlock while loading it later.
28+
// See https://github.com/dotnet/machinelearning/issues/1073
29+
Mkl.PptrfInternal(Mkl.Layout.RowMajor, Mkl.UpLo.Up, 0, Array.Empty<double>());
30+
}
31+
32+
private static class Mkl
33+
{
34+
public enum Layout
35+
{
36+
RowMajor = 101,
37+
ColMajor = 102
38+
}
39+
40+
public enum UpLo : byte
41+
{
42+
Up = (byte)'U',
43+
Lo = (byte)'L'
44+
}
45+
46+
[DllImport("MklImports", EntryPoint = "LAPACKE_dpptrf")]
47+
public static extern int PptrfInternal(Layout layout, UpLo uplo, int n, double[] ap);
2548
}
2649

2750
public static void AssemblyCleanup()

0 commit comments

Comments
 (0)