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

[MXNET-1225] Always use config.mk in make install instructions #13364

Merged
merged 6 commits into from
Dec 11, 2018

Conversation

zachgk
Copy link
Contributor

@zachgk zachgk commented Nov 21, 2018

Description

Arguments to make for the mxnet build can be passed either directly through the command line or through config.mk. The install instructions are inconsistent and use both options. However, some frontends such as scala require the arguments as well so they must be passed to both the initial make and the following "make scalapkg". Failure to pass the arguments to the scalapkg make can result in an improper configuration and slower performance. To resolve this, I am switching the install instructions to consistently use the config.mk because it is automatically used by all make commands which resolves the potential frontend problems.

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)
  • 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:https://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

@nswamy @lanking520 @yzhliu @andrewfayres @piyushghai

@zachgk zachgk requested a review from szha as a code owner November 21, 2018 21:59
@zachgk
Copy link
Contributor Author

zachgk commented Nov 21, 2018

@mxnet-label-bot add [Build, Doc, Installation]

Also @aaronmarkham

Copy link
Contributor

@aaronmarkham aaronmarkham left a comment

Choose a reason for hiding this comment

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

These look good. Thanks for going for consistency!
You might want to dig around a bit more... there's the build from source page and a centos page to name a ...two... but this PR looks fine as it is.

@larroy
Copy link
Contributor

larroy commented Nov 21, 2018

Why are we documenting make instead of CMake? We want to completely switch over to CMake...

@zachgk
Copy link
Contributor Author

zachgk commented Nov 21, 2018

@larroy I am documenting make because as far as I know the scala package only works through make. If it works through cmake, is there anything blocking us from entirely switching all make commands to cmake throughout the install instructions?

Also, does cmake use config.mk as well? If it does, I think the same thing applies such that all cmake commands should use config.mk instead of passing arguments directly. I ran into a few cmake commands that did not use config.mk in the build_from_source.md, but I was unsure whether they could be switched or not.

@larroy
Copy link
Contributor

larroy commented Nov 23, 2018

I'm not familiar with the compilation in the Scala package. And no CMake doesn't work with config.mk

Just wanted to make you aware of the CMake efforts.

@zachgk
Copy link
Contributor Author

zachgk commented Nov 27, 2018

@mxnet-label-bot add [pr-awaiting-review]

@larroy The scala package compilation process currently requires a number of building and linking flags used to build the backend to be passed to the Java Native Interface as well. So, we currently call make and then make calls maven with those flags. Right now, we are working on improving the scala build so that it doesn't require those flags, but it doesn't seem to be trivial. Therefore, I added redundant flags to all cmake calls for now since it would at least result in the scala build always working.

@marcoabreu marcoabreu added the pr-awaiting-review PR is waiting for code review label Nov 27, 2018
Copy link
Contributor

@andrewfayres andrewfayres left a comment

Choose a reason for hiding this comment

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

Wouldn't hurt for someone a bit more familiar with the build process to take a look but this LGTM.

@lanking520
Copy link
Member

Could you please raise a discussion on devlist?

@andrewfayres
Copy link
Contributor

andrewfayres commented Nov 28, 2018

I ran through this to test. Everything seemed to work fine except I had to specify USE_CUDA = 0 in the ubuntu_setup instructions.

@ddavydenko
Copy link
Contributor

@zachgk , @lanking520 , do you guys think it makes sense to merge this in?

Copy link
Contributor

@aaronmarkham aaronmarkham left a comment

Choose a reason for hiding this comment

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

Can we use cmake throughout?

Also, can you note the Scala dependency on make in this section: https://mxnet.incubator.apache.org/install/build_from_source.html#build-configurations

docs/install/ubuntu_setup.md Show resolved Hide resolved
docs/install/build_from_source.md Outdated Show resolved Hide resolved
@larroy
Copy link
Contributor

larroy commented Dec 3, 2018

I would suggest to converge in using CMake, I would propose to use a thin wrapper over cmake so we can use a file to define options in this fashion:

https://github.com/apache/incubator-mxnet/blob/master/cmake/cmake_options.yml

This would then work in the same way as config.mk now. But parsed into a commandline as it's done here:

https://github.com/apache/incubator-mxnet/blob/master/dev_menu.py#L48

Also, some of the changes proposed here don't work at all, have they been tested locally?

@zachgk
Copy link
Contributor Author

zachgk commented Dec 4, 2018

@larroy @aaronmarkham
I discussed the issue offline with lanking520 and andrewfayres. Right now, this PR is just a stopgap until we complete the final solution worked on in https://issues.apache.org/jira/browse/MXNET-1224. After that, we can just migrate all backend builds into cmake and that will be fine from the scala end.

In the meantime, we have a redundancy in our docs between the build_from_source instructions and the os specific files. Our current plan is to take advantage of it by leaving cmake in the build_from_source and make in the os specific. Then, we will tell all scala users that they must use the os specific instructions and not the build from source instructions. If they did build using cmake and the build_from_source instructions, they should "make clean" and remake it with the os specific instructions.

@aaronmarkham
Copy link
Contributor

@larroy Can you point me to more info on "dev menu"? I think I understand what you're suggesting, but I don't see anything on the wiki or in the repo, other than the code itself.
Let me try to play back my understanding:

  1. users only use cmake (so our instructions are simple and clear)
  2. cmake uses the cmake_options.yml file
  3. cmake or maybe dev_menu.py generates an artifact (config.mk) that make can use
  4. scala's current make requirement is satisfied by this artifact

@larroy
Copy link
Contributor

larroy commented Dec 5, 2018

@aaronmarkham I extended dev_menu.py with a CMake builder helper that uses cmake options from a file, as the pattern of copying config.mk was useful for several people:

You can try what I mean by using ./dev_menu.py and choosing "Local build" check the CMake class inside that file:

https://github.com/apache/incubator-mxnet/blob/e0309f453175d066f8a147a3ff5afb01c575327f/dev_menu.py#L54

Or when this PR gets merged, one can do

cp cmake/cmake_options.yaml .
<edit if needed> 
./dev_menu.py build

https://github.com/apache/incubator-mxnet/pull/13529/files

Maybe you can give some feedback about this method, to see if you consider it would make sense to use this simplification on the documentation. So far I haven't documented any of this as I'm refining these convenience scripts and are more targeted to development.

@lebeg
Copy link
Contributor

lebeg commented Dec 5, 2018

I would like to mention that, unfortunately, the current option for algebra packages in CMake is BLAS and not USE_BLAS as in make.

@zachgk
Copy link
Contributor Author

zachgk commented Dec 6, 2018

@larroy
If we use the cmake_options approach, we will also need to configure cmake to work for scala similarly to how make works now. However, our plan is that we will actually drop make altogether in the near future and use mvn directly. So, I would rather just warn users for now instead of doing a temporary technological fix. Also, I corrected the cmake usages in the build_from_source file (they were broken in the old docs as well).

If you have no objections, I will also open a PR to move the rest of the install instructions to cmake once scala is ready.

docs/install/c_plus_plus.md Outdated Show resolved Hide resolved
@larroy
Copy link
Contributor

larroy commented Dec 7, 2018

@zachgk shall we leave Scala as it is with Make but move the others to CMake? that would be my preferred option.

@zachgk
Copy link
Contributor Author

zachgk commented Dec 8, 2018

I fixed the CPP instructions for now, but all of the other usages of make in the install docs could be reached on the path to installing scala (scala defers the engine build to the os specific pages)

```

#### Recommended for Systems with NVIDIA GPUs
* Build with both OpenBLAS, GPU, and OpenCV support:

```bash
cmake -j BLAS=open USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1
mkdir build && cd build
cmake -DBLAS=open -DUSE_CUDA=1 -DUSE_CUDA_PATH=/usr/local/cuda -DUSE_CUDNN=1 -GNinja .
Copy link
Member

Choose a reason for hiding this comment

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

What does ninja do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a build system (https://ninja-build.org/). I believe CMake generates the ninja configuration files and then ninja performs the actual build.

Copy link
Member

@lanking520 lanking520 left a comment

Choose a reason for hiding this comment

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

Overall looks good. Please explain the change you have made on cmake.

@lanking520 lanking520 merged commit 97e0c97 into apache:master Dec 11, 2018
zhaoyao73 added a commit to zhaoyao73/incubator-mxnet that referenced this pull request Dec 13, 2018
* upstream/master: (38 commits)
  Feature/mkldnn static (apache#13628)
  Fix the bug of BidirectionalCell (apache#13575)
  Set install path for libmxnet.so dynamic lib on Mac OS (apache#13629)
  add batch norm test (apache#13625)
  Scripts for building dependency libraries of MXNet (apache#13282)
  fix quantize pass error when the quantization supported Op are excluded in the model (apache#13596)
  Optimize C++ API (apache#13496)
  Fix warning in waitall doc (apache#13618)
  [MXNET-1225] Always use config.mk in make install instructions (apache#13364)
  [MXNET-1224]: improve scala maven jni build and packing. (apache#13493)
  [MXNET-1155] Add scala packageTest utility (apache#13046)
  fix the Float not showing correctly problem (apache#13617)
  apache#13385 [Clojure] - Turn examples into integration tests (apache#13554)
  Add Intel MKL blas to Jenkins (apache#13607)
  Revert "[MXNET-1198] MXNet Java API (apache#13162)"
  Reducing the length of setup tutorial (apache#13306)
  [MXNET-1182] Predictor example (apache#13237)
  [MXNET-1187] Added Java SSD Inference Tutorial for website (apache#13201)
  add defaults and clean up the tests (apache#13295)
  [MXNET-1181] Added command line alternative to IntelliJ in install instructions (apache#13267)
  ...
@zachgk zachgk deleted the makeConfig branch April 12, 2019 22:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants