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:41 UTC

[incubator-mxnet] 21/28: add/test the support with Openblas in Windows X64

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 );
     }