You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2019/07/19 03:42:20 UTC
[incubator-mxnet] tag v1.1 created (now 843e51d)
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a change to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.
at 843e51d (commit)
This tag includes the following new commits:
new 07fe6f3 add tutorial for exp template
new b16a17a more example
new 0f341fa add op
new 6ccbd55 Fix compilation on GCC in C++11 mode.
new 27b3aeb Fix compilation for GPU only. (MSHADOW_USE_CUDA=1, rest is 0)
new 4ba338b Merge pull request #1 from koute/master
new ab2776f add better warning about cuda device
new 1cc0000 Update Makefile
new a92044c Update Makefile
new dcdc73d Update tensor_base.h
new b342424 Update tensor_gpu-inl.cuh
new 751996a Merge pull request #5 from reyoung/patch-1
new 9839379 Resize When SampleUniform Size is Odd
new 2329ca0 Merge pull request #7 from reyoung/master
new b998f9c Update tensor_random.h
new 3ad57fa Update tensor_random.h
new 99f85f4 Update tensor_random.h
new 390e991 Update tensor.h
new ef1f300 Update tensor.h
new c87fa59 Update tensor_gpu-inl.cuh
new e294d63 add/test the support with Openblas in Windows X64
new 46489a7 add/test the support with Openblas in Windows X64
new 4b69a12 Merge branch 'master' of https://github.com/SiNZeRo/mshadow
new bc8aa84 add/test the support with Openblas in Windows X64
new 540d7d3 Merge branch 'master' of https://github.com/SiNZeRo/mshadow
new d39c23b add/test the support with Openblas in Windows X64
new 5bdd59d Merge branch 'master' of https://github.com/SiNZeRo/mshadow
new 843e51d Merge pull request #18 from SiNZeRo/master
The 28 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-mxnet] 16/28: Update tensor_random.h
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 3ad57fa742c67b5ba7f6378460c1a5b9b6f59c9b
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Wed May 28 11:32:00 2014 -0700
Update tensor_random.h
fix random
---
mshadow/tensor_random.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/mshadow/tensor_random.h b/mshadow/tensor_random.h
index 9d10329..e22400b 100644
--- a/mshadow/tensor_random.h
+++ b/mshadow/tensor_random.h
@@ -251,15 +251,18 @@ namespace mshadow {
*/
template<int dim>
inline expr::ReshapeExp<Tensor<gpu,1>,dim,1> gaussian( Shape<dim> shape, real_t mu=0.0f, real_t sigma=1.0f){
- buffer_.Resize( Shape1( ((shape.Size() + 1UL)<<1)>>1 ) );
+ size_t aligned_sz = ((shape.Size() + 1UL)<<1)>>1;
+ // allocate alligned size
+ buffer_.Resize( Shape1( aligned_sz ) );
+ buffer_.Resize( Shape1( shape.Size() ) );
curandStatus_t status;
#if MSHADOW_SINGLE_PRECISION
- status = curandGenerateNormal(gen_, buffer_.dptr, buffer_.shape[0], mu, sigma);
+ status = curandGenerateNormal(gen_, buffer_.dptr, aligned_sz , mu, sigma);
#else
status = curandGenerateNormalDouble(gen_, buffer_.dptr, buffer_.shape[0], mu, sigma);
#endif
utils::Assert(status == CURAND_STATUS_SUCCESS, "CURAND Gen Uniform failed\n");
- return expr::reshape( buffer_.Slice(0, shape.Size()), shape );
+ return expr::reshape( buffer_, shape );
}
/*!
* \brief return a temporal expression storing standard uniform [0,1)
[incubator-mxnet] 25/28: Merge branch 'master' of
https://github.com/SiNZeRo/mshadow
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 540d7d38dd4e2da9f505b28a9db2a20d0f5f97ad
Merge: bc8aa84 4b69a12
Author: SiNZeRo <fl...@gmail.com>
AuthorDate: Sat Dec 27 14:37:46 2014 +0000
Merge branch 'master' of https://github.com/SiNZeRo/mshadow
[incubator-mxnet] 10/28: Update tensor_base.h
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit dcdc73dfbdf98d62195d81122bf7534e52b0bfc5
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Thu May 22 15:51:18 2014 -0700
Update tensor_base.h
add one more guard macro for cxx11
---
mshadow/tensor_base.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mshadow/tensor_base.h b/mshadow/tensor_base.h
index 60591a7..b251cba 100644
--- a/mshadow/tensor_base.h
+++ b/mshadow/tensor_base.h
@@ -100,7 +100,7 @@ extern "C"{
/*! \brief cpu force inline */
#define MSHADOW_CINLINE inline __attribute__((always_inline))
-#if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L
+#if defined(__GXX_EXPERIMENTAL_CXX0X) || defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
#define MSHADOW_CONSTEXPR constexpr
#else
#define MSHADOW_CONSTEXPR const
[incubator-mxnet] 05/28: Fix compilation for GPU only.
(MSHADOW_USE_CUDA=1, rest is 0)
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 27b3aebe8f878dbfc5d325ed3d44161a6fe9c314
Author: Jan Bujak <j+...@jabster.pl>
AuthorDate: Sat Apr 12 23:10:38 2014 +0200
Fix compilation for GPU only. (MSHADOW_USE_CUDA=1, rest is 0)
---
mshadow/tensor_expr_engine-inl.hpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mshadow/tensor_expr_engine-inl.hpp b/mshadow/tensor_expr_engine-inl.hpp
index ffb95c9..9c5f2c7 100644
--- a/mshadow/tensor_expr_engine-inl.hpp
+++ b/mshadow/tensor_expr_engine-inl.hpp
@@ -262,10 +262,12 @@ namespace mshadow{
struct DotEngine{
inline static void Eval( Tensor<Device,ddim> &dst, const Tensor<Device,ldim> &lhs, const Tensor<Device,rdim> &rhs, real_t scale );
};
- #if (MSHADOW_USE_CBLAS||MSHADOW_USE_MKL)
+
// handles the dot
template<typename Device>
struct BLASEngine;
+
+ #if (MSHADOW_USE_CBLAS||MSHADOW_USE_MKL)
template<>
struct BLASEngine<cpu>{
inline static CBLAS_TRANSPOSE GetT( bool t ){
@@ -294,6 +296,7 @@ namespace mshadow{
cblas_dger(CblasColMajor,m,n,alpha,X,incX,Y,incY,A,lda);
}
};
+ #endif // MSHADOW_USE_CBLAS || MSHADOW_USE_MKL
#if MSHADOW_USE_CUDA
// All CuBLAS goes to here, use legacy API: not threadsafe
@@ -378,9 +381,8 @@ namespace mshadow{
}
}
};
- #endif // MSHADOW_USE_CBLAS || MSHADOW_USE_MKL
- }; // namespace expr
+ }; // namespace expr
namespace expr{
/*! \brief some engine that evaluate complex expression */
[incubator-mxnet] 19/28: Update tensor.h
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit ef1f30061f6ee13455aa16c7b458bca3c9eff0db
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Wed Aug 27 13:25:13 2014 -0700
Update tensor.h
---
mshadow/tensor.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mshadow/tensor.h b/mshadow/tensor.h
index 033540a..42d13d3 100644
--- a/mshadow/tensor.h
+++ b/mshadow/tensor.h
@@ -457,12 +457,12 @@ namespace mshadow{
// execution implementation of expression evaluations
#include "tensor_expr_engine-inl.hpp"
-// extension of expressions
-#include "tensor_expr_ext.h"
// cpu implementation of functions
#include "tensor_cpu-inl.hpp"
// gpu implementation of functions
#include "tensor_gpu-inl.hpp"
+// extension of expressions
+#include "tensor_expr_ext.h"
// io
#include "tensor_io.h"
// container
[incubator-mxnet] 02/28: more example
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit b16a17aa8fcbe70929f0e37b4354c6cf092c6732
Author: tqchen <ti...@gmail.com>
AuthorDate: Thu Apr 10 12:41:49 2014 -0700
more example
---
example/exp-template/Makefile | 3 +-
example/exp-template/exp_lazy.cpp | 5 +--
example/exp-template/exp_template.cpp | 64 +++++++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+), 3 deletions(-)
diff --git a/example/exp-template/Makefile b/example/exp-template/Makefile
index 1e516ba..68d6168 100644
--- a/example/exp-template/Makefile
+++ b/example/exp-template/Makefile
@@ -3,13 +3,14 @@ export CC = gcc
export CXX = g++
export CFLAGS = -Wall -O3
# specify tensor path
-BIN = exp_lazy
+BIN = exp_lazy exp_template
.PHONY: clean all
all: $(BIN)
exp_lazy: exp_lazy.cpp
+exp_template: exp_template.cpp
$(BIN) :
$(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
diff --git a/example/exp-template/exp_lazy.cpp b/example/exp-template/exp_lazy.cpp
index 3d25fe1..91f49b4 100644
--- a/example/exp-template/exp_lazy.cpp
+++ b/example/exp-template/exp_lazy.cpp
@@ -1,5 +1,6 @@
-#include <cstdio>
// Example Lazy evaluation code
+// for simplicity, we use struct and make all members public
+#include <cstdio>
struct Vec;
// expression structure holds the expression
struct BinaryAddExp{
@@ -15,7 +16,7 @@ struct Vec {
Vec (float *dptr, int len):len(len),dptr(dptr){}
// here is where evaluation happens
inline Vec& operator= (const BinaryAddExp& src){
- for( int i=0; i< src.lhs.len; ++ i ){
+ for( int i = 0; i < len; ++i ){
dptr[i] = src.lhs.dptr[i] + src.rhs.dptr[i];
}
return *this;
diff --git a/example/exp-template/exp_template.cpp b/example/exp-template/exp_template.cpp
new file mode 100644
index 0000000..d9ec462
--- /dev/null
+++ b/example/exp-template/exp_template.cpp
@@ -0,0 +1,64 @@
+// Example code, expression template, and more length equations
+// for simplicity, we use struct and make all members public
+
+#include <cstdio>
+
+// this is expression, all expressions must inheritate it, and put their type in subtype
+template<typename SubType>
+struct Exp{
+ // returns const reference of the actual type of this expression
+ inline const SubType& self(void) const{
+ return *static_cast<const SubType*>(this);
+ }
+};
+
+// binary add expression
+// note how it is inheritates from Exp
+// and put its own type into the template argument
+template<typename TLhs, typename TRhs>
+struct BinaryAddExp: public Exp< BinaryAddExp<TLhs,TRhs> >{
+ const TLhs& lhs;
+ const TRhs& rhs;
+ BinaryAddExp(const TLhs& lhs, const TRhs& rhs):lhs(lhs),rhs(rhs){}
+ // evaluation function, evaluate this expression at position i
+ inline float Eval( int i ) const{
+ return lhs.Eval(i) + rhs.Eval(i);
+ }
+};
+// no constructor and destructor to allocate and de-allocate memory, allocation done by user
+struct Vec: public Exp<Vec>{
+ int len;
+ float* dptr;
+ Vec (void){}
+ Vec (float *dptr, int len):len(len),dptr(dptr){}
+ // here is where evaluation happens
+ template<typename EType>
+ inline Vec& operator= (const Exp<EType>& src_){
+ const EType &src = src_.self();
+ for( int i=0; i < len; ++i ){
+ dptr[i] = src.Eval(i);
+ }
+ return *this;
+ }
+ // evaluation function, evaluate this expression at position i
+ inline float Eval( int i ) const{
+ return dptr[i];
+ }
+};
+// template add, works for any expressions
+template<typename TLhs, typename TRhs>
+inline BinaryAddExp<TLhs,TRhs> operator+ (const Exp<TLhs>& lhs, const Exp<TRhs>& rhs){
+ return BinaryAddExp<TLhs,TRhs>(lhs.self(), rhs.self());
+}
+
+const int n = 3;
+int main( void ){
+ float sa[n]={1,2,3},sb[n]={2,3,4},sc[n]={3,4,5};
+ Vec A(sa,n), B(sb,n), C(sc,n);
+ // run expression, this expression is longer:)
+ A = B + C + C;
+ for( int i = 0; i < n; ++ i ){
+ printf("%d:%f==%f+%f+%f\n", i, A.dptr[i], B.dptr[i], C.dptr[i], C.dptr[i] );
+ }
+ return 0;
+}
[incubator-mxnet] 06/28: Merge pull request #1 from koute/master
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 4ba338b093c157d1e667ef8e604b33b496277ba3
Merge: 0f341fa 27b3aeb
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Sat Apr 12 14:32:26 2014 -0700
Merge pull request #1 from koute/master
Minor compilation fixes. fix compilation in c++11, and GPU only mode
mshadow/tensor_base.h | 24 +++++++++++++++---------
mshadow/tensor_expr_engine-inl.hpp | 8 +++++---
2 files changed, 20 insertions(+), 12 deletions(-)
[incubator-mxnet] 24/28: add/test the support with Openblas in
Windows X64
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit bc8aa8467b6c52de5176fe65ec614290203520a8
Merge: 46489a7 e294d63
Author: SiNZeRo <fl...@gmail.com>
AuthorDate: Sat Dec 27 14:29:54 2014 +0000
add/test the support with Openblas in Windows X64
example/Makefile.openblas | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --cc example/Makefile.openblas
index 0000000,0000000..bd90eca
new file mode 100644
--- /dev/null
+++ b/example/Makefile.openblas
@@@ -1,0 -1,0 +1,37 @@@
++# set LD_LIBRARY_PATH
++# echo "Link mshadow with precomplied Openblas"
++export OPENBLAS_ROOT=../../OpenBLAS-v0.2.13-Win64-int32
++export CC = gcc
++export CXX = g++
++export NVCC =nvcc
++export CFLAGS = -Wall -O3 -msse3 -Wno-unknown-pragmas -funroll-loops -I../ -I$(OPENBLAS_ROOT)/include -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_MKL=0 -DMSHADOW_USE_CBLAS=1 -D__APPLE__
++export LDFLAGS= -static -lpthread -lopenblas -L$(OPENBLAS_ROOT)/lib
++export NVCCFLAGS = -O3 --use_fast_math -ccbin $(CXX)
++
++# specify tensor path
++BIN = basic defop basic-matrix-dot
++OBJ =
++CUOBJ =
++CUBIN =
++.PHONY: clean all
++
++all: $(BIN) $(OBJ) $(CUBIN) $(CUOBJ)
++
++basic: basic.cpp
++defop: defop.cpp
++basic-matrix-dot: basic-matrix-dot.cpp
++
++$(BIN) :
++ $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS)
++
++$(OBJ) :
++ $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
++
++$(CUOBJ) :
++ $(NVCC) -c -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" $(filter %.cu, $^)
++
++$(CUBIN) :
++ $(NVCC) -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" -Xlinker "$(LDFLAGS)" $(filter %.cu %.cpp %.o, $^)
++
++clean:
++ $(RM) $(OBJ) $(BIN) $(CUBIN) $(CUOBJ) *~
[incubator-mxnet] 13/28: Resize When SampleUniform Size is Odd
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 9839379f25b3610516e6d69996823416e16afcb7
Author: reyoung <re...@126.com>
AuthorDate: Wed May 28 17:05:32 2014 +0800
Resize When SampleUniform Size is Odd
---
mshadow/tensor_random.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/mshadow/tensor_random.h b/mshadow/tensor_random.h
index 3fa8c0d..edb9c78 100644
--- a/mshadow/tensor_random.h
+++ b/mshadow/tensor_random.h
@@ -251,7 +251,12 @@ namespace mshadow {
*/
template<int dim>
inline expr::ReshapeExp<Tensor<gpu,1>,dim,1> gaussian( Shape<dim> shape, real_t mu=0.0f, real_t sigma=1.0f){
- buffer_.Resize( Shape1( shape.Size() ) );
+ int sz = shape.Size();
+ bool odd = sz %2;
+ if(odd){
+ ++sz;
+ }
+ buffer_.Resize( Shape1( sz ) );
curandStatus_t status;
#if MSHADOW_SINGLE_PRECISION
status = curandGenerateNormal(gen_, buffer_.dptr, buffer_.shape[0], mu, sigma);
@@ -259,6 +264,9 @@ namespace mshadow {
status = curandGenerateNormalDouble(gen_, buffer_.dptr, buffer_.shape[0], mu, sigma);
#endif
utils::Assert(status == CURAND_STATUS_SUCCESS, "CURAND Gen Uniform failed\n");
+ if(odd){
+ buffer_.Resize(Shape1(sz-1));
+ }
return expr::reshape( buffer_, shape );
}
/*!
[incubator-mxnet] 20/28: Update tensor_gpu-inl.cuh
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit c87fa59c904a9ec1bdb573e3237134e5c37df2a2
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Thu Nov 20 21:02:44 2014 -0800
Update tensor_gpu-inl.cuh
---
mshadow/cuda/tensor_gpu-inl.cuh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mshadow/cuda/tensor_gpu-inl.cuh b/mshadow/cuda/tensor_gpu-inl.cuh
index 3739db2..61e477c 100644
--- a/mshadow/cuda/tensor_gpu-inl.cuh
+++ b/mshadow/cuda/tensor_gpu-inl.cuh
@@ -10,8 +10,11 @@
namespace mshadow{
namespace cuda{
+ #ifndef __CUDA_ARCH__
+ #warning "__CUDA_ARCH__ is not defined, I will assume compiling with CUDA verion greater than 2.0"
+ #endif
/* load unit for memory access */
- #if __CUDA_ARCH__>=200
+ #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 200
const int kMemUnitBits = 5;
const int kMaxThreadsPerBlock = 1024;
#else
[incubator-mxnet] 21/28: add/test the support with Openblas in
Windows X64
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit e294d63d1a5334765634ccb11f4b9d633e3ffbba
Author: unknown <wt...@seis11.sepcnet.se.cuhk.edu.hk>
AuthorDate: Sat Dec 27 14:21:13 2014 +0000
add/test the support with Openblas in Windows X64
---
example/neuralnet/Makefile.openblas | 36 ++++++++++++++++++++++++++++++++++++
example/neuralnet/build_openblash.sh | 3 +++
example/neuralnet/convnet.cu | 2 ++
example/neuralnet/nnet.cu | 2 ++
4 files changed, 43 insertions(+)
diff --git a/example/neuralnet/Makefile.openblas b/example/neuralnet/Makefile.openblas
new file mode 100644
index 0000000..ef82c11
--- /dev/null
+++ b/example/neuralnet/Makefile.openblas
@@ -0,0 +1,36 @@
+# set LD_LIBRARY_PATH
+# echo "Link mshadow with precomplied Openblas"
+export OPENBLAS_ROOT=../../../OpenBLAS-v0.2.13-Win64-int32
+export CC = gcc
+export CXX = g++
+export NVCC =nvcc
+export CFLAGS = -Wall -O3 -msse3 -Wno-unknown-pragmas -funroll-loops -I../../ -I$(OPENBLAS_ROOT)/include -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_MKL=0 -DMSHADOW_USE_CBLAS=1 -D__APPLE__
+export LDFLAGS= -static -lpthread -lopenblas -L$(OPENBLAS_ROOT)/lib
+export NVCCFLAGS = -O3 --use_fast_math -ccbin $(CXX)
+
+# specify tensor path
+BIN = nnet convnet
+OBJ =
+CUOBJ =
+CUBIN =
+.PHONY: clean all
+
+all: $(BIN) $(OBJ) $(CUBIN) $(CUOBJ)
+
+nnet: nnet.cpp
+convnet: convnet.cpp
+
+$(BIN) :
+ $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS)
+
+$(OBJ) :
+ $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
+
+$(CUOBJ) :
+ $(NVCC) -c -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" $(filter %.cu, $^)
+
+$(CUBIN) :
+ $(NVCC) -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" -Xlinker "$(LDFLAGS)" $(filter %.cu %.cpp %.o, $^)
+
+clean:
+ $(RM) $(OBJ) $(BIN) $(CUBIN) $(CUOBJ) *~
diff --git a/example/neuralnet/build_openblash.sh b/example/neuralnet/build_openblash.sh
new file mode 100644
index 0000000..dd33f2c
--- /dev/null
+++ b/example/neuralnet/build_openblash.sh
@@ -0,0 +1,3 @@
+mv nnet.cu nnet.cpp
+mv convnet.cu convnet.cpp
+make -f Makefile.openblas
\ No newline at end of file
diff --git a/example/neuralnet/convnet.cu b/example/neuralnet/convnet.cu
index 448810e..de8f65b 100644
--- a/example/neuralnet/convnet.cu
+++ b/example/neuralnet/convnet.cu
@@ -202,7 +202,9 @@ int main( int argc, char *argv[] ){
// choose which version to use
INNet *net;
if( !strcmp( argv[1], "gpu") ) {
+#if DMSHADOW_USE_CUDA==1
net = new ConvNet<gpu>( batch_size, insize, nchannel, ksize, kstride, psize, num_out );
+#endif
}else{
net = new ConvNet<cpu>( batch_size, insize, nchannel, ksize, kstride, psize, num_out );
}
diff --git a/example/neuralnet/nnet.cu b/example/neuralnet/nnet.cu
index 75c623a..a1b4dc2 100644
--- a/example/neuralnet/nnet.cu
+++ b/example/neuralnet/nnet.cu
@@ -135,7 +135,9 @@ int main( int argc, char *argv[] ){
// choose which version to use
INNet *net;
if( !strcmp( argv[1], "gpu") ) {
+#if DMSHADOW_USE_CUDA==1
net = new NNet<gpu>( batch_size, num_in, num_hidden, num_out );
+#endif
}else{
net = new NNet<cpu>( batch_size, num_in, num_hidden, num_out );
}
[incubator-mxnet] 14/28: Merge pull request #7 from reyoung/master
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 2329ca0501aece29d53be07113dea3bb5e1a510d
Merge: 751996a 9839379
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Wed May 28 09:16:37 2014 -0700
Merge pull request #7 from reyoung/master
Fix issue #6, the patch needs some modifications, will be done in next commit.
mshadow/tensor_random.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
[incubator-mxnet] 23/28: Merge branch 'master' of
https://github.com/SiNZeRo/mshadow
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 4b69a128b5d4a8767c5b1ef4ea7f9e69c6e0601a
Merge: 46489a7 e294d63
Author: SiNZeRo <fl...@gmail.com>
AuthorDate: Sat Dec 27 14:29:54 2014 +0000
Merge branch 'master' of https://github.com/SiNZeRo/mshadow
[incubator-mxnet] 07/28: add better warning about cuda device
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit ab2776fe77c6d5de8eb3972297ed833876382fff
Author: antinucleon <an...@gmail.com>
AuthorDate: Tue Apr 15 10:36:03 2014 -0600
add better warning about cuda device
---
mshadow/tensor_gpu-inl.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mshadow/tensor_gpu-inl.hpp b/mshadow/tensor_gpu-inl.hpp
index 4eaf514..a2c1fc4 100644
--- a/mshadow/tensor_gpu-inl.hpp
+++ b/mshadow/tensor_gpu-inl.hpp
@@ -28,7 +28,7 @@ namespace mshadow {
int device_id = 0;
int device_count = 0;
cudaGetDeviceCount(&device_count);
-
+ utils::Assert(device_count > 0, "Cannot find CUDA device. Please check CUDA-Configuration");
if (dev_id < 0) {
#if (MSHADOW_USE_NVML)
device_id = AutoSelectDevice(device_count);
@@ -131,7 +131,7 @@ namespace mshadow{
EShape eshape = ShapeCheck< ExpInfo<E>::kDim, E >::Check( exp.self() );
utils::Assert( eshape[dimkeep] == dst.shape[0], "reduction dimension do not match" );
// use equvalent form
- Shape<4> pshape = Shape4( eshape.ProdShape(dimkeep+1,EShape::kMaxShape), eshape[dimkeep],
+ Shape<4> pshape = Shape4( eshape.ProdShape(dimkeep+1,EShape::kMaxShape), eshape[dimkeep],
eshape.ProdShape(1,dimkeep), eshape[0] );
// call equavalent map red dim 2
cuda::MapReduceKeepDim2<Saver,Reducer>( dst, MakePlan( exp.self() ), scale, pshape );
[incubator-mxnet] 12/28: Merge pull request #5 from reyoung/patch-1
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 751996a2bb2b7f72df92dbca91e88f0a389a741d
Merge: dcdc73d b342424
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Mon May 26 09:05:18 2014 -0700
Merge pull request #5 from reyoung/patch-1
Update tensor_gpu-inl.cuh
mshadow/cuda/tensor_gpu-inl.cuh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[incubator-mxnet] 15/28: Update tensor_random.h
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit b998f9c4315e4a32b64ebdc995c421f6650c0a3a
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Wed May 28 09:20:34 2014 -0700
Update tensor_random.h
update patch by in #7 by @reyoung . buffer_.Resize is dangerous because it could potentially change the content of data
---
mshadow/tensor_random.h | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/mshadow/tensor_random.h b/mshadow/tensor_random.h
index edb9c78..9d10329 100644
--- a/mshadow/tensor_random.h
+++ b/mshadow/tensor_random.h
@@ -251,12 +251,7 @@ namespace mshadow {
*/
template<int dim>
inline expr::ReshapeExp<Tensor<gpu,1>,dim,1> gaussian( Shape<dim> shape, real_t mu=0.0f, real_t sigma=1.0f){
- int sz = shape.Size();
- bool odd = sz %2;
- if(odd){
- ++sz;
- }
- buffer_.Resize( Shape1( sz ) );
+ buffer_.Resize( Shape1( ((shape.Size() + 1UL)<<1)>>1 ) );
curandStatus_t status;
#if MSHADOW_SINGLE_PRECISION
status = curandGenerateNormal(gen_, buffer_.dptr, buffer_.shape[0], mu, sigma);
@@ -264,10 +259,7 @@ namespace mshadow {
status = curandGenerateNormalDouble(gen_, buffer_.dptr, buffer_.shape[0], mu, sigma);
#endif
utils::Assert(status == CURAND_STATUS_SUCCESS, "CURAND Gen Uniform failed\n");
- if(odd){
- buffer_.Resize(Shape1(sz-1));
- }
- return expr::reshape( buffer_, shape );
+ return expr::reshape( buffer_.Slice(0, shape.Size()), shape );
}
/*!
* \brief return a temporal expression storing standard uniform [0,1)
[incubator-mxnet] 22/28: add/test the support with Openblas in
Windows X64
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 46489a73511c54aa8748901ec71e28a35d29454c
Author: unknown <wt...@seis11.sepcnet.se.cuhk.edu.hk>
AuthorDate: Sat Dec 27 14:21:13 2014 +0000
add/test the support with Openblas in Windows X64
---
example/neuralnet/Makefile.openblas | 36 ++++++++++++++++++++++++++++++++++++
example/neuralnet/build_openblash.sh | 3 +++
example/neuralnet/convnet.cu | 2 ++
example/neuralnet/nnet.cu | 2 ++
4 files changed, 43 insertions(+)
diff --git a/example/neuralnet/Makefile.openblas b/example/neuralnet/Makefile.openblas
new file mode 100644
index 0000000..ef82c11
--- /dev/null
+++ b/example/neuralnet/Makefile.openblas
@@ -0,0 +1,36 @@
+# set LD_LIBRARY_PATH
+# echo "Link mshadow with precomplied Openblas"
+export OPENBLAS_ROOT=../../../OpenBLAS-v0.2.13-Win64-int32
+export CC = gcc
+export CXX = g++
+export NVCC =nvcc
+export CFLAGS = -Wall -O3 -msse3 -Wno-unknown-pragmas -funroll-loops -I../../ -I$(OPENBLAS_ROOT)/include -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_MKL=0 -DMSHADOW_USE_CBLAS=1 -D__APPLE__
+export LDFLAGS= -static -lpthread -lopenblas -L$(OPENBLAS_ROOT)/lib
+export NVCCFLAGS = -O3 --use_fast_math -ccbin $(CXX)
+
+# specify tensor path
+BIN = nnet convnet
+OBJ =
+CUOBJ =
+CUBIN =
+.PHONY: clean all
+
+all: $(BIN) $(OBJ) $(CUBIN) $(CUOBJ)
+
+nnet: nnet.cpp
+convnet: convnet.cpp
+
+$(BIN) :
+ $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS)
+
+$(OBJ) :
+ $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
+
+$(CUOBJ) :
+ $(NVCC) -c -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" $(filter %.cu, $^)
+
+$(CUBIN) :
+ $(NVCC) -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" -Xlinker "$(LDFLAGS)" $(filter %.cu %.cpp %.o, $^)
+
+clean:
+ $(RM) $(OBJ) $(BIN) $(CUBIN) $(CUOBJ) *~
diff --git a/example/neuralnet/build_openblash.sh b/example/neuralnet/build_openblash.sh
new file mode 100644
index 0000000..dd33f2c
--- /dev/null
+++ b/example/neuralnet/build_openblash.sh
@@ -0,0 +1,3 @@
+mv nnet.cu nnet.cpp
+mv convnet.cu convnet.cpp
+make -f Makefile.openblas
\ No newline at end of file
diff --git a/example/neuralnet/convnet.cu b/example/neuralnet/convnet.cu
index 448810e..de8f65b 100644
--- a/example/neuralnet/convnet.cu
+++ b/example/neuralnet/convnet.cu
@@ -202,7 +202,9 @@ int main( int argc, char *argv[] ){
// choose which version to use
INNet *net;
if( !strcmp( argv[1], "gpu") ) {
+#if DMSHADOW_USE_CUDA==1
net = new ConvNet<gpu>( batch_size, insize, nchannel, ksize, kstride, psize, num_out );
+#endif
}else{
net = new ConvNet<cpu>( batch_size, insize, nchannel, ksize, kstride, psize, num_out );
}
diff --git a/example/neuralnet/nnet.cu b/example/neuralnet/nnet.cu
index 75c623a..a1b4dc2 100644
--- a/example/neuralnet/nnet.cu
+++ b/example/neuralnet/nnet.cu
@@ -135,7 +135,9 @@ int main( int argc, char *argv[] ){
// choose which version to use
INNet *net;
if( !strcmp( argv[1], "gpu") ) {
+#if DMSHADOW_USE_CUDA==1
net = new NNet<gpu>( batch_size, num_in, num_hidden, num_out );
+#endif
}else{
net = new NNet<cpu>( batch_size, num_in, num_hidden, num_out );
}
[incubator-mxnet] 27/28: Merge branch 'master' of
https://github.com/SiNZeRo/mshadow
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 5bdd59d232df199bad01396da45562b1c8976ce6
Merge: d39c23b 540d7d3
Author: SiNZeRo <fl...@gmail.com>
AuthorDate: Sat Dec 27 14:52:03 2014 +0000
Merge branch 'master' of https://github.com/SiNZeRo/mshadow
[incubator-mxnet] 04/28: Fix compilation on GCC in C++11 mode.
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 6ccbd5551020dfec1d6089d45d68dc36c18bf7c3
Author: Jan Bujak <j+...@jabster.pl>
AuthorDate: Sat Apr 12 23:09:27 2014 +0200
Fix compilation on GCC in C++11 mode.
---
mshadow/tensor_base.h | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/mshadow/tensor_base.h b/mshadow/tensor_base.h
index 414c199..60591a7 100644
--- a/mshadow/tensor_base.h
+++ b/mshadow/tensor_base.h
@@ -100,6 +100,12 @@ extern "C"{
/*! \brief cpu force inline */
#define MSHADOW_CINLINE inline __attribute__((always_inline))
+#if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L
+ #define MSHADOW_CONSTEXPR constexpr
+#else
+ #define MSHADOW_CONSTEXPR const
+#endif
+
/*! \brief namespace for mshadow */
namespace mshadow {
/*! \brief buffer size for each random number generator */
@@ -167,9 +173,9 @@ namespace mshadow {
a = b;
}
/*! \brief helper constant to use BLAS, alpha */
- const static real_t kAlphaBLAS = 1.0f;
+ MSHADOW_CONSTEXPR static real_t kAlphaBLAS = 1.0f;
/*! \brief helper constant to use BLAS, beta */
- const static real_t kBetaBLAS = 0.0f;
+ MSHADOW_CONSTEXPR static real_t kBetaBLAS = 0.0f;
/*! \brief corresponding binary operator type */
typedef op::right OPType;
};
@@ -180,9 +186,9 @@ namespace mshadow {
a += b;
}
/*! \brief helper constant to use BLAS, alpha */
- const static real_t kAlphaBLAS = 1.0f;
+ MSHADOW_CONSTEXPR static real_t kAlphaBLAS = 1.0f;
/*! \brief helper constant to use BLAS, beta */
- const static real_t kBetaBLAS = 1.0f;
+ MSHADOW_CONSTEXPR static real_t kBetaBLAS = 1.0f;
/*! \brief corresponding binary operator type */
typedef op::plus OPType;
};
@@ -193,9 +199,9 @@ namespace mshadow {
a -= b;
}
/*! \brief helper constant to use BLAS, alpha */
- const static real_t kAlphaBLAS = -1.0f;
+ MSHADOW_CONSTEXPR static real_t kAlphaBLAS = -1.0f;
/*! \brief helper constant to use BLAS, beta */
- const static real_t kBetaBLAS = 1.0f;
+ MSHADOW_CONSTEXPR static real_t kBetaBLAS = 1.0f;
/*! \brief corresponding binary operator type */
typedef op::minus OPType;
};
@@ -246,7 +252,7 @@ namespace mshadow {
return 1.0f;
}
/*! \brief an intial value of reducer */
- const static real_t kInitV = 0.0f;
+ MSHADOW_CONSTEXPR static real_t kInitV = 0.0f;
};
/*! \brief maximum reducer */
struct maximum {
@@ -261,9 +267,9 @@ namespace mshadow {
}
/*! \brief an intial value of reducer */
#if MSHADOW_SINGLE_PRECISION
- const static real_t kInitV = -FLT_MAX;
+ MSHADOW_CONSTEXPR static real_t kInitV = -FLT_MAX;
#else
- const static real_t kInitV = -DBL_MAX;
+ MSHADOW_CONSTEXPR static real_t kInitV = -DBL_MAX;
#endif
};
};
[incubator-mxnet] 01/28: add tutorial for exp template
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 07fe6f3b45ee27433a451cca310b4189b0a9af91
Author: tqchen <ti...@gmail.com>
AuthorDate: Thu Apr 10 12:17:03 2014 -0700
add tutorial for exp template
---
example/Makefile | 1 -
example/exp-template/Makefile | 18 ++++++++++++++++++
example/exp-template/README.md | 4 ++++
example/exp-template/exp_lazy.cpp | 39 +++++++++++++++++++++++++++++++++++++++
4 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/example/Makefile b/example/Makefile
index b0f0c36..44e8152 100644
--- a/example/Makefile
+++ b/example/Makefile
@@ -1,5 +1,4 @@
# set LD_LIBRARY_PATH
-
export CC = gcc
export CXX = g++
export NVCC =nvcc
diff --git a/example/exp-template/Makefile b/example/exp-template/Makefile
new file mode 100644
index 0000000..1e516ba
--- /dev/null
+++ b/example/exp-template/Makefile
@@ -0,0 +1,18 @@
+# set LD_LIBRARY_PATH
+export CC = gcc
+export CXX = g++
+export CFLAGS = -Wall -O3
+# specify tensor path
+BIN = exp_lazy
+
+.PHONY: clean all
+
+all: $(BIN)
+
+exp_lazy: exp_lazy.cpp
+
+$(BIN) :
+ $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
+
+clean:
+ rm -rf $(BIN) *~
diff --git a/example/exp-template/README.md b/example/exp-template/README.md
new file mode 100644
index 0000000..8c30a29
--- /dev/null
+++ b/example/exp-template/README.md
@@ -0,0 +1,4 @@
+This folder is not example of mshadow code.
+It is example code introducing expression template, the trick behind mshadow.
+
+See: https://github.com/tqchen/mshadow/wiki/Expression-Template
diff --git a/example/exp-template/exp_lazy.cpp b/example/exp-template/exp_lazy.cpp
new file mode 100644
index 0000000..3d25fe1
--- /dev/null
+++ b/example/exp-template/exp_lazy.cpp
@@ -0,0 +1,39 @@
+#include <cstdio>
+// Example Lazy evaluation code
+struct Vec;
+// expression structure holds the expression
+struct BinaryAddExp{
+ const Vec& lhs;
+ const Vec& rhs;
+ BinaryAddExp(const Vec& lhs, const Vec& rhs):lhs(lhs),rhs(rhs){}
+};
+// no constructor and destructor to allocate and de-allocate memory, allocation done by user
+struct Vec {
+ int len;
+ float* dptr;
+ Vec (void){}
+ Vec (float *dptr, int len):len(len),dptr(dptr){}
+ // here is where evaluation happens
+ inline Vec& operator= (const BinaryAddExp& src){
+ for( int i=0; i< src.lhs.len; ++ i ){
+ dptr[i] = src.lhs.dptr[i] + src.rhs.dptr[i];
+ }
+ return *this;
+ }
+};
+// no evaluation happens here
+inline BinaryAddExp operator+ (const Vec& lhs, const Vec& rhs){
+ return BinaryAddExp(lhs, rhs);
+}
+
+const int n = 3;
+int main( void ){
+ float sa[n]={1,2,3},sb[n]={2,3,4},sc[n]={3,4,5};
+ Vec A(sa,n), B(sb,n), C(sc,n);
+ // run expression
+ A = B + C;
+ for( int i = 0; i < n; ++ i ){
+ printf("%d:%f==%f+%f\n", i, A.dptr[i], B.dptr[i], C.dptr[i] );
+ }
+ return 0;
+}
[incubator-mxnet] 03/28: add op
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 0f341fa1826425d1722fa9b87fc61ec5caeff58b
Author: tqchen <ti...@gmail.com>
AuthorDate: Thu Apr 10 13:53:41 2014 -0700
add op
---
example/exp-template/Makefile | 3 +-
example/exp-template/exp_template_op.cpp | 84 ++++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+), 1 deletion(-)
diff --git a/example/exp-template/Makefile b/example/exp-template/Makefile
index 68d6168..9063989 100644
--- a/example/exp-template/Makefile
+++ b/example/exp-template/Makefile
@@ -3,7 +3,7 @@ export CC = gcc
export CXX = g++
export CFLAGS = -Wall -O3
# specify tensor path
-BIN = exp_lazy exp_template
+BIN = exp_lazy exp_template exp_template_op
.PHONY: clean all
@@ -11,6 +11,7 @@ all: $(BIN)
exp_lazy: exp_lazy.cpp
exp_template: exp_template.cpp
+exp_template_op: exp_template_op.cpp
$(BIN) :
$(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
diff --git a/example/exp-template/exp_template_op.cpp b/example/exp-template/exp_template_op.cpp
new file mode 100644
index 0000000..4399936
--- /dev/null
+++ b/example/exp-template/exp_template_op.cpp
@@ -0,0 +1,84 @@
+// Example code, expression template
+// with binary operator definition and extension
+// for simplicity, we use struct and make all members public
+
+#include <cstdio>
+
+// this is expression, all expressions must inheritate it, and put their type in subtype
+template<typename SubType>
+struct Exp{
+ // returns const reference of the actual type of this expression
+ inline const SubType& self(void) const{
+ return *static_cast<const SubType*>(this);
+ }
+};
+
+// binary operators
+struct mul{
+ inline static float Map(float a, float b){
+ return a * b;
+ }
+};
+
+// binary add expression
+// note how it is inheritates from Exp
+// and put its own type into the template argument
+template<typename OP,typename TLhs, typename TRhs>
+struct BinaryMapExp: public Exp< BinaryMapExp<OP,TLhs,TRhs> >{
+ const TLhs& lhs;
+ const TRhs& rhs;
+ BinaryMapExp(const TLhs& lhs, const TRhs& rhs):lhs(lhs),rhs(rhs){}
+ // evaluation function, evaluate this expression at position i
+ inline float Eval( int i ) const{
+ return OP::Map( lhs.Eval(i), rhs.Eval(i) );
+ }
+};
+// no constructor and destructor to allocate and de-allocate memory, allocation done by user
+struct Vec: public Exp<Vec>{
+ int len;
+ float* dptr;
+ Vec (void){}
+ Vec (float *dptr, int len):len(len),dptr(dptr){}
+ // here is where evaluation happens
+ template<typename EType>
+ inline Vec& operator= (const Exp<EType>& src_){
+ const EType &src = src_.self();
+ for( int i=0; i < len; ++i ){
+ dptr[i] = src.Eval(i);
+ }
+ return *this;
+ }
+ // evaluation function, evaluate this expression at position i
+ inline float Eval( int i ) const{
+ return dptr[i];
+ }
+};
+// template add, works for any expressions
+template<typename OP,typename TLhs, typename TRhs>
+inline BinaryMapExp<OP,TLhs,TRhs> F(const Exp<TLhs>& lhs, const Exp<TRhs>& rhs){
+ return BinaryMapExp<OP,TLhs,TRhs>(lhs.self(), rhs.self());
+}
+
+template<typename TLhs, typename TRhs>
+inline BinaryMapExp<mul,TLhs,TRhs> operator* (const Exp<TLhs>& lhs, const Exp<TRhs>& rhs){
+ return F<mul>(lhs, rhs);
+}
+
+// user defined operation
+struct maximum{
+ inline static float Map(float a, float b){
+ return a > b ? a : b;
+ }
+};
+
+const int n = 3;
+int main( void ){
+ float sa[n]={1,2,3},sb[n]={2,3,4},sc[n]={3,4,5};
+ Vec A(sa,n), B(sb,n), C(sc,n);
+ // run expression, this expression is longer:)
+ A = B * F<maximum>(C, B);
+ for( int i = 0; i < n; ++ i ){
+ printf("%d:%f==%f*max(%f,%f)\n", i, A.dptr[i], B.dptr[i], C.dptr[i], B.dptr[i] );
+ }
+ return 0;
+}
[incubator-mxnet] 26/28: add/test the support with Openblas in
Windows X64
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit d39c23bc9235fad00528ea6fdb5d0caed7f0c8b6
Merge: bc8aa84 4b69a12
Author: SiNZeRo <fl...@gmail.com>
AuthorDate: Sat Dec 27 14:37:46 2014 +0000
add/test the support with Openblas in Windows X64
example/basic-matrix-dot.cpp | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --cc example/basic-matrix-dot.cpp
index 0000000,0000000..5c5485b
new file mode 100644
--- /dev/null
+++ b/example/basic-matrix-dot.cpp
@@@ -1,0 -1,0 +1,20 @@@
++// header file to use mshadow
++#include "mshadow/tensor.h"
++// this namespace contains all data structures, functions
++using namespace mshadow;
++// this namespace contains all operator overloads
++using namespace mshadow::expr;
++
++int main( void ){
++ // intialize tensor engine before using tensor operation, needed for CuBLAS
++ InitTensorEngine();
++
++ Tensor<cpu,2> mat = NewTensor<cpu>( Shape2(1000,1000), 1.0 );
++ for (int i=0;i<100;i++)
++ mat = dot(mat, mat);
++ FreeSpace(mat);
++ // shutdown tensor enigne after usage
++
++ ShutdownTensorEngine();
++ return 0;
++}
[incubator-mxnet] 09/28: Update Makefile
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit a92044c08f2b77771058fad6305ba595a4f28d02
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Fri May 16 16:57:52 2014 -0700
Update Makefile
---
example/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/example/Makefile b/example/Makefile
index 44e8152..cceb356 100644
--- a/example/Makefile
+++ b/example/Makefile
@@ -19,7 +19,7 @@ basic: basic.cpp
defop: defop.cpp
$(BIN) :
- $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
+ $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS)
$(OBJ) :
$(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
[incubator-mxnet] 28/28: Merge pull request #18 from SiNZeRo/master
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 843e51d1e71e9286fbebc92135effda45ef77840
Merge: c87fa59 5bdd59d
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Sun Dec 28 09:27:12 2014 +0800
Merge pull request #18 from SiNZeRo/master
Thanks! This is very helpful! I noticed that only change of Makefile is needed.
BTW I am working on a refactored version of mshadow and it is comming soon.
https://github.com/tqchen/mshadow/tree/refactor
It would be great if you like to try it out latter
example/Makefile.openblas | 37 ++++++++++++++++++++++++++++++++++++
example/basic-matrix-dot.cpp | 20 +++++++++++++++++++
example/neuralnet/Makefile.openblas | 36 +++++++++++++++++++++++++++++++++++
example/neuralnet/build_openblash.sh | 3 +++
example/neuralnet/convnet.cu | 2 ++
example/neuralnet/nnet.cu | 2 ++
6 files changed, 100 insertions(+)
[incubator-mxnet] 08/28: Update Makefile
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 1cc000001d3f3aa54cd0c455eacb352274e1fc1e
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Fri May 16 16:57:22 2014 -0700
Update Makefile
change ldflag potision
---
example/neuralnet/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/example/neuralnet/Makefile b/example/neuralnet/Makefile
index bec7d0e..7cb45e4 100644
--- a/example/neuralnet/Makefile
+++ b/example/neuralnet/Makefile
@@ -26,7 +26,7 @@ nnet: nnet.cu
convnet: convnet.cu
$(BIN) :
- $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
+ $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS)
$(OBJ) :
$(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
[incubator-mxnet] 18/28: Update tensor.h
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 390e991aa56152c1f61be8994c7791bcd195f0fc
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Mon Aug 4 13:06:10 2014 -0700
Update tensor.h
---
mshadow/tensor.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mshadow/tensor.h b/mshadow/tensor.h
index b7f4d41..033540a 100644
--- a/mshadow/tensor.h
+++ b/mshadow/tensor.h
@@ -450,7 +450,7 @@ namespace mshadow{
template<typename Saver, typename Reducer, int dimkeep, typename E, int etype>
inline void MapReduceKeepHighDim( Tensor<cpu,1> dst, const expr::Exp<E,etype> &exp, real_t scale = 1.0f );
/*! \brief refer to comment of cpu ver \sa MapReduceKeepHighDim */
- template<typename Saver, typename Reducer, typename E, int etype>
+ template<typename Saver, typename Reducer, int dimkeep, typename E, int etype>
inline void MapReduceKeepHighDim( Tensor<gpu,1> dst, const expr::Exp<E,etype> &exp, real_t scale = 1.0f );
};// namespace mshadow
[incubator-mxnet] 17/28: Update tensor_random.h
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 99f85f4c1023bd91a513a070c46516972f4ea5d7
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Sat Jun 7 10:33:58 2014 -0700
Update tensor_random.h
---
mshadow/tensor_random.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mshadow/tensor_random.h b/mshadow/tensor_random.h
index e22400b..b3f0b84 100644
--- a/mshadow/tensor_random.h
+++ b/mshadow/tensor_random.h
@@ -251,7 +251,7 @@ namespace mshadow {
*/
template<int dim>
inline expr::ReshapeExp<Tensor<gpu,1>,dim,1> gaussian( Shape<dim> shape, real_t mu=0.0f, real_t sigma=1.0f){
- size_t aligned_sz = ((shape.Size() + 1UL)<<1)>>1;
+ size_t aligned_sz = ((shape.Size() + 1UL)>>1)<<1;
// allocate alligned size
buffer_.Resize( Shape1( aligned_sz ) );
buffer_.Resize( Shape1( shape.Size() ) );
[incubator-mxnet] 11/28: Update tensor_gpu-inl.cuh
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit b342424be63d6ed64145492db848c46f3dc9028d
Author: reyoung <I...@reyoung.me>
AuthorDate: Mon May 26 16:41:33 2014 +0800
Update tensor_gpu-inl.cuh
The function GetAlignStride is not inline, that will make multiple source file which include this file link error 'Redefine of function GetAlignStride'. Make this function inline will solve this.
---
mshadow/cuda/tensor_gpu-inl.cuh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mshadow/cuda/tensor_gpu-inl.cuh b/mshadow/cuda/tensor_gpu-inl.cuh
index af5e678..3739db2 100644
--- a/mshadow/cuda/tensor_gpu-inl.cuh
+++ b/mshadow/cuda/tensor_gpu-inl.cuh
@@ -32,7 +32,7 @@ namespace mshadow{
const int kBaseGridNum = 1024;
/*! \brief get align stride for given size in x dimension */
- index_t GetAlignStride( index_t xsize, index_t xstride ){
+ inline index_t GetAlignStride( index_t xsize, index_t xstride ){
if( (xstride & (kMemUnit-1)) == 0 ){
return ( (xsize + kMemUnit - 1) >> kMemUnitBits) << kMemUnitBits;
}else{