apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.78k stars 6.79k forks source link

Trying to install GPU version of mxnet on windows #3808

Closed robert604 closed 7 years ago

robert604 commented 8 years ago

I'm running into a problem when trying to install the GPU version of mxnet on windows 7. I've been following the instructions here: https://github.com/dmlc/mxnet/pull/1171/commits/9e59f7b05643fccce279c5e26f325fcaf1e39175

I have installed visual studio 2013 community edition and the cuda software from Nvidia.

In my mxnet\R-package\inst\libs\x64 directory I have the following dlls: 15/08/2015 04:21 PM 23,380,600 cublas64_75.dll 15/08/2015 04:21 PM 360,736 cudart64_75.dll 07/10/2016 02:37 PM 47,820,288 cudnn64_70.dll 15/08/2015 04:21 PM 45,030,520 curand64_75.dll 20/10/2014 08:08 AM 82,432 libgcc_s_seh-1.dll 20/10/2014 08:08 AM 1,279,488 libgfortran-3.dll 30/05/2016 10:34 PM 27,544,576 libmxnet.dll 24/03/2015 01:03 PM 38,340,126 libopenblas.dll 20/10/2014 08:08 AM 331,776 libquadmath-0.dll 15/08/2015 04:21 PM 14,495,744 nvrtc64_75.dll 14/02/2005 10:03 AM 162,816 unzip32.dll 04/10/2013 07:58 AM 137,376 vcomp120.dll

In a command prompt window I have added the R bin directory to the path. 'where R' gives the following output: c:\program files\R\r-3.3.1\bin\R.exe

I changed the current directory to the mxnet directory and entered the command: R CMD INSTALL --no-multiarch R-package

Here's the output with an error message:

I would appreciate any help to fix the problem.

Thanks

ameshkoff commented 7 years ago

I have exactly the same issue.

VoVAllen commented 7 years ago

https://github.com/dmlc/mxnet/issues/3644#issuecomment-258770447

Follow this one

ameshkoff commented 7 years ago

Made some progress but still have an error.

  1. First of all I added to the system PATH variable not only R itself but Rtools as well. For me it is "C:\Rtools\bin" and "C:\Rtools\gcc-4.6.3\bin". The error mentioned above was gone but I got another one.
  2. Removed Rtools 3.4 and replaced it with Rtools 3.2. They say it is more stable and has less isues.
  3. Corrected Makeconf file at %R_HOME%\etc\x64. I edited 19 and 20 lines so I have now

BINPREF ?= C:/Rtools/gcc-4.6.3/bin/ COMPILED_BY = gcc-4.6.3

But I still have an error though a new one.

c:\MXNet>R CMD INSTALL --no-multiarch R-package

  • installing to library 'C:/Users/electron_m/Documents/R/win-library/3.3'
  • installing source package 'mxnet' ... \ libs C:/Rtools/gcc-4.6.3/bin/g++ -m64 -shared -s -static-libgcc -o mxnet.dll tmp.def executor.o export.o io.o kvstore.o mxnet.o ndarray.o symbol.o -LC:/PROGRA~1/MICROS~1/MRO-33~1.1/bin/x64 -lRlapack -LC:/PROGRA~1/MICROS~1/MRO-33~1.1/bin/x64 -lRblas -L../inst/libs/x64/ -llibmxnet -LC:/swarm/workspace/External-R-3.3.1/vendor/extsoft/lib/x64 -LC:/swarm/workspace/External-R-3.3.1/vendor/extsoft/lib -LC:/PROGRA~1/MICROS~1/MRO-33~1.1/bin/x64 -lR c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmxnet c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../lib64/libstdc++.a(eh_exception.o):(.data$_ZTISt9exception[_ZTISt9exception]+0x0): multiple definition of typeinfo for std::exception' executor.o:executor.cc:(.rdata$_ZTISt9exception[_ZTISt9exception]+0x0): first defined here c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../lib64/libstdc++.a(stdexcept.o):(.data$_ZTISt13runtime_error[_ZTISt13runtime_error]+0x0): multiple definition oftypeinfo for std::runtime_error' executor.o:executor.cc:(.rdata$_ZTISt13runtime_error[_ZTISt13runtime_error]+0x0): first defined here c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../lib64/libstdc++.a(stdexcept.o):(.data$_ZTISt11range_error[_ZTISt11range_error]+0x0): multiple definition of `typeinfo for std::range_error' executor.o:executor.cc:(.rdata$_ZTISt11range_error[_ZTISt11range_error]+0x0): first defined here collect2: ld returned 1 exit status DLL не создан ERROR: compilation failed for package 'mxnet'
  • removing 'C:/Users/electron_m/Documents/R/win-library/3.3/mxnet'

I run R Open 3.3.1 (Microsoft version) and Rtools 3.2 on Windows 10 Home x64 system.

Thanks for any help!

robert604 commented 7 years ago

It seems that I did not have Rtools installed. So I installed it and tried again. I was unable to capture all of the error messages because of the buffer size for the command prompt window, but the tail end of the messages are given below. I ran the command again but the second time it exited quickly with an error which can be seen at the bottom.

In file included from export.cc:9:0: ./base.h: In function 'std::string mxnet::R::toPyString(const string&, const ROb ject&)': ./base.h:276:26: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < vec.size(); ++i) { ^ ./base.h: In function 'std::vector mxnet::R::Dim2InternalShape(con st Rcpp::Dimension&)': ./base.h:340:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < rshape.size(); ++i) { ^ export.cc: In static member function 'static void mxnet::R::Exporter::Export(con st string&)': export.cc:92:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < func_names.size(); ++i) { ^ c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I../ins t/include -I"C:/Users/Robert/Documents/R/win-library/3.3/Rcpp/include" -I"d:/C ompiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c io.cc -o io.o

In file included from io.cc:8:0: ./base.h: In function 'std::string mxnet::R::toPyString(const string&, const ROb ject&)': ./base.h:276:26: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < vec.size(); ++i) { ^ ./base.h: In function 'std::vector mxnet::R::Dim2InternalShape(con st Rcpp::Dimension&)': ./base.h:340:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < rshape.size(); ++i) { ^ io.cc: In constructor 'mxnet::R::ArrayDataIter::ArrayDataIter(const NumericVecto r&, const NumericVector&, const NumericVector&, int, bool)': io.cc:64:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] RCHECK(unif_rnds.size() == num_data); ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' /* NOLINT() / ^ io.cc: In static member function 'static void mxnet::R::ArrayDataIter::Convert(c onst NumericVector&, const std::vector&, std::sizet, st d::vectormxnet::R::NDArray)': io.cc:91:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (size_t i = 0; i < rshape.size() - 1; ++i) { ^ io.cc: In member function 'virtual SEXPREC\ mxnet::R::DataIterCreateFunction::op erator()(SEXPREC)': io.cc:178:24: warning: comparison between signed and unsigned integer expression s [-Wsign-compare] for (size_t i = 0; i < kwargs.size(); ++i) { ^ io.cc: In static member function 'static void mxnet::R::DataIterCreateFunction:: InitRcppModule()': io.cc:221:21: warning: comparison between signed and unsigned integer expression s [-Wsign-compare] for (int i = 0; i < out_size; ++i) { ^ c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I../ins t/include -I"C:/Users/Robert/Documents/R/win-library/3.3/Rcpp/include" -I"d:/C ompiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c kvstore.cc -o kvstore.o In file included from kvstore.cc:9:0: ./base.h: In function 'std::string mxnet::R::toPyString(const string&, const ROb ject&)': ./base.h:276:26: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < vec.size(); ++i) { ^ ./base.h: In function 'std::vector mxnet::R::Dim2InternalShape(con st Rcpp::Dimension&)': ./base.h:340:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < rshape.size(); ++i) { ^ kvstore.cc: In member function 'void mxnet::R::KVStore::Init(const std::vector<i nt>&, const List&)': kvstore.cc:17:22: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] RCHECK(keys.size() == weights.size()) ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' /* NOLINT() / ^ kvstore.cc: In member function 'void mxnet::R::KVStore::Push(const std::vector<i nt>&, const List&, const std::vector&)': kvstore.cc:32:24: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] for (size_t i = 0; i < weight_lists.size(); ++i) { ^ In file included from kvstore.cc:9:0: kvstore.cc:36:24: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] RCHECK(list.size() == keys.size()) ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' / NOLINT(_) / ^ kvstore.cc: In member function 'void mxnet::R::KVStore::Pull(const std::vector<i nt>&, const List&, const std::vector&)': kvstore.cc:62:24: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] for (size_t i = 0; i < out_lists.size(); ++i) { ^ In file included from kvstore.cc:9:0: kvstore.cc:66:23: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] RCHECK(src.size() == keys.size()) ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' / NOLINT(_) / ^ c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I../ins t/include -I"C:/Users/Robert/Documents/R/win-library/3.3/Rcpp/include" -I"d:/C ompiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c mxnet.cc -o m xnet.o In file included from mxnet.cc:8:0: ./base.h: In function 'std::string mxnet::R::toPyString(const string&, const ROb ject&)': ./base.h:276:26: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < vec.size(); ++i) { ^ ./base.h: In function 'std::vector mxnet::R::Dim2InternalShape(con st Rcpp::Dimension&)': ./base.h:340:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < rshape.size(); ++i) { ^ c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I../ins t/include -I"C:/Users/Robert/Documents/R/win-library/3.3/Rcpp/include" -I"d:/C ompiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c ndarray.cc -o ndarray.o In file included from ndarray.cc:7:0: ./base.h: In function 'std::string mxnet::R::toPyString(const string&, const ROb ject&)': ./base.h:276:26: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < vec.size(); ++i) { ^ ./base.h: In function 'std::vector mxnet::R::Dim2InternalShape(con st Rcpp::Dimension&)': ./base.h:340:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (sizet i = 0; i < rshape.size(); ++i) { ^ ndarray.cc: In member function 'void mxnet::R::NDArrayPacker::Push(const RObject Type&)': ndarray.cc:133:26: warning: comparison between signed and unsigned integer expre ssions [-Wsign-compare] RCHECK(shape.size() == rshape.size()) ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' / NOLINT(_) / ^ ndarray.cc:136:24: warning: comparison between signed and unsigned integer expre ssions [-Wsign-compare] RCHECK(shape_[i] == rshape[i]) ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' / NOLINT() */ ^ ndarray.cc: In member function 'Rcpp::NumericVector mxnet::R::NDArrayPacker::Get () const': ndarray.cc:153:21: warning: comparison between signed and unsigned integer expre ssions [-Wsign-compare] RCHECK(ret.size() == data.size()); ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' / NOLINT(_) / ^ ndarray.cc: In member function 'std::size_t mxnet::R::NDArray::Size() const': ndarray.cc:194:24: warning: comparison between signed and unsigned integer expre ssions [-Wsign-compare] for (sizet i = 0; i < dim.size(); ++i) { ^ ndarray.cc: In static member function 'static const void mxnet::R::NDArrayFunct ion::FindHandle(const string&)': ndarray.cc:452:21: warning: comparison between signed and unsigned integer expre ssions [-Wsign-compare] for (int i = 0; i < out_size; ++i) { ^ In file included from ndarray.cc:7:0: ndarray.cc: In function 'mxnet::R::NDArray::RObjectType mxnet::R::ndarray::Slice (const RObjectType&, mx_uint, mx_uint)': ndarray.cc:599:24: warning: comparison between signed and unsigned integer expre ssions [-Wsign-compare] RCHECK(dim[ndim - 1] >= end) ^ ./base.h:73:9: note: in definition of macro 'RCHECK' if (!(x)) RLOGFATAL << "RCheck failed: " #x << ' ' /* NOLINT() / ^ ndarray.cc: In static member function 'static void mxnet::R::NDArrayFunction::In itRcppModule()': ndarray.cc:633:21: warning: comparison between signed and unsigned integer expre ssions [-Wsign-compare] for (int i = 0; i < out_size; ++i) { ^ c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I../ins t/include -I"C:/Users/Robert/Documents/R/win-library/3.3/Rcpp/include" -I"d:/C ompiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c symbol.cc -o symbol.o In file included from symbol.cc:9:0: ./base.h: In function 'std::string mxnet::R::toPyString(const string&, const ROb ject&)': ./base.h:276:26: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < vec.size(); ++i) { ^ ./base.h: In function 'std::vector mxnet::R::Dim2InternalShape(con st Rcpp::Dimension&)': ./base.h:340:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (size_t i = 0; i < rshape.size(); ++i) { ^ symbol.cc: In member function 'void mxnet::R::Symbol::Compose(const List&, const string&)': symbol.cc:64:24: warning: comparison between signed and unsigned integer express ions [-Wsign-compare] for (sizet i = 0; i < kwargs.size(); ++i) { ^ symbol.cc: In member function 'SEXPREC mxnet::R::Symbol::InferShape(const List& ) const': symbol.cc:138:24: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] for (size_t i = 0; i < kwargs.size(); ++i) { ^ symbol.cc: In static member function 'static mxnet::R::Symbol::RObjectType mxnet ::R::Symbol::Group(const List&)': symbol.cc:205:24: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] for (size_t i = 0; i < kwargs.size(); ++i) { ^ symbol.cc: In member function 'virtual SEXPREC* mxnet::R::SymbolFunction::operat or()(SEXPREC)': symbol.cc:266:24: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] for (size_t i = 0; i < kwargs.size(); ++i) { ^ symbol.cc: In static member function 'static void mxnet::R::SymbolFunction::Init RcppModule()': symbol.cc:350:21: warning: comparison between signed and unsigned integer expres sions [-Wsign-compare] for (int i = 0; i < out_size; ++i) { ^ c:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o mxnet.dll tmp.def execut or.o export.o io.o kvstore.o mxnet.o ndarray.o symbol.o -LC:/PROGRA~1/R/R-33~1.1 /bin/x64 -lRlapack -LC:/PROGRA~1/R/R-33~1.1/bin/x64 -lRblas -L../inst/libs/x64/ -llibmxnet -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/loca l330/lib -LC:/PROGRA~1/R/R-33~1.1/bin/x64 -lR installing to C:/Users/Robert/Documents/R/win-library/3.3/mxnet/libs/x64 * R * demo * inst * preparing package for lazy loading \ help ** installing help indices * building package indices * installing vignettes * testing if installed package can be loaded Error in namespaceExport(ns, exports) : undefined exports: mx.nd.batch.dot, mx.nd.broadcast.axis, mx.nd.broadcast.powe r, mx.nd.broadcast.to, mx.nd.crop, mx.nd.expand.dims, mx.nd.flip, mx.nd.max.axis , mx.nd.min.axis, mx.nd.slice.axis, mx.nd.sum.axis Error: loading failed Execution halted ERROR: loading failed

c:\Downloads\Mxnet\mxnet>R CMD INSTALL --no-multiarch R-package

c:\Downloads\Mxnet\mxnet>

ameshkoff commented 7 years ago

I somehow did it. All the steps and tricks are listed below (except for ones described in the instruction):

  1. Download the master branch zip file and pre-built package of THE SAME date. Now it is 20160531 - date of the latest stable release. So I have "mxnet-20160531.zip" and "20160531_win10_x64_gpu".7z files to work. If you have one of them newer you could run into troubles.
  2. Place libmxnet.dll not in the "nocudnn/lib" directory but just in "libs" directory with other 11 libraries.
  3. Install Rtools if you didn't it before. If you have Rtools 3.3 or 3.4 downgrade to Rtools 3.2. I personally totaly removed Rtools 3.4 and install Rtools 3.2 from scratch.
  4. Add to the system PATH not only R itself but Rtools as well. For me it is "C:\Rtools\bin" and "C:\Rtools\gcc-4.6.3\bin". You can do it with installation of Rtools but it is not set by default.
  5. Correct Makeconf file at "%R_HOME%\etc\x64" if you have there new compiler (not gcc-4.6.3) written. I edited 19 and 20 lines so I have now

    BINPREF ?= C:/Rtools/gcc-4.6.3/bin/ COMPILED_BY = gcc-4.6.3

  6. Run R CMD INSTALL --no-multiarch R-package at least!

UPD. 7. If you have (unsuccesfull) buildings before: remove "R-package" directory and repeat all the steps listed in the instruction and above. The reason is some files are already builded in the wrong way (executor.o etc.) and they are not rebuilded by default. Maybe you can just remove all this wrongly builded files but I'm not sure which files to remove and which not.

It helped me so it can help you. Now I should try how (and if) MXNet works...

robert604 commented 7 years ago

ameshkoff thanks for the info. The instructions only mention "/mxnet/R-package". I am not able to find "mxnet-20160531.zip" that you are talking about. Where did you get this file from?

ameshkoff commented 7 years ago

@robert604 Go to the Releases page and download "Source code (zip)" file from "windows binary build 20160531" area. It is the snapshot of master branch 2016-05-31 or something like this I believe.

robert604 commented 7 years ago

@ameshkoff I did manage to install it successfully with the mxnet-20160531.zip file. There were a lot of warnings that had to do with comparison between signed and unsigned integer expressions but I assume it is installed properly since I am able to run the cpu portion of the mnist tutorial: http://mxnet.io/tutorials/r/mnistCompetition.html

Thank you very much for your help.

I haven't been able to get the gpu portion of the tutorial working. I get an error having to do with CUDNN_STATUS_ARCH_MISMATCH I'm not able to copy paste the entire message since rstudio has put up a dialogue asking me to start a new R session. Have you run into a problem like this?

ameshkoff commented 7 years ago

@robert604 Hmm, I don't even have en error message, just RStudio crash. R native GUI crashes as well. I also tried different CUDnn versions with no success. I'm going investigate it on weekend.

ameshkoff commented 7 years ago

@robert604 You should temporarily set environment variable MXNET_ENGINE_TYPE to NaiveEngine. It could help you to catch your error. As I could realize my build actually worked fine for me and it was just an "out of memory" error I couldn't catch due to multithreading engine. More about environment variables for MXNet here.

robert604 commented 7 years ago

My video card only has a capacity of 2.1 so that might be the reason for the error I'm getting. I'm not sure but it seems that the minimum capacity may be 3 to run mxnet.