Skip to content

Commit

Permalink
Merge branch 'refactor'
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Feb 14, 2015
2 parents 2189eeb + 1b66959 commit 0f4434d
Show file tree
Hide file tree
Showing 104 changed files with 10,598 additions and 5,136 deletions.
12 changes: 12 additions & 0 deletions CHANGES.md
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
58 changes: 24 additions & 34 deletions README.md
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
6 changes: 3 additions & 3 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PROJECT_NAME = "mshadow"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = ../doc
OUTPUT_DIRECTORY = doc
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
Expand Down Expand Up @@ -95,13 +95,13 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT =
INPUT = mshadow mshadow-ps
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *-inl.hpp
EXCLUDE_PATTERNS = *-inl.* utils.h thread_util.h thread.h kv_array.h
EXCLUDE_SYMBOLS = mshadow::expr::Plan* mshadow::expr::*Engine*
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
Expand Down
Loading

0 comments on commit 0f4434d

Please sign in to comment.