This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
6 changed files
with
100 additions
and
0 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,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) *~ |
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,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; | ||
} |
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,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) *~ |
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,3 @@ | ||
mv nnet.cu nnet.cpp | ||
mv convnet.cu convnet.cpp | ||
make -f Makefile.openblas |
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
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