Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Add Windows MKLDNN Building Instruction #10613

Merged
merged 8 commits into from
May 18, 2018
Merged

Conversation

xinyu-intel
Copy link
Contributor

Description

This is a raw instruction for windows users to build mxnet with mkldnn from source. The process is quite tedious and still needs some optimization.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@pengzhao-intel @zheng-da

MKL_README.md Outdated
2. Update mkldnn to the newest:
```
cd 3rdparty/mkldnn/ && git checkout master && git pull
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because mxnet doesn't point to the latest commit in mkldnn master branch, right now?
This is indeed awkward. Ideally, we don't want users to do it manually. but on the other hand, it's unclear if we should move to the latest commit in mkldnn repo right now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to agree with @zheng-da would refrain from adding this instruction. We should only support the versions which are part of our repository. If there's a need to upgrade, we'll have to do it here. Otherwise we're going to run into issues with people who upgrade on their own while we have not validated that version with our CI.

MKL_README.md Outdated
add_definitions(-DMXNET_USE_MKLDNN=1)
endif()
find_package(MKL)
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure why we need to do this? If you want to turn some options off in cmake, you can do it in the command line. we definitely don't want users to modify CMakeLists.txt

MKL_README.md Outdated

Extract it to `3rdparty/mkldnn/external` manually.

4. Copy file `3rdparty/mkldnn/config_template.vcxproj` to incubator-mxnet root.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to do everything from step 2 to 4 in a single command line? once we update the mkldnn submodule, we won't need step 2.

MKL_README.md Outdated

6. Modify `incubator-mxnet\src\operator\tensor\elemwise_sum.h`:

Modify `Sum` in `line 40,73,80,88,94,97` to `Sum2` since it has conflicts with `Sum` in MKLDNN.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a bug? if it is, can you submit a PR to fix it?

MKL_README.md Outdated
mkdir build
cd build
cmake -G "Visual Studio 14 Win64" ..
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is step 7? can we not do it in a normal command prompt?

MKL_README.md Outdated
cmake -G "Visual Studio 14 Win64" ..
```

Note that you should close the openmp since MSVC doesn't support openMP3.0. Enable MKLDNN with `MKLDNN_VERBOSE=1`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to turn off openmp in cmake?
why do we enable MKLDNN_VERBOSE here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our cmakefile should detect this automatically and disable the features accordingly. We should not expect users to change the configuration just in order to get it compiled locally. In the end, that's the purpose of cmake, right?

Copy link
Contributor

@marcoabreu marcoabreu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@xinyu-intel
Copy link
Contributor Author

xinyu-intel commented Apr 19, 2018 via email

@yajiedesign
Copy link
Contributor

i am fixed it #10629

@xinyu-intel
Copy link
Contributor Author

@yajiedesign Good J:) I think it is very helpful to simplify my workflow!

@xinyu-intel
Copy link
Contributor Author

@zheng-da @marcoabreu I've modify the install readme according to @yajiedesign 's PR #10629 .

MKL_README.md Outdated
3. Download and install [OpenCV](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download).
4. Unzip the OpenCV package.
5. Set the environment variable ```OpenCV_DIR``` to point to the ```OpenCV build directory``` (```C:\opencv\build\x64\vc14``` for example). Also, you need to add the OpenCV bin directory (```C:\opencv\build\x64\vc14\bin``` for example) to the ``PATH`` variable.
6. If you have Intel Math Kernel Library (MKL) installed, set ```MKL_ROOT``` to point to ```MKL``` directory that contains the ```include``` and ```lib```. Typically, you can find the directory in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if set USE_MKLDNN=1 and "MKL" is find,,the blas auto set to "open". if whant use mkl blas, must set BLAS=mkl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

MKL_README.md Outdated

After you have installed all of the required dependencies, build the MXNet source code:

1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apache

MKL_README.md Outdated

1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules:
```
git clone https://github.com/apache/incubator-mxnet.git ~/mxnet --recursive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~ not a valid path on windows - I'd just omit the path

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! :)

@xinyu-intel xinyu-intel requested a review from szha as a code owner May 11, 2018 10:06
@xinyu-intel
Copy link
Contributor Author

@marcoabreu hi, please help review this pr. Thanks!

@xinyu-intel
Copy link
Contributor Author

@zheng-da @marcoabreu hi, please help review this pr. Thanks!

@zheng-da
Copy link
Contributor

It looks good to me. @marcoabreu do you have more comments for this PR? If not, could you please merge it?

Copy link
Contributor

@marcoabreu marcoabreu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry for the delay

@marcoabreu marcoabreu merged commit 2567c90 into apache:master May 18, 2018
jinhuang415 pushed a commit to jinhuang415/incubator-mxnet that referenced this pull request May 29, 2018
* add windows mkldnn instruction

* update readme

* typo full mkl to mkldnn

* update blas

* update mxnet url

* update mkl build

* intel mkl liscence

* retrigger
rahul003 pushed a commit to rahul003/mxnet that referenced this pull request Jun 4, 2018
* add windows mkldnn instruction

* update readme

* typo full mkl to mkldnn

* update blas

* update mxnet url

* update mkl build

* intel mkl liscence

* retrigger
zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this pull request Jun 8, 2018
* add windows mkldnn instruction

* update readme

* typo full mkl to mkldnn

* update blas

* update mxnet url

* update mkl build

* intel mkl liscence

* retrigger
anirudh2290 pushed a commit that referenced this pull request Jun 13, 2018
* add windows mkldnn instruction

* update readme

* typo full mkl to mkldnn

* update blas

* update mxnet url

* update mkl build

* intel mkl liscence

* retrigger
zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this pull request Jun 28, 2018
* add windows mkldnn instruction

* update readme

* typo full mkl to mkldnn

* update blas

* update mxnet url

* update mkl build

* intel mkl liscence

* retrigger
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants