Skip to content

Commit

Permalink
Merge pull request #417 from rmcgibbo/conda-recipe
Browse files Browse the repository at this point in the history
Conda Installer recipe
  • Loading branch information
suntzu86 committed Dec 5, 2014
2 parents 83141c7 + 390f5ac commit acb021d
Show file tree
Hide file tree
Showing 27 changed files with 946 additions and 0 deletions.
49 changes: 49 additions & 0 deletions conda-recipe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
conda-moe
=========

This repository provides the recipes for building binary packages of [MOE](https://github.com/yelp/moe), a global, black box optimization engine for real world metric optimization, to be used with the Anaconda Python distribution or other conda environments.

The built binaries are available on binstar.org, and can be installed using the following command

```
conda config --add channels https://conda.binstar.org/rmcgibbo
conda install moe
```

This package is available for linux-64, targetting Ubuntu 10.04 or later, CentOS 6.0+ or later, or similar.

### Notes
This repository obviously includes recipes for a number of packages other than MOE. These are all direct or indirect dependencies of MOE, which are not included with the `default` conda channels, and we therefore build and push to binstar to make things _just work_.

### libstdc++

MOE uses C++11 features, which requires a quite modern version of GCC (4.7.3+), and a similarly new version of the runtime c++ standard library, libstd++. The version of libstdc++ distributed with Ubuntu 10.04 and CentOS 6.0 is
too old to support runtime C++11 code. Therefore, this conda build of MOE depends on an external libstdc++ conda package, which povides a more recent library. See [the recipe](https://github.com/rmcgibbo/conda-moe/blob/master/libstdcplusplus/build.sh) for the dirty, dirty hack.

### building the binaries

Our builds of these conda recipes were performed on a fresh Ubuntu 10.04 64-bit VM (vagrant) with the following provisioning:

```
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libgcc-4.7-dev cpp-4.7 gcc-4.7-base g++-4.7 make libbz2-1.0 libbz2-dev git-core
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 20
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
bash Miniconda-latest-Linux-x86_64.sh -b
export PATH=$HOME/miniconda/bin/:$PATH
conda install conda-build
# The conda recipes for the boost dependency are in a separate github
# repository:
# https://github.com/rmcgibbo/conda-cheminformatics/tree/master/boost
conda config --add channels https://conda.binstar.org/rmcgibbo
git clone https://github.com/rmcgibbo/conda-moe.git
cd conda-moe
conda build *
```
48 changes: 48 additions & 0 deletions conda-recipe/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

$script = <<SCRIPT
set -e
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y libgcc-4.7-dev cpp-4.7 gcc-4.7-base g++-4.7 make libbz2-1.0 libbz2-dev git-core
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 20
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
bash Miniconda-latest-Linux-x86_64.sh -b
export PATH=$HOME/miniconda/bin/:$PATH
conda install --yes conda-build binstar jinja2
git clone https://github.com/yelp/moe.git
cd moe/conda-recipe
conda build boost
conda build certifi
conda build colander
conda build libstdcplusplus
conda build mako
conda build paste
conda build pyramid_mako
conda build simplejson
conda build waitress
conda build webtest
conda build moe
SCRIPT


# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", inline: $script, run: "always"

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "lucid64"
config.vm.define :lucid64 do |t|
end


end
48 changes: 48 additions & 0 deletions conda-recipe/boost/6bb71fdd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From 6bb71fdd8f7cc346d90fb14beb38b7297fc1ffd9 Mon Sep 17 00:00:00 2001
From: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sun, 26 Jan 2014 13:58:48 +0400
Subject: [PATCH] Fixed incorrect initialization of 128-bit values, when no
native support for 128-bit integers is available.

---
boost/atomic/detail/cas128strong.hpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git boost/atomic/detail/cas128strong.hpp boost/atomic/detail/cas128strong.hpp
index 906c13e..dcb4d7d 100644
--- boost/atomic/detail/cas128strong.hpp
+++ boost/atomic/detail/cas128strong.hpp
@@ -196,15 +196,17 @@ class base_atomic<T, void, 16, Sign>

public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
+ memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}

void
store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type value_s = 0;
+ storage_type value_s;
+ memset(&value_s, 0, sizeof(value_s));
memcpy(&value_s, &value, sizeof(value_type));
platform_fence_before_store(order);
platform_store128(value_s, &v_);
@@ -247,7 +249,9 @@ class base_atomic<T, void, 16, Sign>
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));

--
1.9.1

29 changes: 29 additions & 0 deletions conda-recipe/boost/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Hints:
# http://boost.2283326.n4.nabble.com/how-to-build-boost-with-bzip2-in-non-standard-location-td2661155.html
# http://www.gentoo.org/proj/en/base/amd64/howtos/?part=1&chap=3

# Build dependencies:
# - bzip2-devel

export CFLAGS="-m64 -pipe -O2 -march=x86-64 -fPIC -shared"
export CXXFLAGS="${CFLAGS}"

mkdir -vp ${PREFIX}/bin;

./bootstrap.sh --prefix="${PREFIX}/";

sed -i'.bak' -e's/^using python.*;//' ./project-config.jam

PY_INC=`$PYTHON -c "from distutils import sysconfig; print (sysconfig.get_python_inc(0, '$PREFIX'))"`

echo "using python" >> ./project-config.jam
echo " : $PY_VER" >> ./project-config.jam
echo " : $PYTHON" >> ./project-config.jam
echo " : $PY_INC" >> ./project-config.jam
echo " : $PREFIX/lib" >> ./project-config.jam
echo " ;" >> ./project-config.jam

./b2 -q install --debug-configuration;

68 changes: 68 additions & 0 deletions conda-recipe/boost/e4bde20f.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
From e4bde20f2eec0a51be14533871d2123bd2ab9cf3 Mon Sep 17 00:00:00 2001
From: Andrey Semashev <andrey.semashev@gmail.com>
Date: Fri, 28 Feb 2014 12:43:11 +0400
Subject: [PATCH] More compilation fixes for the case when 128-bit integers are
not supported.

---
boost/atomic/detail/gcc-atomic.hpp | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git boost/atomic/detail/gcc-atomic.hpp boost/atomic/detail/gcc-atomic.hpp
index a130590..4af99a1 100644
--- boost/atomic/detail/gcc-atomic.hpp
+++ boost/atomic/detail/gcc-atomic.hpp
@@ -958,14 +958,16 @@ class base_atomic<T, void, 16, Sign>

public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
+ memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}

void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type tmp = 0;
+ storage_type tmp;
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
__atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
}
@@ -980,7 +982,8 @@ class base_atomic<T, void, 16, Sign>

value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type tmp = 0;
+ storage_type tmp;
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
value_type res;
@@ -994,7 +997,9 @@ class base_atomic<T, void, 16, Sign>
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
@@ -1010,7 +1015,9 @@ class base_atomic<T, void, 16, Sign>
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,
--
1.9.1

33 changes: 33 additions & 0 deletions conda-recipe/boost/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

package:
name: boost
version: 1.55.0

source:
fn: boost_1_55_0.tar.bz2 [unix]
url: http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.bz2 [unix]
fn: boost_1_55_0-msvc-10.0-64.exe [win64]
url: http://downloads.sourceforge.net/project/boost/boost-binaries/1.55.0-build2/boost_1_55_0-msvc-10.0-64.exe [win64]
fn: boost_1_55_0-msvc-10.0-32.exe [win32]
url: http://download.sourceforge.net/project/boost/boost-binaries/1.55.0-build2/boost_1_55_0-msvc-10.0-32.exe [win32]
patches:
- e4bde20f.patch [osx]
- 6bb71fdd.patch [osx]

build:
number: 3

requirements:
build:
- zlib [unix]
- bzip2 [unix]
- python [unix]
run:
- zlib [unix]
- bzip2 [unix]
- python [unix]

about:
home: http://www.boost.org/
license: Boost-1.0

9 changes: 9 additions & 0 deletions conda-recipe/certifi/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

$PYTHON setup.py install

# Add more build steps here, if they are necessary.

# See
# http://docs.continuum.io/conda/build.html
# for a list of environment variables that are set during the build process.
60 changes: 60 additions & 0 deletions conda-recipe/certifi/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package:
name: certifi
version: !!str 14.05.14

source:
fn: certifi-14.05.14.tar.gz
url: https://pypi.python.org/packages/source/c/certifi/certifi-14.05.14.tar.gz
md5: 315ea4e50673a16ab047099f816fd32a
# patches:
# List any patch files here
# - fix.patch

# build:
# preserve_egg_dir: True
# entry_points:
# Put any entry points (scripts to be generated automatically) here. The
# syntax is module:function. For example
#
# - certifi = certifi:main
#
# Would create an entry point called certifi that calls certifi.main()


# If this is a new build for the same version, increment the build
# number. If you do not include this key, it defaults to 0.
# number: 1

requirements:
build:
- python
- setuptools

run:
- python

test:
# Python imports
imports:
- certifi

# commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.


# You can also put a file called run_test.py in the recipe that will be run
# at test time.

# requires:
# Put any additional test requirements here. For example
# - nose

about:
home: http://python-requests.org
license: ISC
summary: "Python package for providing Mozilla's CA Bundle."

# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
9 changes: 9 additions & 0 deletions conda-recipe/colander/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

$PYTHON setup.py install

# Add more build steps here, if they are necessary.

# See
# http://docs.continuum.io/conda/build.html
# for a list of environment variables that are set during the build process.
Loading

0 comments on commit acb021d

Please sign in to comment.