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

Mac port #100

Closed
wants to merge 5 commits into from
Closed

Mac port #100

wants to merge 5 commits into from

Conversation

jpauwels
Copy link

@jpauwels jpauwels commented Feb 8, 2016

These change made it possible for me to build CNTK on OS X 10.11.3. Just a single commit deals with Mac-specific changes, the others correct non-standard linking behaviour that depends on luck and compiler implementation details (I'm surprised CNTK even links on Windows and Linux).

I based this PR on f628e52 because the Linux build is currently broken in master. I'll rebase this PR as soon as this is fixed.

I could only test the CPU-only version because I don't have an Nvidia GPU. On the other hand, I set up CI to test the changes with GCC 4.9 and 5.3 both on Linux and Mac, so I'm pretty confident they don't break anything (see Travis CI). Now I'd like someone to verify on a Windows machine.

In order to build on a Mac, you need an mpic++ that is built with GCC, which doesn't come standard with OS X. If you have homebrew, you can do: brew install gcc --without-multilib and then brew install --cc=gcc openmpi. You also need Intel MKL, because ACML is not available for Mac, but the former is freely available too (since recently).

This allows in-place builds in a directory with spaces in its path to compile. Out-of-place builds in paths with spaces would require changes to the Makefile too, but this is unfeasible due to the lack of support for spaces in the built-in make commands (such as "include", "wildcard", etc.).
@msftclas
Copy link

msftclas commented Feb 8, 2016

Hi @jpauwels, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@msftclas
Copy link

msftclas commented Feb 8, 2016

@jpauwels, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, MSBOT;

@jpauwels
Copy link
Author

I already tested the changes on Windows myself (see AppVeyor CI) and after a minor change, everything now compiles under Windows, OS X and Linux (still CPU-only though and based on f628e52).

@polidore
Copy link

is this going to be merged? i'd like to use CNTK on my mac!

@rashoodkhan
Copy link

Any update on this issue?

@n17s
Copy link
Member

n17s commented Nov 3, 2016

As long as we don't have infrastructure to automatically run nightly tests on OSX, this is extremely hard to do.

@jpauwels
Copy link
Author

jpauwels commented Nov 3, 2016

Thanks for finally acknowledging the existence of this pull request, it's only nine months old. If CI testing is the only problem, I made a Travis configuration file too as you can see in my first message. At the time I wrote it, Linux compilation was in a perpetual broken state as well, so your nightly tests weren't working anyway. This PR is probably too old now to be salvaged and I have sort of moved on to competing deep learning toolkits. I might be persuaded to try another mac port starting from the current head if there's enough interest and a chance it might be merged.

@n17s
Copy link
Member

n17s commented Nov 4, 2016

We use Jenkins, not Travis, on our own infrastructure. In the near future we will move Jenkins to Azure. At that point it will be a matter of Azure having OSX VMs. So it will probably take a long time.

@jpauwels
Copy link
Author

jpauwels commented Nov 4, 2016

Travis is free for open-source projects. So why not use it in addition to your own Jenkins? I can provide you with the configuration file.

@chrisbasoglu
Copy link
Member

chrisbasoglu commented Nov 4, 2016

Free Travis for OSX related build and test sounds interesting. Incorporating that into our current Jenkins based flow is not something we have discussed or planned up till now. We'd need to figure out GPU support, etc... We look into viability in our next sprint. Some OSX users have been doing CNTK inside Docker containers (no GPU).

@Boggartfly
Copy link

Boggartfly commented Dec 7, 2016

@n17s

We use Jenkins, not Travis, on our own infrastructure. In the near future we will move Jenkins to Azure. At that point it will be a matter of Azure having OSX VMs. So it will probably take a long time.

Apple allows VMs of it's OSX on Apple Hardware Only. Unless MS gets Mac Hardware to run OSX for Azure, there's probably no other way to expect a VM anytime soon.

@yaronyg
Copy link
Member

yaronyg commented Mar 7, 2017

@jpauwels For whatever it's worth I'm personally trying to get CNTK CPU only running on macOS again. Right now I'm not worrying about OpenCV or Python support but I plan on getting to them. I just finished getting the key dependencies built on macOS (e.g. C++ 4.8.4, Intel's MKL, OpenMPI, Zlib, LibZip, Protobuf and Boost) and am now going to use your changes as a guide to changing the latest version of CNTK and seeing if I can get things building.

yaronyg pushed a commit to yaronyg/CNTK that referenced this pull request Mar 8, 2017
WIP
build-macos.sh - Some minor changes to get CustomMKL to build on the mac.
I should probably combine this with build-linux.sh.

headers.txt - Had to add dnn headers needed by the newer version of MKL
I have to use because nobody knows how to download the mac version of
the old version that CNTK is currently using

For the next two files I'm just lifting things out of
microsoft#100

MakeFile - Making the file output so or dylib depending on platform

configure - Had to change bash ! header to deal with the fact that
Apple ships bash 3 and we need bash 4. This change in ! let's us install
bash 4 on the mac in a way that shouldn't mess with linux (I tested it
and it seemed fine). Needed to change 'stat' to use -c on the mac not -f
which isn't supported.
yaronyg pushed a commit to yaronyg/CNTK that referenced this pull request Mar 13, 2017
A huge debt of gratitude to microsoft#100
from which I stole shamelessly.

build-macos.sh - Make it use environment bash to match other changes we
made to .sh files. Also change the TAR file name to include macOS not Linux

Makefile - Added -mmacosx-version-min=10.7 and -D_XOPEN_SOURCE=700 so we
can support wcscasecmp and wcsncasecmp functions. But kept -D_XOPEN_SOURCE
=600 (as it was before) for everyone else.

File.cpp - limits.h has a different location on Apple than Linux so I
had to fix the path with a macro.

Platform.h - We needded to add strings.h and wchar.h. The changes to
mach_time & snprintf are taken straight from PR 100 in CNTK.

All files not explicitly called out had some combination of the following
three changes:
1.Changed malloc.h to malloc/malloc.h
2. Removing ifndef __unix__ and replacing with ifdef _WIN32
3. Added __APPLE__ to #ifdef __unix__
@cha-zhang
Copy link
Member

We are very interested in having Mac support for CNTK now that CNTK 2.0 has been released. Travis build would be fine for us. If anyone is willing to help, please!

@cha-zhang
Copy link
Member

This pull request has been too old to merge with the master. Closing it now.

As I mentioned, we are still interested in MAC support, and if someone could work on it, we will make sure to handle the PR as soon as possible.

@cha-zhang cha-zhang closed this Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants