This repository has been archived by the owner on Sep 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bb0489
commit 1187354
Showing
5 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
From b69431b7f4fae9ee3f29368c8402f160d4e7a74a Mon Sep 17 00:00:00 2001 | ||
From: Ray Donnelly <[email protected]> | ||
Date: Tue, 9 May 2017 14:52:55 +0100 | ||
Subject: [PATCH 1/2] MKL and MKL-with-GCC-on-Windows support | ||
|
||
--- | ||
setup.py | 39 ++++++++++++++++++++++++++++++++------- | ||
1 file changed, 32 insertions(+), 7 deletions(-) | ||
|
||
diff --git a/setup.py b/setup.py | ||
index 8079753..2013756 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -1,10 +1,5 @@ | ||
-try: | ||
- from setuptools import setup, Extension | ||
-except ImportError: | ||
- from distutils.core import setup, Extension | ||
-from glob import glob | ||
-import os, sys, platform | ||
-import versioneer | ||
+import os | ||
+import sys | ||
|
||
# Modifiy this if BLAS and LAPACK libraries are not in /usr/lib. | ||
BLAS_LIB_DIR = '/usr/lib' | ||
@@ -14,6 +9,36 @@ BLAS_LIB = ['blas'] | ||
LAPACK_LIB = ['lapack'] | ||
BLAS_EXTRA_LINK_ARGS = [] | ||
|
||
+if os.getenv('NOMKL') == '0': | ||
+ # This is necessary because CVXOPT (and its dependencies) are built with GCC. | ||
+ if sys.platform == 'win32': | ||
+ BLAS_EXTRA_LINK_ARGS=[os.path.join(sys.prefix, 'Library', 'bin', 'mkl_rt.dll')] | ||
+ COMMON = ['mkl_core_dll'] | ||
+ elif tuple.__itemsize__ == 8: # 64-bit | ||
+ COMMON = ['mkl_core', 'mkl_intel_lp64', 'mkl_intel_thread', 'iomp5'] | ||
+ elif tuple.__itemsize__ == 4: # 32-bit | ||
+ COMMON = ['mkl_core', 'mkl_intel', 'mkl_intel_thread', 'iomp5'] | ||
+ | ||
+ if sys.platform == 'win32': | ||
+ BLAS_LIB_DIR = os.path.join(sys.prefix, 'Library', 'lib') | ||
+ else: | ||
+ BLAS_LIB_DIR = os.path.join(sys.prefix, 'lib') | ||
+ | ||
+ if tuple.__itemsize__ == 8: # 64-bit | ||
+ BLAS_LIB = ['mkl_blas95_lp64'] + COMMON | ||
+ LAPACK_LIB = ['mkl_lapack95_lp64'] | ||
+ elif tuple.__itemsize__ == 4: # 32-bit | ||
+ BLAS_LIB = ['mkl_blas95'] + COMMON | ||
+ LAPACK_LIB = ['mkl_lapack95'] | ||
+ | ||
+try: | ||
+ from setuptools import setup, Extension | ||
+except ImportError: | ||
+ from distutils.core import setup, Extension | ||
+from glob import glob | ||
+import os, sys, platform | ||
+import versioneer | ||
+ | ||
# Set environment variable BLAS_NOUNDERSCORES=1 if your BLAS/LAPACK do | ||
# not use trailing underscores | ||
BLAS_NOUNDERSCORES = False | ||
-- | ||
2.12.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From b2faeaa9bd352924c3946751e30337e7cb17f965 Mon Sep 17 00:00:00 2001 | ||
From: Ray Donnelly <[email protected]> | ||
Date: Tue, 9 May 2017 15:46:07 +0100 | ||
Subject: [PATCH 2/2] MKL: Use 64-bit indices if DLONG is defined | ||
|
||
Inspired by https://github.com/cvxopt/cvxopt/pull/31 but fixed | ||
to not break when using an external mingw-w64 suitesparse. | ||
--- | ||
src/C/amd.c | 3 +-- | ||
src/C/cholmod.c | 3 +-- | ||
2 files changed, 2 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/src/C/amd.c b/src/C/amd.c | ||
index e0fa02d..be96242 100644 | ||
--- a/src/C/amd.c | ||
+++ b/src/C/amd.c | ||
@@ -23,8 +23,7 @@ | ||
#include "amd.h" | ||
#include "misc.h" | ||
|
||
-/* defined in pyconfig.h */ | ||
-#if (SIZEOF_INT < SIZEOF_SIZE_T) | ||
+#if (SIZEOF_INT < SIZEOF_SIZE_T) || defined(DLONG) | ||
#define amd_order amd_l_order | ||
#define amd_defaults amd_l_defaults | ||
#endif | ||
diff --git a/src/C/cholmod.c b/src/C/cholmod.c | ||
index 567ffd6..e4c0b50 100644 | ||
--- a/src/C/cholmod.c | ||
+++ b/src/C/cholmod.c | ||
@@ -28,8 +28,7 @@ | ||
|
||
const int E_SIZE[] = { sizeof(int_t), sizeof(double), sizeof(double complex) }; | ||
|
||
-/* defined in pyconfig.h */ | ||
-#if (SIZEOF_INT < SIZEOF_SIZE_T) | ||
+#if (SIZEOF_INT < SIZEOF_SIZE_T) || defined(DLONG) | ||
#define CHOL(name) cholmod_l_ ## name | ||
#else | ||
#define CHOL(name) cholmod_ ## name | ||
-- | ||
2.12.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
:: move setup.py setup.orig | ||
:: cat %RECIPE_DIR%\mkl_conf.py setup.orig >setup.py | ||
set MINGW_PREFIX=%PREFIX%\Library\mingw-w64 | ||
|
||
:: There is an incompatibility between the mingw-w64 suitespare and CVXOPT. It | ||
:: concerns include/umfpack_symbolic.h's umfpack_di_symbolic() 3rd and 4th | ||
:: parameters (const int Ap [ ], const int Ai [ ] and cvxopt.h's | ||
:: #define int_t Py_ssize_t. Here Py_ssize_t is 8 bytes. | ||
:: The umfpack_dl_symbolic function should be used instead, but it is not. | ||
curl -SLO http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.5.tar.gz | ||
tar -xf SuiteSparse-4.5.5.tar.gz | ||
set CVXOPT_SUITESPARSE_SRC_DIR=%CD%\SuiteSparse | ||
|
||
if "%NOMKL%" == "0" goto USING_MKL | ||
set CVXOPT_BLAS_LIB=openblas | ||
set CVXOPT_LAPACK_LIB=openblas | ||
set CVXOPT_BUILD_GSL=1 | ||
set CVXOPT_BUILD_FFTW=1 | ||
set CVXOPT_BUILD_DSDP=1 | ||
set CVXOPT_BUILD_GLPK=1 | ||
set CVXOPT_GSL_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_GSL_INC_DIR=%MINGW_PREFIX%\include | ||
set CVXOPT_FFTW_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_FFTW_INC_DIR=%MINGW_PREFIX%\include | ||
set CVXOPT_GLPK_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_GLPK_INC_DIR=%MINGW_PREFIX%\include | ||
set CVXOPT_DSDP_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_DSDP_INC_DIR=%MINGW_PREFIX%\include\dsdp | ||
set CVXOPT_SUITESPARSE_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_SUITESPARSE_INC_DIR=%MINGW_PREFIX%\include | ||
goto NOT_USING_MKL | ||
:USING_MKL | ||
set CVXOPT_BUILD_GSL=1 | ||
set CVXOPT_BUILD_FFTW=1 | ||
set CVXOPT_BUILD_DSDP=1 | ||
set CVXOPT_BUILD_GLPK=1 | ||
set CVXOPT_GSL_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_GSL_INC_DIR=%MINGW_PREFIX%\include | ||
set CVXOPT_FFTW_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_FFTW_INC_DIR=%MINGW_PREFIX%\include | ||
set CVXOPT_GLPK_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_GLPK_INC_DIR=%MINGW_PREFIX%\include | ||
set CVXOPT_DSDP_LIB_DIR=%MINGW_PREFIX%\lib | ||
set CVXOPT_DSDP_INC_DIR=%MINGW_PREFIX%\include\dsdp | ||
:: set CVXOPT_SUITESPARSE_LIB_DIR=%MINGW_PREFIX%\lib | ||
:: set CVXOPT_SUITESPARSE_INC_DIR=%MINGW_PREFIX%\include | ||
:: curl -SLO http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.5.tar.gz | ||
:: tar -xf SuiteSparse-4.5.5.tar.gz | ||
:: set CVXOPT_SUITESPARSE_SRC_DIR=%CD%\SuiteSparse | ||
:NOT_USING_MKL | ||
"%PYTHON%" setup.py build --compiler=mingw32 | ||
if errorlevel 1 exit 1 | ||
|
||
"%PYTHON%" setup.py install | ||
if errorlevel 1 exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
export CVXOPT_BUILD_GSL=1 | ||
export CVXOPT_BUILD_FFTW=1 | ||
export CVXOPT_BUILD_DSDP=1 | ||
export CVXOPT_BUILD_GLPK=1 | ||
export CVXOPT_GSL_LIB_DIR=${PREFIX}/lib | ||
export CVXOPT_GSL_INC_DIR=${PREFIX}/include | ||
export CVXOPT_FFTW_LIB_DIR=${PREFIX}/lib | ||
export CVXOPT_FFTW_INC_DIR=${PREFIX}/include | ||
export CVXOPT_GLPK_LIB_DIR=${PREFIX}/lib | ||
export CVXOPT_GLPK_INC_DIR=${PREFIX}/include | ||
export CVXOPT_DSDP_LIB_DIR=${PREFIX}/lib | ||
export CVXOPT_DSDP_INC_DIR=${PREFIX}/include/dsdp | ||
|
||
if [[ ${NOMKL} == 1 ]]; then | ||
curl -SLO http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.5.tar.gz | ||
tar -xf SuiteSparse-4.5.5.tar.gz | ||
export CVXOPT_SUITESPARSE_SRC_DIR=${PWD}/SuiteSparse | ||
else | ||
export CVXOPT_BLAS_LIB=openblas | ||
export CVXOPT_LAPACK_LIB=openblas | ||
export CVXOPT_SUITESPARSE_LIB_DIR=${PREFIX}/lib | ||
export CVXOPT_SUITESPARSE_INC_DIR=${PREFIX}/include | ||
fi | ||
|
||
if [ `uname` == Linux ] | ||
then | ||
export LDFLAGS="$LDFLAGS -Wl,--no-as-needed -lrt" | ||
fi | ||
if [ `uname` == Darwin ]; then | ||
export LDFLAGS="-headerpad_max_install_names $LDFLAGS" | ||
fi | ||
|
||
$PYTHON setup.py install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{% set n = 'm2w64-' if win else '' %} | ||
{% set p = 'm2-' if win else '' %} | ||
{% set version = '1.1.9' %} | ||
|
||
# Patrick Gaffe wants CVXOPT linked to MKL on Windows. Directly linking to some of the DLLs (mkl_intel_thread.dll) makes this a bit more possible: | ||
# C:\Users\ray\mc-x64-3.6\conda-bld\cvxopt_1494330482661\_b_env\Library\mingw-w64\bin\gcc.exe -shared -s build\temp.win-amd64-3.6\Release\src\c\fftw.o build\temp.win-amd64-3.6\Release\src\c\fftw.cp36-win_amd64.def -L\lib -LC:\Users\ray\mc-x64-3.6\conda-bld\cvxopt_1494330482661\_b_env\Library\lib -LC:\Users\ray\mc-x64-3.6\conda-bld\cvxopt_1494330482661\_b_env\libs -LC:\Users\ray\mc-x64-3.6\conda-bld\cvxopt_1494330482661\_b_env\PCbuild\amd64 -lfftw3 -lmkl_blas95_lp64 -lmkl_core_dll C:\Users\ray\mc-x64-3.6\conda-bld\cvxopt_1494330482661\_b_env\Library\bin\mkl_intel_thread.dll -lpython36 -lmsvcr140 -o build\lib.win-amd64-3.6\cvxopt\fftw.cp36-win_amd64.pyd | ||
# Other than that, see: https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/704577 | ||
# There, linking to mkl_rt.dll is recommended. | ||
|
||
package: | ||
name: cvxopt | ||
version: {{ version }} | ||
|
||
source: | ||
git_url: https://github.com/cvxopt/cvxopt | ||
git_ref: {{ version }} | ||
patches: | ||
- 0001-MKL-and-MKL-with-GCC-on-Windows-support.patch | ||
- 0002-use-same-macro-as-in-cholmod_internal.h.patch | ||
|
||
build: | ||
detect_binary_files_with_prefix: False | ||
features: | ||
- nomkl [nomkl] | ||
|
||
requirements: | ||
build: | ||
- python | ||
- {{p}}git | ||
- mkl-devel 2017.0.1 [not nomkl] | ||
- libpython [win] | ||
- posix [win] | ||
- {{n}}openblas [nomkl] | ||
- {{n}}suitesparse [nomkl] | ||
- {{n}}gsl | ||
- {{n}}fftw | ||
- {{n}}dsdp | ||
- {{n}}glpk | ||
- {{n}}toolchain [win] | ||
run: | ||
- python | ||
- mkl 2017.0.1 [not nomkl] | ||
- {{n}}openblas [nomkl] | ||
- {{n}}suitesparse [nomkl] | ||
- {{n}}gsl | ||
- {{n}}fftw | ||
- {{n}}dsdp | ||
- {{n}}glpk | ||
- {{n}}gcc-libs [win] | ||
|
||
test: | ||
imports: | ||
- cvxopt | ||
- cvxopt.base | ||
- cvxopt.blas | ||
- cvxopt.cholmod | ||
- cvxopt.lapack | ||
- cvxopt.misc_solvers | ||
- cvxopt.umfpack | ||
- cvxopt.glpk | ||
- cvxopt.fftw | ||
source_files: | ||
- tests/*.py | ||
- examples/* | ||
commands: "%PYTHON% -m unittest discover -s %SRC_DIR%/tests" [win] | ||
commands: "${PYTHON} -m unittest discover -s ${SRC_DIR}/tests" [not win] | ||
|
||
about: | ||
home: http://cvxopt.org/ | ||
license: GPL | ||
license_family: GPL3 | ||
license_file: LICENSE | ||
summary: Library for convex optimization | ||
description: | | ||
CVXOPT is a free software package for convex optimization based on Python. | ||
It can be used with the interactive Python interpreter, on the command line | ||
by executing Python scripts, or integrated in other software via Python | ||
extension modules. | ||
doc_url: http://cvxopt.org/documentation/index.html | ||
doc_source_url: https://github.com/cvxopt/cvxopt/blob/master/doc/source/index.rst | ||
dev_url: https://github.com/cvxopt/cvxopt |