Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #528 from matthew-brett/conditional-omp-fix
MRG: move conditional compiling to C
- Loading branch information
Showing
8 changed files
with
112 additions
and
48 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
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
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
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
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
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,26 @@ | ||
/* Header file to conditionally wrap omp.h defines | ||
* | ||
* _OPENMP should be defined if omp.h is safe to include | ||
*/ | ||
#if defined(_OPENMP) | ||
#include <omp.h> | ||
int have_openmp = 1; | ||
#else | ||
/* These are fake defines to make these symbols valid in the c / pyx file | ||
* | ||
* All uses of these symbols should to be prefaced with ``if have_openmp``, as | ||
* in: | ||
* | ||
* cdef omp_lock_t lock | ||
* if have_openmp: | ||
* openmp.omp_init_lock(&lock) | ||
* | ||
* */ | ||
typedef int omp_lock_t; | ||
void omp_init_lock(omp_lock_t *lock) {}; | ||
void omp_destroy_lock(omp_lock_t *lock) {}; | ||
void omp_set_lock(omp_lock_t *lock) {}; | ||
void omp_unset_lock(omp_lock_t *lock) {}; | ||
int omp_test_lock(omp_lock_t *lock) {}; | ||
int have_openmp = 0; | ||
#endif |
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,9 @@ | ||
cdef extern from "conditional_omp.h": | ||
ctypedef struct omp_lock_t: | ||
pass | ||
extern void omp_init_lock(omp_lock_t *) nogil | ||
extern void omp_destroy_lock(omp_lock_t *) nogil | ||
extern void omp_set_lock(omp_lock_t *) nogil | ||
extern void omp_unset_lock(omp_lock_t *) nogil | ||
extern int omp_test_lock(omp_lock_t *) nogil | ||
cdef int have_openmp |
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,25 @@ | ||
# Tools for working with travis-ci | ||
export WHEELHOUSE="http://travis-wheels.scikit-image.org/" | ||
|
||
retry () { | ||
# https://gist.github.com/fungusakafungus/1026804 | ||
local retry_max=5 | ||
local count=$retry_max | ||
while [ $count -gt 0 ]; do | ||
"$@" && break | ||
count=$(($count - 1)) | ||
sleep 1 | ||
done | ||
|
||
[ $count -eq 0 ] && { | ||
echo "Retry failed [$retry_max]: $@" >&2 | ||
return 1 | ||
} | ||
return 0 | ||
} | ||
|
||
|
||
wheelhouse_pip_install() { | ||
# Install pip requirements via travis wheelhouse | ||
retry pip install --no-index --find-links $WHEELHOUSE $@ | ||
} |