-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Port SymSGD trainer #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port SymSGD trainer #624
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
project (SymSgdNative) | ||
|
||
set(SOURCES | ||
SymSgdNative.cpp | ||
) | ||
|
||
if(WIN32) | ||
find_library(MKL_LIBRARY MklImports HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.5/runtimes/win-x64/native) | ||
else() | ||
list(APPEND SOURCES ${VERSION_FILE_PATH}) | ||
if(CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
message("Linking SymSgdNative with MKL on macOS.") | ||
find_library(MKL_LIBRARY libMklImports.dylib HINTS "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.5/runtimes/osx-x64/native") | ||
else() | ||
message("Linking SymSgdNative with MKL on linux.") | ||
find_library(MKL_LIBRARY libMklImports.so HINTS ${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.5/runtimes/linux-x64/native) | ||
SET(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
SET(CMAKE_INSTALL_RPATH "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.5/runtimes") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm concerned that this may work for unit tests, but it may not work on an end-user's machine. We will have to test this as an end user to verify. #Resolved There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep. I will make sure to do this as part of bug bash. In reply to: 206967492 [](ancestors = 206967492) |
||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
SET(CMAKE_INSTALL_RPATH "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.5/runtimes") | ||
endif() | ||
endif() | ||
|
||
add_library(SymSgdNative SHARED ${SOURCES} ${RESOURCES}) | ||
target_link_libraries(SymSgdNative PUBLIC ${MKL_LIBRARY}) | ||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
set_target_properties(SymSgdNative PROPERTIES INSTALL_RPATH "${CMAKE_SOURCE_DIR}/../../packages/mlnetmkldeps/0.0.0.5/runtimes/osx-x64/native") | ||
endif() | ||
|
||
install_library_and_symbols (SymSgdNative) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
#pragma once | ||
#define MIN(__X__, __Y__) (((__X__) > (__Y__)) ? (__Y__) : (__X__)) | ||
|
||
// This is a very large prime number used for permutation | ||
#define VERYLARGEPRIME 961748941 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
#pragma once | ||
#include "../Stdafx.h" | ||
|
||
extern "C" float cblas_sdot(const int vecSize, const float* denseVecX, const int incX, const float* denseVecY, const int incY); | ||
extern "C" float cblas_sdoti(const int sparseVecSize, const float* sparseVecValues, const int* sparseVecIndices, float* denseVec); | ||
extern "C" void cblas_saxpy(const int vecSize, const float coef, const float* denseVecX, const int incX, float* denseVecY, const int incY); | ||
extern "C" void cblas_saxpyi(const int sparseVecSize, const float coef, const float* sparseVecValues, const int* sparseVecIndices, float* denseVec); | ||
|
||
float SDOT(const int vecSize, const float* denseVecX, const float* denseVecY) | ||
{ | ||
return cblas_sdot(vecSize, denseVecX, 1, denseVecY, 1); | ||
} | ||
|
||
float SDOTI(const int sparseVecSize, const int* sparseVecIndices, const float* sparseVecValues, float* denseVec) | ||
{ | ||
return cblas_sdoti(sparseVecSize, sparseVecValues, sparseVecIndices, denseVec); | ||
} | ||
|
||
void SAXPY(const int vecSize, const float* denseVecX, float* denseVecY, float coef) | ||
{ | ||
return cblas_saxpy(vecSize, coef, denseVecX, 1, denseVecY, 1); | ||
} | ||
|
||
void SAXPYI(const int sparseVecSize, const int* sparseVecIndices, const float* sparseVecValues, float* denseVec, float coef) | ||
{ | ||
cblas_saxpyi(sparseVecSize, coef, sparseVecValues, sparseVecIndices, denseVec); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think i removed this #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need it for symsgd.
In reply to: 206926582 [](ancestors = 206926582)