From 28c14f979bdb9d1ab437a3b82aeff2d71237c833 Mon Sep 17 00:00:00 2001 From: Mustafa Bal Date: Wed, 1 Apr 2020 14:37:13 -0700 Subject: [PATCH 1/3] Removing unused IHosts --- src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs b/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs index f776b08f56..3090a4e5a5 100644 --- a/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs +++ b/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs @@ -127,8 +127,14 @@ public HostBase(HostEnvironmentBase source, string shortName, string paren Depth = source.Depth + 1; } + /// + /// This method registers and returns the host for the calling component. The generated host is also + /// added to and encapsulated by . It becomes + /// necessary to remove these hosts when they are reclaimed by the Garbage Collector. + /// public new IHost Register(string name, int? seed = null, bool? verbose = null) { + _children.RemoveAll(r => r.TryGetTarget(out IHost _) == false); Contracts.CheckNonEmpty(name, nameof(name)); IHost host; lock (_cancelLock) From 4c54ff61d71cb4976a6172b9e95aa9b76d98d4d1 Mon Sep 17 00:00:00 2001 From: Mustafa Bal Date: Wed, 1 Apr 2020 19:22:33 -0700 Subject: [PATCH 2/3] Removed unused hosts in both Register methods --- src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs b/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs index 3090a4e5a5..4a3efeec3d 100644 --- a/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs +++ b/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs @@ -134,11 +134,11 @@ public HostBase(HostEnvironmentBase source, string shortName, string paren /// public new IHost Register(string name, int? seed = null, bool? verbose = null) { - _children.RemoveAll(r => r.TryGetTarget(out IHost _) == false); Contracts.CheckNonEmpty(name, nameof(name)); IHost host; lock (_cancelLock) { + _children.RemoveAll(r => r.TryGetTarget(out IHost _) == false); Random rand = (seed.HasValue) ? RandomUtils.Create(seed.Value) : RandomUtils.Create(_rand); host = RegisterCore(this, name, Master?.FullName, rand, verbose ?? Verbose); if (!IsCanceled) @@ -391,12 +391,18 @@ protected HostEnvironmentBase(HostEnvironmentBase source, Random rand, boo _children = new List>(); } + /// + /// This method registers and returns the host for the calling component. The generated host is also + /// added to and encapsulated by . It becomes + /// necessary to remove these hosts when they are reclaimed by the Garbage Collector. + /// public IHost Register(string name, int? seed = null, bool? verbose = null) { Contracts.CheckNonEmpty(name, nameof(name)); IHost host; lock (_cancelLock) { + _children.RemoveAll(r => r.TryGetTarget(out IHost _) == false); Random rand = (seed.HasValue) ? RandomUtils.Create(seed.Value) : RandomUtils.Create(_rand); host = RegisterCore(this, name, Master?.FullName, rand, verbose ?? Verbose); _children.Add(new WeakReference(host)); From 4fee498e9f3874e00a0d9562fad6f7fdac53441a Mon Sep 17 00:00:00 2001 From: Mustafa Bal Date: Thu, 2 Apr 2020 14:20:37 -0700 Subject: [PATCH 3/3] Run All tests including benchmarks --- .vsts-dotnet-ci.yml | 71 ++++----------------------------------------- 1 file changed, 6 insertions(+), 65 deletions(-) diff --git a/.vsts-dotnet-ci.yml b/.vsts-dotnet-ci.yml index 0cfb136fdf..59e2d324c6 100644 --- a/.vsts-dotnet-ci.yml +++ b/.vsts-dotnet-ci.yml @@ -11,59 +11,18 @@ resources: image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-mlnet-207e097-20190312152303 jobs: -- template: /build/ci/job-template.yml - parameters: - name: Centos_x64_NetCoreApp31 - buildScript: ./build.sh - container: CentosContainer - customMatrixes: - Debug_Build: - _configuration: Debug-netcoreapp3_1 - _config_short: DI - _includeBenchmarkData: false - _targetFramework: netcoreapp3.1 - Release_Build: - _configuration: Release-netcoreapp3_1 - _config_short: RI - _includeBenchmarkData: true - _targetFramework: netcoreapp3.1 - innerLoop: true - pool: - name: Hosted Ubuntu 1604 - -- template: /build/ci/job-template.yml - parameters: - name: Ubuntu_x64_NetCoreApp21 - buildScript: ./build.sh - container: UbuntuContainer - innerLoop: true - pool: - name: Hosted Ubuntu 1604 - -- template: /build/ci/job-template.yml - parameters: - name: MacOS_x64_NetCoreApp21 - buildScript: ./build.sh - innerLoop: true - pool: - name: Hosted macOS - - template: /build/ci/job-template.yml parameters: name: Windows_x64_NetCoreApp31 buildScript: build.cmd customMatrixes: - Debug_Build: - _configuration: Debug-netcoreapp3_1 - _config_short: DI - _includeBenchmarkData: false - _targetFramework: netcoreapp3.1 Release_Build: _configuration: Release-netcoreapp3_1 _config_short: RI _includeBenchmarkData: true _targetFramework: netcoreapp3.1 - innerLoop: true + innerLoop: false + runSpecific: false vsTestConfiguration: "/Framework:.NETCoreApp,Version=v3.0" pool: name: Hosted VS2017 @@ -72,37 +31,19 @@ jobs: parameters: name: Windows_x64_NetCoreApp21 buildScript: build.cmd - innerLoop: true + innerLoop: false + runSpecific: false vsTestConfiguration: "/Framework:.NETCoreApp,Version=v2.1" pool: name: Hosted VS2017 -- template: /build/ci/job-template.yml - parameters: - name: Windows_x64_NetFx461 - buildScript: build.cmd - customMatrixes: - Debug_Build: - _configuration: Debug-netfx - _config_short: DFX - _includeBenchmarkData: false - _targetFramework: win-x64 - Release_Build: - _configuration: Release-netfx - _config_short: RFX - _includeBenchmarkData: false - _targetFramework: win-x64 - innerLoop: true - vsTestConfiguration: "/Framework:.NETCoreApp,Version=v4.0" - pool: - name: Hosted VS2017 - - template: /build/ci/job-template.yml parameters: name: Windows_x86_NetCoreApp21 architecture: x86 buildScript: build.cmd - innerLoop: true + innerLoop: false + runSpecific: false vsTestConfiguration: "/Framework:.NETCoreApp,Version=v2.1" pool: name: Hosted VS2017