forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
104 changed files
with
10,598 additions
and
5,136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Change Log | ||
===== | ||
|
||
mshadow-1.0 | ||
===== | ||
* Initial release | ||
|
||
mshadow-2.0: in progress | ||
===== | ||
* Support multiple data type | ||
* Great refactoring of code | ||
* Parameter server interface for MultiGPU and distributed learning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,38 @@ | ||
mshadow: Matrix Shadow | ||
====== | ||
|
||
Lightweight CPU/GPU Matrix/Tensor Template Library in C++/CUDA | ||
MShadow is a lightweight CPU/GPU Matrix/Tensor Template Library in C++/CUDA. The goal of mshadow is to support ***efficient***, | ||
***device invariant*** and ***simple*** tensor library for machine learning project that aims for both simplicity and performance. | ||
|
||
Creater: Bing Xu and Tianqi Chen | ||
|
||
|
||
Documentation and Tutorial: https://github.com/tqchen/mshadow/wiki | ||
|
||
Description | ||
===== | ||
Most machine learning algorithms requires matrix,tensor operations frequently. For example, Eq.(1) is a common SGD update rule, where the weight can be a vector, matrix or 3D tensor. Eq.(2) is the backpropagtion rule: | ||
``` | ||
(1) weight = - eta * ( grad + lambda * weight ); | ||
(2) gradin = dot( gradout, netweight.T() ); | ||
``` | ||
|
||
These operations are not hard to implement, even in C++. The first one is elementwise operations, and can easily be written as | ||
``` | ||
for( int index = 0; index < weight.length; index ++ ){ | ||
weight[index] = - eta * ( grad[index] + lambda * weight[index] ); | ||
} | ||
``` | ||
Eq.(2) is matrix product, and we can use standard BLAS packages such as Intel MKL. It will looklike | ||
``` | ||
sgemm( CblasNoTrans, CblasTrans, n, m, k, 1.0, gradout.ptr, lda, netweight.ptr, ldb, 0.0, gradin.ptr, ldc ); | ||
``` | ||
However: | ||
|
||
* It is annoying to write these codes repeatively, and they are not intuitive. | ||
* What if we want to port our code to GPU? We need to rewrite our code in CUDA | ||
|
||
mshadow is a unified C++/CUDA lib to to write Eq.(1) and Eq.(2) in C++, and *translate* them to the for loop and standard packages such as MKL, CuBLAS *in compile time*. | ||
MShadow also provides interface that allows writing Multi-GPU and distributed deep learning programs in an easy and unified way. | ||
|
||
* [Contributors](https://github.com/tqchen/mshadow/graphs/contributors) | ||
* [Tutorial](guide) | ||
* [Documentation](doc) | ||
* [Parameter Server Interface for GPU Tensor](guide/mshadow-ps) | ||
|
||
Features | ||
===== | ||
* Shadow instead of giant: mshadow does not implement all of the functions, it is more of a wrapper to translated easy-to-read code to standard 'giant' packages such as MKL | ||
* Whitebox instead of blackbox: put a float* into the Tensor struct and take the benefit of the package, no memory allocation is happened unless explicitly called | ||
* Unified CPU/GPU code: write a code and it should run in both CPU and GPU | ||
* Efficient: all the expression you write will be lazily evaluated and compiled into optimized code | ||
- No temporal memory allocation will happen for expression you write | ||
- mshadow will generate specific kernel for every expression you write in compile time. | ||
* Device invariant: you can write one code and it will run on both CPU and GPU | ||
* Simple: mshadow allows you to write machine learning code using expressions. | ||
* Whitebox: put a float* into the Tensor struct and take the benefit of the package, no memory allocation is happened unless explicitly called | ||
* Lightweight library: light amount of code to support frequently used functions in machine learning | ||
* Extendable: user can write simple functions that plugs into mshadow and run on GPU/CPU, no experience in CUDA is required. | ||
* MultiGPU and Distributed ML: mshadow-ps interface allows user to write efficient MultiGPU and distributed programs in an unified way. | ||
|
||
Version | ||
====== | ||
* This version mshadow-2.x, there are a lot of changes in the interface and it is not backward compatible with mshadow-1.0 | ||
- If you use older version of cxxnet, you will need to use the legacy mshadow code | ||
* For legacy code, refer to [Here](https://github.com/tqchen/mshadow/releases/tag/v1.1) | ||
* Change log in [CHANGES.md](CHANGES.md) | ||
|
||
Related Projects | ||
===== | ||
* CXXNET: neural network implementation based on mshadow: https://github.com/antinucleon/cxxnet | ||
* [CXXNET: large-scale deep learning backed by mshadow](https://github.com/antinucleon/cxxnet) | ||
* [Parameter Server](https://github.com/mli/parameter_server) | ||
- Parameter server project provides distributed back-end for mshadow-ps | ||
- mshadow-ps extends original parameter server to support async updates for GPU Tensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.