Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caffe on Windows #15

Closed
bearpaw opened this issue Dec 12, 2013 · 234 comments
Closed

Caffe on Windows #15

bearpaw opened this issue Dec 12, 2013 · 234 comments

Comments

@bearpaw
Copy link

bearpaw commented Dec 12, 2013

I have successfully run Caffe on Ubuntu 12.04. I am wondering whether Caffe is able to run on Windows system?

@shelhamer
Copy link
Member

In principle compiling and running on Windows is possible, but we do not have a Makefile for it, nor do we currently plan on supporting it. However, contributions to this end are welcome!

@niuzhiheng
Copy link
Contributor

I have ported Caffe to Windows. It is built by Visual Studio 2012.

@shelhamer shelhamer reopened this Feb 11, 2014
@shelhamer
Copy link
Member

Thank you for porting Caffe! Could you publish your code on your fork? We do not officially support windows yet, but we could direct others interested in running Caffe on windows to your work.

@niuzhiheng
Copy link
Contributor

Yes, I created a new branch named as "windows" on my own repository.

You may refer to the installation guide for more details.

Look forward to any feedback from all of you.

@nian-liu
Copy link

nian-liu commented Mar 5, 2014

@niuzhiheng Can your windows version codes run in a VS2010 environment?

@niuzhiheng
Copy link
Contributor

I am not sure for VS2010, but it has been confirmed that both VS2012 professional and VS2012 express are OK. There are two main concerns for other Visual Studio versions:

  1. whether std::thread is working fine with other versions earlier than VS2012.
  2. 3rd-party libraries may need to be rebuilt correspondingly, e.g. OpenCV.

@nian-liu
Copy link

nian-liu commented Mar 6, 2014

@niuzhiheng I am wondering could I have your mail ID - I have some questions in building caffe by vs 2010 and would like to get some directions from you. My gmail is liunian228@gmail.com, thanks in advance!

@zgxiangyang
Copy link

@niuzhiheng I have downloaded your fork, but i can only find the ".dll" files, no ".h" files and "*.lib" files of "3rdparty."
it is not easy to build these "x64" libraries in windows, can you share it in the project too? thanks!

@niuzhiheng
Copy link
Contributor

@zgxiangyang The dependencies can be download from here

You may refer to the installation guide for more details.

@zgxiangyang
Copy link

@niuzhiheng I have downloaded it before, there are only several".dll" files. But without the corresponding '.lib" files, I have no way to use it in my projects. I can only run the demo.
It's too hard for me to build my own libs.

@aybassiouny
Copy link

Thanks a lot @niuzhiheng, your windows port works handsomely on windows server 2012 with VS2012.

One note for others using the windows branch that took me sometime to figure, they should use the old architecture (the one with explicit padding layers) not the new one. i.e. in order to use the cifar sample, they should use this net architecture, not the one in master. Mnist example in master works smoothly as it does not have any padding layers.

@niuzhiheng
Copy link
Contributor

@aybassiouny you are correct. I am considering to update the windows port to new net architecture and up to date when caffe officially release 1.0 version.

@aybassiouny
Copy link

@niuzhiheng new PR is out!

@thuanvh
Copy link

thuanvh commented Jun 24, 2014

Hi, I am planning to compile caffe in win32. It seems the dependencies building is difficult. @niuzhiheng Could you help to build win32 dependencies files and share it.

@bhack
Copy link
Contributor

bhack commented Jun 24, 2014

Cmake can generate Visual Studio files.
Take a look at #442
Instead Mxe[¹] and Cmake could be a good base for compile with mingw for windows target on linux
[1]http://mxe.cc/

@kloudkl
Copy link
Contributor

kloudkl commented Jun 24, 2014

Not all the dependencies are compatible with Windows. For example, the pthread used by the various data layer to prefetch the data is only available on Linux/Unix. If they are not replaced by boost::thread, you can only simulate Linux with MinGW or Cygwin. In my experiences, they brought up too many unnecessary complications and are not suitable for running complex projects such as Caffe and it's dependencies.

If you do want to use Caffe, install the latest version of Ubuntu which is the most popular and the easiest Linux OS.

@niuzhiheng
Copy link
Contributor

@kloudkl is right. The official Linux version is well supported by the Caffe community with frequent updates and discussions. The windows porting currently has many limitations and most importantly it is lacking community support.

One may start with this windows porting, if you quite rely on visual studio as your favorite IDE. Once you become familiar with Caffe, you'd better deploy from the official branches.

@aybassiouny
Copy link

I have managed to compile latest caffe using #442, it is kind of a hellish process, but overall I fixed major errors following footsteps of @niuzhiheng's port.

I am a total newbie to github, should I submit it as a pull request to to the windows port?

@thuanvh
Copy link

thuanvh commented Jun 29, 2014

I am interested in caffe for windows. Could you push your changes to github? Could you create a branch and push it up? @aybassiouny

-----Thư Gốc-----
Từ: "aybassiouny" notifications@github.com
Gửi: ‎29/‎06/‎2014 6:13 SA
Đến: "BVLC/caffe" caffe@noreply.github.com
Cc: "thuanvh" thuanvh@gmail.com
Chủ đề: Re: [caffe] Caffe on Windows (#15)

I have managed to compile latest caffe using #442, it is kind of a hellish process, but overall I fixed major errors following footsteps of @niuzhiheng's port.
I am a total newbie to github, should I submit it as a pull request to to the windows port?

Reply to this email directly or view it on GitHub.

@shelhamer
Copy link
Member

@aybassiouny my advice is to coordinate with @niuzhiheng, who has kindly
kept the Windows port at his fork, to make you a collaborator on his repo
or otherwise submit a PR there.

A good first step is to push your Windows branch to your own fork and link
it in this thread for others to find.

On Sun, Jun 29, 2014 at 3:47 AM, thuanvh notifications@github.com wrote:

I am interested in caffe for windows. Could you push your changes to
github? Could you create a branch and push it up? @aybassiouny

-----Thư Gốc-----
Từ: "aybassiouny" notifications@github.com
Gửi: ‎29/‎06/‎2014 6:13 SA
Đến: "BVLC/caffe" caffe@noreply.github.com
Cc: "thuanvh" thuanvh@gmail.com
Chủ đề: Re: [caffe] Caffe on Windows (#15)

I have managed to compile latest caffe using #442, it is kind of a hellish
process, but overall I fixed major errors following footsteps of
@niuzhiheng's port.
I am a total newbie to github, should I submit it as a pull request to to
the windows port?

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#15 (comment).

@rbgirshick
Copy link
Contributor

You might also want to check with @s-gupta who has experience compiling and using caffe on Windows as part of an internship.

@wusx11
Copy link

wusx11 commented Jun 30, 2014

@niuzhiheng Excuse me, I'm trying to run your code on windows platform. But it seems the download link of the dependencies you gave are not available now...I'm not sure whether it's the problem of my network. Could you please check the download link? Thanks a lot!!!

@thuanvh
Copy link

thuanvh commented Jun 30, 2014

I have no problem in downloading dependencies of windows. https://dl.dropboxusercontent.com/u/3466743/caffe-vs2012/dependency.7z

@wusx11
Copy link

wusx11 commented Jun 30, 2014

@thuanvh Well, maybe there's something wrong with my network... I've already got the dependencies through other ways. Thanks!!

@niuzhiheng
Copy link
Contributor

Please use the updated download link if you use my updated code. Up to now, I have three versions, dependency.7z, dependency-20140514.7z, dependency-20140624.7z.
You may be able to see the correct one to use from the readme.md file in the code you are using.

@niuzhiheng
Copy link
Contributor

@aybassiouny and @shelhamer I am also interested in using CMake for windows porting. And I am very glad to have @aybassiouny as a collaborator to my repo if you want.

@willyd
Copy link
Contributor

willyd commented Oct 18, 2016

Hi everyone, I am the new windows branch maintainer. I just updated the windows branch with a CMake build and associated instructions. You can still find the old VS based build but I am deprecating it in favor of CMake which will be easier to keep up to date with the master branch.

This build has successfully been tested by @lunzueta, @PaulDufort and @recheliu. All feedback and contributions are appreciated. Please submit only windows related PRs to the windows branch and submit general (new layers, solvers, etc) to the master branch.

I will soon update the windows branch with the latest master changes, CUDA 8, VS 2015 and Python 3.5 support. I will send an update here when this is done.

@lunzueta
Copy link

Thank you for your hard work @willyd. This is very good news! :-D

@PaulDufort
Copy link

Thanks again @willyd, this will be a big help to a lot of people!

@willyd
Copy link
Contributor

willyd commented Oct 18, 2016

For those who would like to follow the latest master merge PR, here it is #4854.

@RoyiAvital
Copy link

RoyiAvital commented Oct 18, 2016

@willyd , This is great.
So happy to see someone jumping in.

Any chance for Offline compilation support as well?

Moreover,
Who is maintaining the MATLAB Support on Windows?

Thank You.

@willyd
Copy link
Contributor

willyd commented Oct 18, 2016

@RoyiAvital

Any chance for Offline compilation support as well?

Technically it is possible to build caffe offline. It is just a matter of getting the dependencies, you can either:

  • Build them yourself using caffe-builder as stated in the README on a networked machine and copy them over on the offline machine.
  • Download the prebuilt dependencies on a networked machine copy them over on the offline machine.

If you want python support download the conda packages you need and install them using conda install package.tar.bz2.

Moreover,
Who is maintaining the MATLAB Support on Windows?

I am, but would definitely appreciate some help on this. I have MATLAB at work but I do most of the maintenance on a machine that does not have MATLAB and I am not willing to pay a few K$ for a license. Plus Appveyor does not have MATLAB installed.

@ghost
Copy link

ghost commented Oct 18, 2016

thanks @willyd , I built with Visual C++ 2015 your new windows branch and was successful

@RoyiAvital
Copy link

RoyiAvital commented Oct 19, 2016

@willyd , I'm using Caffe on MATLAB.
I can assist with QA mostly as a user as I have zero knowledge in C / C++ programming.

One idea is use Octave if they have the same MEX API.

I have another idea to assist you with MATLAB.
Let me work on it, it might help.

The main issue on Windows + MATLAB is that the training never works.
It will always make MATLAB crash.

@willyd willyd added the windows label Oct 24, 2016
@willyd
Copy link
Contributor

willyd commented Oct 24, 2016

The latest master changes have been merged in the windows branch. See this commit

VS 2015 support is on going and should be merge relatively soon. See #4884.

Next up are support for Python 3.5 and Matlab. For MATLAB an issue has already been created: #4886.

PRs are always welcome!

@RoyiAvital
Copy link

@willyd , You are amazing.
Once you want me to test, I will test MATLAB on Windows (Windows 7 & 10).

As for now, the "Train" command in the MEX crashes MATLAB.

@willyd
Copy link
Contributor

willyd commented Oct 28, 2016

VS 2015 support was merged in windows branch #4884 .

@willyd
Copy link
Contributor

willyd commented Jan 14, 2017

Matlab support is now merged in the latest windows branch. @RoyiAvital you can test if it works for you.

@willyd
Copy link
Contributor

willyd commented Jan 18, 2017

Python 3.5 is now officially supported using MSVC 2015.

@willyd
Copy link
Contributor

willyd commented Jan 23, 2017

Hi everyone, I am seeking some help to port and test the latest parallelism changes that have been merge in the master branch. I created an issue about it here: #5216. If anyone is interested in helping to integrate this change into the windows branch please start a discussion in the mentioned issue.

@RoyiAvital
Copy link

@willyd , I can see there are Pre Built binaries.
Any chance for Bianries with Command Line & MATLAB support?

Then I will be able to assist and test for you.

Thank You.

@willyd
Copy link
Contributor

willyd commented Feb 1, 2017

@RoyiAvital

I am afraid that I won't provide prebuilt binaries with MATLAB support anytime soon. The prebuilt binaries are rebuilt automatically on the appveyor CI platform which does not have MATLAB installed.

Sorry about that.

@RoyiAvital
Copy link

@willyd ,

2 things:

  1. What about including a command line version (.EXE) of Caffe in the binaries?
  2. What if you had a MATLAB License, would you be able to create those binaries?

If the answer to 2 is yes, how could I contact you? I may be able to assist.

Thank You.

@willyd
Copy link
Contributor

willyd commented Feb 2, 2017

@RoyiAvital

  1. The prebuilt binaries do include the caffe.exe training and test executable. Look in the bin folder.
  2. It is not a matter of having access to a MATLAB license. I just don't have the time and resources to support people in building caffe more than I do now.

@shelhamer
Copy link
Member

Closing as the Windows branch is alive and well thanks to an incredible effort by many community contributors now led by @willyd!

@shelhamer shelhamer removed the wontfix label Mar 23, 2017
mbassov added a commit to mbassov/caffe that referenced this issue Nov 15, 2017
dev-31752: FRCNN layers should use opencv 3.
@alialaobali
Copy link

hi i have this error

-- Build files have been written to: C:/Users/ali alaobali/Downloads/caffe/caffe/build
ERROR: Configure failed

windows 10 64
cuda 9.1
python 3.5

@sotiraw
Copy link

sotiraw commented Oct 19, 2018

I have ported Caffe to Windows. It is built by Visual Studio 2012.

the standalone package
and the other dependencies links are not working.

could you please check? the proper version of dependencies ( and not current ) is a 'must have"

@gfursin
Copy link

gfursin commented Oct 19, 2018

I have ported Caffe to Windows. It is built by Visual Studio 2012.

the standalone package
and the other dependencies links are not working.

could you please check? the proper version of dependencies ( and not current ) is a 'must have"

If you want to have a customized Caffe build on Windows where you can interactively select which compilers and libraries to use, please try CK workflow for Caffe as described in #5675 (comment) .

I just tested it with VS 2015, Cuda 9.1, python 3.5 on Windows 10 and it worked:

> ck install package:lib-caffe-bvlc-master-cuda-universal --env.CAFFE_BUILD_PYTHON=ON

...

    1969 Warning(s)
    0 Error(s)

Time Elapsed 00:15:51.62

Cleaning obj directory ...

Setting up environment for installed package ...
  (full path = D:\Work1\CK\ck-repos\local\env\8de91522f81b4def\install\bin\caffe.exe)

  Software entry found: lib.caffe (04ab08137582bd03)

  -----------------------------------
  Resolving software dependencies ...

*** Dependency 1 = python (Python for interfacing):
    Resolved. CK environment UID = f47f482ae24324d8 (detected version 3.5.4)
*** Dependency 2 = cmake (cmake):
    Resolved. CK environment UID = 44e987ef54c06a62 (detected version 3.12.2)                                                                                                                     *** Dependency 3 = lib-boost (Boost library):
    Resolved. CK environment UID = 64ac7ac788930c11 (version 1.66.0-min-for-caffe)
*** Dependency 4 = lib-gflags (GFlags library):
    Resolved. CK environment UID = 16ba67a2cc4d44e0 (version 2.2.0)
*** Dependency 5 = lib-glog (GLog library):
    Resolved. CK environment UID = b412a9942d080bf7 (version 0.3.5-a6a166d)
*** Dependency 6 = compiler (C++ compiler):
    Resolved. CK environment UID = 292906849639dad6 (detected version 19.00.24215.1)
*** Dependency 7 = compiler-cuda (CUDA compiler >=7.0):
    Resolved. CK environment UID = 4305fdde084eaaa7 (detected version 9.1.85)
*** Dependency 8 = lib-cudnn (CUDA DNN library):
    Resolved. CK environment UID = d4af48fac2179aa0 (version 7.1.2)
*** Dependency 9 = lib-opencv (OpenCV library):
    Resolved. CK environment UID = c945df75bf3639a0 (version 3.3.0)
*** Dependency 10 = lib-lmdb (LMDB library):
    Resolved. CK environment UID = 03b1cb4c949bbcd5 (version 0.9.21-60d5002)
*** Dependency 11 = lib-hdf5 (HDF5 library):
    Resolved. CK environment UID = 37456a8e24a5612a (version 1.10.1)
*** Dependency 12 = lib-blas (BLAS library):
    Resolved. CK environment UID = f8839c461b73715f (version 0.3.3-fd8d1868)
*** Dependency 13 = lib-protobuf-host (ProtoBuf host compiler):
    Resolved. CK environment UID = a449d99601b2540b (version 3.5.1)
  -----------------------------------

Detected GIT revision:                 509dae05
Detected GIT date time of last commit: Wed Jan 3 10:20:53 2018 +0100

Environment entry updated (8de91522f81b4def)!

Recording CK configuration to D:\Work1\CK\ck-repos\local\env\8de91522f81b4def\ck-install.json ...

Installation path: D:\Work1\CK\ck-repos\local\env\8de91522f81b4def

Installation time: 1167.994200706482 sec.

After installation, you can detect other VS and CUDA versions as following:

> ck detect soft --tags=compiler,microsoft
> ck detect soft --tags=compiler,cuda

and then rebuild Caffe with new combinations of VS and CUDA as above. You can then use these customized builds from virtual environment as follows:

> ck show env
> ck virtual env --tags=lib,caffe

Hope it's of any help ;) ...

@willyd
Copy link
Contributor

willyd commented Oct 24, 2018

You can also try to use the conda packages. See #6569 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests