Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Port SymSGD - #556

Closed
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd
Closed

Port SymSGD#556
codemzs wants to merge 104 commits into
dotnet:masterfrom
codemzs:symsgd

Conversation

@codemzs

@codemzscodemzs commented Jul 19, 2018

Copy link
Copy Markdown
Member

This change adds parallel SGD trainer.
fixes#623

Comment threadsrc/Native/SymSgdNative/SparseBLAS.h Outdated
#include "../Stdafx.h"
#include "mkl.h"
#ifndef COMPILER_GCC
#pragma comment(lib, "../../../Libraries/MKL/Win/Microsoft.ML.MklImports.lib")

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/MKL/Win/Microsoft.ML.MklImports.lib [](start = 31, length = 45)

Hi @codemzs thanks for looking at this. We need to either shift this thing to not use MKL, or port the libraries. However, considering that this involves the static linking of the library, and all other usages are using it as a dynamic library, this becomes especially awkward here. #Resolved

@TomFinleyTomFinleyJul 19, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if temporarily (or not so temporarily) we can shift to using regular ops rather than calling MKL, based on some compile time flag (as we do elsewhere). If on, then it will compile with MKL support. If off, it does it manually. Since these are ops like SAXPYI and whatnot, it's not like they would be incredibly hard to support. #Resolved

@codemzscodemzsJul 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TomFinley , There is a PR out that creates the MKL nuget. I have tested the native symSGD code by linking against the MKL binaries assuming they are present in the packages directory. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Once that PR is in, assuming it works, you would add the nuget dependency in which project?


In reply to: 205300173 [](ancestors = 205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.ML.Tests and Microsoft.ML.Predictor.Test. Anything that uses sym sgd would need the reference to the nuget so that binaries are copied over to the project folder in bin directory.


In reply to: 205467167 [](ancestors = 205467167,205300173)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have MKL nuget now.


In reply to: 203788370 [](ancestors = 203788370)

@codemzs
codemzs requested a review from eerhardtJuly 26, 2018 00:27
link_directories(${CMAKE_SOURCE_DIR}/../../packages/MlNetMklDeps/runtimes/win-x64/native)
else()
list(APPEND SOURCES ${VERSION_FILE_PATH})
if(APPLE)

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Consistent indentation please. #Resolved

class SymSGD {
private:
int _numFreqFeat;
// Local models that is learned

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Please shift these to use spaces for indentation. #Resolved

<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FactorizationMachineNative" />
<NativeAssemblyReference Include="SymSgdNative" />

@TomFinleyTomFinleyJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 0, length = 1)

Yet another place where I see tabs... #Resolved

@Ivanidzo4ka

Copy link
Copy Markdown
Contributor

You probably want new version of SymSGD with respectful changes in ITrainer. Which can be found in PR towards internal repo

@codemzs

codemzs commented Jul 26, 2018

Copy link
Copy Markdown
MemberAuthor

@Ivanidzo4ka This PR consumes the latest ITrainer. The code would have not compiled and tests would have not run otherwise, right? Is there anything specific that you are referring to?


In reply to: 408173274 [](ancestors = 408173274)

@Ivanidzo4ka

Ivanidzo4ka commented Jul 26, 2018

Copy link
Copy Markdown
Contributor

From what I discover yesterday, you can't just take this code, and update internal repository. SymSgd internally is in separate package, and visibility of LinearTrainerBase don't allow it to be referenced from other projects.
Also from discussion with @TomFinley SymSGD in general shouldn't be based on LinearTrainerBase, but just TrainerBase.


In reply to: 408181017 [](ancestors = 408181017,408173274)

Comment threadsrc/Native/build.proj Outdated
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)FactorizationMachineNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)SymSgdNative$(NativeLibExtension)"
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 [](start = 86, length = 8)

something, something, tabs #Resolved

Comment threadsrc/Native/SymSgdNative/Macros.h Outdated
// See the LICENSE file in the project root for more information.

#pragma once
#define MAX(__X__, __Y__) (((__X__) < (__Y__)) ? (__Y__) : (__X__))

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX never get used, do we need it? #Resolved

@@ -0,0 +1,127 @@
#pragma once

@Ivanidzo4kaIvanidzo4kaJul 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header? #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

I don't follow, can you please comment on SymSgdClassificationTrainer.cs and clarify?


In reply to: 408182382 [](ancestors = 408182382,408181017,408173274)

@codemzscodemzs changed the title WIP Port SymSGDPort SymSGDJul 31, 2018
Comment threadsrc/Microsoft.ML/Microsoft.ML.csproj Outdated
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 2, length = 63)

note about having to split SymSGD this as a separate project, rather than adding the dependency here, based on @eerhardt feedback on PR #594

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We shouldn't be referencing MlNetMklDeps from the Microsoft.ML nuget package.

{
return;
}
using (var env = new TlcEnvironment())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log an issue about re-enabling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling existing tests when we are adding new functionality? That seems wrong.

RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, might be worth logging an issue.


/// <summary>
/// Train a symbolic SGD.
/// </summary>

@sfilipisfilipiJul 31, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much documentation we have about SymSGD. If any, might be nice to include it.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

)

if(WIN32)
find_library(MKL_LIBRARY Microsoft.ML.MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/win-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we discussed offline, we shouldn't be hard-coding these paths and version numbers into our CMake scripts.

find_library(MKL_LIBRARY Microsoft.ML.MklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/osx-x64/native")
else()
message("Linking SymSgdNative with MKL on linux.")
link_directories(${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.1/runtimes/linux-x64/native)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both this and the HINTS below? Isn't one of them enough?

Comment threadsrc/Native/build.cmd
goto :Failure

:BuildNativeProj
echo Copying MKL library in bin folder. This is a temporary fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment threadsrc/Native/build.sh Outdated

cd "$__IntermediatesDir"

#codemzs: temporary fix until mkl nuget binaries are properly renamed so that they can be consumed by CMAKE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove this. And the one below.

<NativeAssemblyReference Include="CpuMathNative" />
<NativeAssemblyReference Include="FastTreeNative" />
<NativeAssemblyReference Include="LdaNative" />
<NativeAssemblyReference Include="SymSgdNative" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) whitespace is off.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</ItemGroup>

<ItemGroup>
<PackageReference Include="MlNetMklDeps" Version="0.0.0.1" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.1 - this version number should go in 1 place - in the https://github.com/dotnet/machinelearning/blob/master/build/Dependencies.props file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

eerhardtand others added 4 commits August 1, 2018 04:02
* Allow CpuMath to reference C# Hardware Intrinsics APIs.
Need to multi-target CpuMath for netstandard and netcoreapp3.0. Also, since we are going to move CpuMath into its own NuGet package, remove the dependency from CpuMath to the ML.Core project.
Add a build parameter to enable building against .NET Core 3.0's Runtime Intrinsics APIs.
Fixdotnet#534
* Respond to PR feedback.
* failing test case for multiclass
* Refactored PipelineSweeperSupportedMetrics Class; added unit test for MultiClassClassification; refactored out unit tests for the PipelineSweeper
* take care of review comments; display transforms/learners + metrics in pipeline
* taking care of PR comments + refactor PipelineSweeperRunSummary
* taking care of review comments
* remove domain from onnx operators for non-ML types.
* Make ONNX compatible with Windows RS5 and add more tests.
* PR feedback.
* PR feedback.
* fix build.
* Remove Windows and Linux configurations from netci.groovy
* Add end of line to yml files
* Add badges and change leg name to Linux
* Not merge test results
* Add searchFolder to publish test results task
codemzsand others added 23 commits August 1, 2018 04:02
add proper fields to trainer info for FT, FM, and OnlineLearner regarding incremental training and validation datasets
* Fix warning for L2 in SDCA
* String interpolation
* Word-smithing the warning message
Introduce word embedding transform
Add images support based on System.Drawing
…#611)
* moving Ols to a separate project
* Revert "moving Ols to a separate project"
This reverts commit 9b7eab3.
* separating OLS in its own project
* adding nupkgproj files to create a package for AdditionalLearners
adding AdditionalLearners to the core.tests project
fixing the core_ep and core_manifest
* CSharpApi should not get generated every time.
* Addressing Ivan's comments
* referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library.
* Correcting the error message.
* renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners
removign unsafe from the Hal csproj.
removing the orphaned member section from the doc.xml
* referencing package 0.0.0.5 and updating the name.
* regenerating the CsharpApi and the eplist post merge
* regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge.
* typo
* one shall not space
* spacing
…to symsgd
# Conflicts:
#	src/Microsoft.ML.HalLearners/Microsoft.ML.HalLearners.csproj
#	src/Microsoft.ML.HalLearners/doc.xml
#	src/Microsoft.ML/CSharpApi.cs
#	test/BaselineOutput/Common/EntryPoints/core_manifest.json
@codemzscodemzs mentioned this pull request Aug 1, 2018
@eerhardt

Copy link
Copy Markdown
Member

This can be closed. We merged the other PR

@eerhardteerhardt closed this Aug 1, 2018
@codemzs
codemzs deleted the symsgd branch August 3, 2018 06:03
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port SymSGD

12 participants

@codemzs@Ivanidzo4ka@eerhardt@TomFinley@sfilipi@abgoswam@safern@Zruty0@SolyarA@zeahmed@xadupre@justinormont