Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/helix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<HelixPreCommands Condition="$(IsPosixShell)">$(HelixPreCommands);export PATH=$HELIX_CORRELATION_PAYLOAD/$(DotNetCliDestination):$PATH</HelixPreCommands>
<HelixPreCommands Condition="!$(IsPosixShell)">$(HelixPreCommands);set PATH=%HELIX_CORRELATION_PAYLOAD%\$(DotNetCliDestination)%3B%PATH%</HelixPreCommands>

<HelixPreCommands Condition="$(HelixTargetQueues.ToLowerInvariant().Contains('osx'))">$(HelixPreCommands);export LD_LIBRARY_PATH=/opt/homebrew/opt/mono-libgdiplus/lib;ls /usr/lib;ls $HELIX_WORKITEM_ROOT</HelixPreCommands>
<HelixPreCommands Condition="$(HelixTargetQueues.ToLowerInvariant().Contains('osx'))">$(HelixPreCommands);export LD_LIBRARY_PATH=/opt/homebrew/opt/mono-libgdiplus/lib;ls /usr/lib;ls $HELIX_WORKITEM_ROOT;export KMP_DUPLICATE_LIB_OK=TRUE;export DYLD_PRINT_LIBRARIES=1;otool -L $HELIX_WORKITEM_ROOT/runtimes/osx-x64/native/lib_lightgbm.dylib</HelixPreCommands>

<HelixPreCommands Condition="$(HelixTargetQueues.ToLowerInvariant().Contains('armarch'))">$(HelixPreCommands);sudo apt update;sudo apt-get install libomp-dev libomp5 -y</HelixPreCommands>

Expand All @@ -128,7 +128,7 @@
Command="install_name_tool -change &quot;/usr/local/opt/libomp/lib/libomp.dylib&quot; &quot;@loader_path/libomp.dylib&quot; $(BUILD_SOURCESDIRECTORY)/artifacts/bin/%(ProjectsWithTargetFramework.Filename)/$(BuildConfig)/%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)/libSymSgdNative.dylib" />

<Exec Condition="Exists('$(BUILD_SOURCESDIRECTORY)\artifacts\bin\%(ProjectsWithTargetFramework.Filename)\$(BuildConfig)\%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)\runtimes\osx-x64\native\lib_lightgbm.dylib') AND $(HelixTargetQueues.ToLowerInvariant().Contains('osx'))"
Command="install_name_tool -change &quot;/usr/local/opt/libomp/lib/libomp.dylib&quot; &quot;@loader_path/libomp.dylib&quot; $(BUILD_SOURCESDIRECTORY)/artifacts/bin/%(ProjectsWithTargetFramework.Filename)/$(BuildConfig)/%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)/runtimes/osx-x64/native/lib_lightgbm.dylib" />
Command="install_name_tool -change &quot;/usr/local/opt/libomp/lib/libomp.dylib&quot; &quot;@rpath/libomp.dylib&quot; $(BUILD_SOURCESDIRECTORY)/artifacts/bin/%(ProjectsWithTargetFramework.Filename)/$(BuildConfig)/%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)/runtimes/osx-x64/native/lib_lightgbm.dylib" />

<Exec Condition="Exists('$(BUILD_SOURCESDIRECTORY)\artifacts\bin\%(ProjectsWithTargetFramework.Filename)\$(BuildConfig)\%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)\runtimes\osx-x64\native\libonnxruntime.dylib') AND $(HelixTargetQueues.ToLowerInvariant().Contains('osx'))"
Command="install_name_tool -change &quot;/usr/local/opt/libomp/lib/libomp.dylib&quot; &quot;@loader_path/libomp.dylib&quot; $(BUILD_SOURCESDIRECTORY)/artifacts/bin/%(ProjectsWithTargetFramework.Filename)/$(BuildConfig)/%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)/runtimes/osx-x64/native/libonnxruntime.dylib" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public NativeDependencyFactAttribute(string library) : base($"This test requires
/// <inheritdoc />
protected override bool IsEnvironmentSupported()
{
// Starting to drop native support for X64 OSX since intel no longer makes them.
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX) && System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == System.Runtime.InteropServices.Architecture.X64)
return false;
return NativeLibrary.NativeLibraryExists(_library);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public NativeDependencyTheoryAttribute(string library) : base($"This test requir
/// <inheritdoc />
protected override bool IsEnvironmentSupported()
{
// Starting to drop native support for X64 OSX since intel no longer makes them.
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX) && System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == System.Runtime.InteropServices.Architecture.X64)
return false;
return NativeLibrary.NativeLibraryExists(_library);
}
}
Expand Down
14 changes: 12 additions & 2 deletions test/Microsoft.ML.TestFrameworkCommon/Utility/NativeLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static bool NativeLibraryExists(string name)
string extension = default;
string prefix = "lib";

if (Environment.OSVersion.Platform == PlatformID.MacOSX)
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
extension = ".dylib";
else if (Environment.OSVersion.Platform == PlatformID.Unix)
extension = ".so";
Expand All @@ -43,7 +43,17 @@ public static bool NativeLibraryExists(string name)
}
catch
{
return false;
// If that didn't load, dispose of the first attempt and try appending lib_ in front
try
{
nativeLibrary?.Dispose();
nativeLibrary = new NativeLibrary(prefix + "_" + name + extension);
return true;
}
catch
{
return false;
}
}
}
finally
Expand Down
4 changes: 4 additions & 0 deletions test/Microsoft.ML.TestFrameworkCommon/Utility/PathResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ private bool TryLocateNativeAssetFromDeps(string name, out string appLocalNative

List<string> allRIDs = new List<string>();
allRIDs.Add(currentRID);
if (currentRID.Contains("arm64"))
{
allRIDs.Add("osx-arm64");
}
if (!AddFallbacks(allRIDs, currentRID, defaultContext.RuntimeGraph))
{
#pragma warning disable MSML_ParameterLocalVarName // Parameter or local variable name not standard
Expand Down