Skip to content

Commit

Permalink
add conda-clang with openmp on travis; use this for the distro
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Winkel committed Jan 18, 2019
1 parent bcde6d5 commit 5b32740
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
16 changes: 11 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ matrix:
env:
- COMPILER='gcc'

# MacOS X - conda-gcc
# MacOS X - conda-clang
- os: osx
osx_image: xcode8.3
env:
- DO_MAC_DIST=YES
- COMPILER='conda-clang'

# MacOS X - conda-gcc
- os: osx
osx_image: xcode8.3
env:
- COMPILER='conda-gcc'

# MacOS X - conda-llvm
Expand Down Expand Up @@ -199,10 +205,9 @@ matrix:

before_install:
- echo "CONDA_DEPENDENCIES:" $CONDA_DEPENDENCIES
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER != "conda-gcc" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "clang" ]]; then brew install libomp; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "llvm" ]]; then brew install llvm; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "gcc" ]]; then brew install gcc; brew link --overwrite gcc; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "clang" ]]; then brew update; brew install libomp; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "llvm" ]]; then brew update; brew install llvm; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "gcc" ]]; then brew update; brew install gcc; brew link --overwrite gcc; fi
- 'if [[ $TRAVIS_OS_NAME == "osx" && $COMPILER == "gcc" ]]; then
gcc --version;
gcc-6 --version && export CC="gcc-6" && export CXX="g++-6" && export CPP="g++-6" && export LD="gcc-6" && export LDFLAGS="-Wl,-rpath,/usr/local/opt/gcc/lib/gcc/6/" || true;
Expand Down Expand Up @@ -237,6 +242,7 @@ install:

# - if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "conda-llvm" ]]; then conda install -c conda-forge llvm llvm-openmp; ls /Users/travis/miniconda/**/clang || true; ls /Users/travis/miniconda/**/gcc || true; fi

- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "conda-clang" ]]; then conda install -c conda-forge clang_osx-64 clangxx_osx-64 llvm-openmp openmp; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $COMPILER == "conda-gcc" ]]; then conda install -c conda-forge gcc; gcc --version || true; fi

script:
Expand Down
15 changes: 11 additions & 4 deletions cygrid/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ def get_extensions():
# os.environ["CPP"] = "cpp-6"
# os.environ["CXX"] = "g++-6"
# os.environ["LD"] = "gcc-6"
from subprocess import getoutput

extra_compile_args = [
'-fopenmp', '-O3', '-mmacosx-version-min=10.7', '-std=c++11',
]
if ('clang' in getoutput('gcc -v')) and all(
'command not found' in getoutput('gcc-{:d} -v'.format(d))
for d in [6, 7, 8]
):
extra_compile_args += ['-stdlib=libc++', ]
comp_args = {
'extra_compile_args': [
'-fopenmp', '-O3', '-mmacosx-version-min=10.7', '-std=c++11',
# '-stdlib=libc++'
],
'extra_compile_args': extra_compile_args,
'extra_link_args': [
'-fopenmp', # '-lgomp'
],
Expand Down
22 changes: 16 additions & 6 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ however, you need to have the GCC C++ compiler (see below), otherwise you'll
likely get some error message.

Also, if you want to install from source, you must have a C++ compiler. There
are basically two options, using the gcc suite (recommended) or LLVM.
are basically two options, using the gcc suite (recommended) or clang/LLVM.

gcc
~~~
Expand Down Expand Up @@ -167,8 +167,8 @@ gcc compilers instead of the standard clang:

Then follow the instructions in :ref:`source_install`.

LLVM
~~~~
clang/LLVM
~~~~~~~~~~

.. code-block:: bash
Expand All @@ -186,7 +186,7 @@ Then follow the instructions in :ref:`source_install`.
.. note::

The MacOS wheel, which we provide on PyPI (for pip installation)
was built using gcc. So it may happen that you run into binary
was built using clang/LLVM. So it may happen that you run into binary
incompatibilities if you use a different compiler suite on your computer.
In such cases it may be necessary to build cygrid from source using
your own compiler. Sometimes even different compiler versions
Expand All @@ -201,8 +201,18 @@ Then follow the instructions in :ref:`source_install`.
conda install -c conda-forge gcc
will install the gcc compiler suite into your Anaconda installation
and the instructions in :ref:`source_install` should work out-of-the-box.
This will install the gcc compiler suite into your Anaconda installation
and the instructions in :ref:`source_install` should work out-of-the-box.
If you prefer clang/LLVM, the following should install the necessary
conda packages:

.. code-block:: bash
conda install -c conda-forge clang_osx-64 clangxx_osx-64 llvm-openmp openmp
The `cygrid` package on `conda-forge <https://conda-forge.org/>`__
was created using the latter approach.


.. _testing_installed_cygrid:

Expand Down

0 comments on commit 5b32740

Please sign in to comment.