Skip to content

Commit

Permalink
Fixed OpenMP installation on MacOSX with gcc-6 (#1460)
Browse files Browse the repository at this point in the history
* Fixed OpenMP installation on MacOSX with gcc-6

- Modified makefile from gcc-5 to gcc-6
- Removed deprecated install instructions from doc (gcc-5 was automatically forced if available in makefile on OSX)

* Fixed OpenMP installation on MacOSX with gcc-6

- Modified makefile from gcc-5 to gcc-6
- Removed deprecated install instructions from doc (gcc-5 was automatically forced if available in makefile on OSX)
  • Loading branch information
ghego authored and tqchen committed Aug 22, 2016
1 parent 93e8513 commit d754ce7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
10 changes: 5 additions & 5 deletions Makefile
Expand Up @@ -33,18 +33,18 @@ include $(XGB_PLUGINS)


# use customized config file # use customized config file
ifndef CC ifndef CC
export CC = $(if $(shell which gcc-5),gcc-5,gcc) export CC = $(if $(shell which gcc-6),gcc-6,gcc)
endif endif
ifndef CXX ifndef CXX
export CXX = $(if $(shell which g++-5),g++-5,g++) export CXX = $(if $(shell which g++-6),g++-6,g++)
endif endif


# on Mac OS X, force brew gcc-5, since the Xcode c++ fails anyway # on Mac OS X, force brew gcc-6, since the Xcode c++ fails anyway
# it is useful for pip install compiling-on-the-fly # it is useful for pip install compiling-on-the-fly
OS := $(shell uname) OS := $(shell uname)
ifeq ($(OS), Darwin) ifeq ($(OS), Darwin)
export CC = $(if $(shell which gcc-5),gcc-5,clang) export CC = $(if $(shell which gcc-6),gcc-6,clang)
export CXX = $(if $(shell which g++-5),g++-5,clang++) export CXX = $(if $(shell which g++-6),g++-6,clang++)
endif endif


export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS) export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS)
Expand Down
24 changes: 2 additions & 22 deletions doc/build.md
Expand Up @@ -69,35 +69,15 @@ See the following paragraph for OpenMP enabled xgboost.




Here is the complete solution to use OpenMP-enabled compilers to install XGBoost. Here is the complete solution to use OpenMP-enabled compilers to install XGBoost.
Obtain gcc-5.x.x with openmp support by `brew install gcc --without-multilib`. (`brew` is the de facto standard of `apt-get` on OS X. So installing [HPC](http://hpc.sourceforge.net/) separately is not recommended, but it should work.). Installation of `gcc` can take a while (~ 30 minutes) Obtain gcc-6.x.x with openmp support by `brew install gcc --without-multilib`. (`brew` is the de facto standard of `apt-get` on OS X. So installing [HPC](http://hpc.sourceforge.net/) separately is not recommended, but it should work.). Installation of `gcc` can take a while (~ 30 minutes)


Now, clone the repository Now, clone the repository


```bash ```bash
git clone --recursive https://github.com/dmlc/xgboost git clone --recursive https://github.com/dmlc/xgboost
``` ```


The next step is to update the compliers in xgboost's configuration file and build using the following commands

```bash
cd xgboost
```

Open make/config.mk file and replace the following two lines

```bash
export CC = gcc
export CXX = g++
```

with

```bash
export CC = gcc-5
export CXX = g++-5
```

Now, build using the following commands


```bash ```bash
cd ..; cp make/config.mk ./config.mk; make -j4 cd ..; cp make/config.mk ./config.mk; make -j4
Expand Down
4 changes: 2 additions & 2 deletions make/config.mk
Expand Up @@ -3,11 +3,11 @@
# #
# If you want to change the configuration, please use the following # If you want to change the configuration, please use the following
# steps. Assume you are on the root directory of xgboost. # steps. Assume you are on the root directory of xgboost.
# First copy the this file so that any local changes will be ignored by git # First copy this file so that any local changes will be ignored by git
# #
# $ cp make/config.mk . # $ cp make/config.mk .
# #
# Next modify the according entries, and then compile by # Next modify the according entries in the copied file and then compile by
# #
# $ make # $ make
# #
Expand Down

0 comments on commit d754ce7

Please sign in to comment.