Skip to content

Commit c410b46

Browse files
authored
Merge pull request #115 from bashtage/manylinux-wheel
BLD: Add manylinux1 build
2 parents 7ae4c25 + 0119f43 commit c410b46

File tree

13 files changed

+76
-34
lines changed

13 files changed

+76
-34
lines changed

ci/docker-run.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
# Usage:
3+
#
4+
# ci/docker-run.sh
5+
#
6+
# Must be started from repo root
7+
8+
rm -rf wheelhouse
9+
mkdir wheelhouse
10+
11+
export DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
12+
sudo docker pull $DOCKER_IMAGE
13+
sudo docker run --rm -v `pwd`:/io $DOCKER_IMAGE /io/ci/docker-wheel-build.sh

ci/docker-wheel-build.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -x
4+
5+
export SUPPORTED_PYTHONS=(cp27-cp27m cp35-cp35m cp36-cp36m)
6+
7+
for PYVER in ${SUPPORTED_PYTHONS[@]}; do
8+
echo ${PYVER}
9+
PYBIN=/opt/python/${PYVER}/bin
10+
"${PYBIN}/pip" install -r /io/ci/requirements_dev.txt
11+
"${PYBIN}/pip" wheel /io/ --no-deps -w wheelhouse/
12+
done
13+
14+
for whl in wheelhouse/*.whl; do
15+
auditwheel repair $whl -w /io/wheelhouse/
16+
done
17+
18+
cd $HOME
19+
for PYVER in ${SUPPORTED_PYTHONS[@]}; do
20+
echo ${PYVER}
21+
PYBIN=/opt/python/${PYVER}/bin
22+
${PYBIN}/pip install randomstate --no-index -f /io/wheelhouse
23+
${PYBIN}/pytest --pyargs randomstate
24+
done

ci/requirements_dev.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
numpy>=1.13
2+
cython>=0.26
3+
pytest
4+
nose

randomstate/src/mlfg-1279-861/mlfg-1279-861.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void mlfg_init_state(mlfg_state *state, uint64_t seeds[K]);
3030
* when making a 64 bit unsigned int, take the two upper
3131
* 32 bit segments.
3232
*/
33-
inline uint64_t mlfg_next(mlfg_state* state)
33+
static inline uint64_t mlfg_next(mlfg_state* state)
3434
{
3535
state->pos++;
3636
state->lag_pos++;

randomstate/src/mrg32k3a/mrg32k3a.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct s_mrg32k3a_state
1919
int loc;
2020
} mrg32k3a_state;
2121

22-
inline uint32_t mrg32k3a_random(mrg32k3a_state* state)
22+
static inline uint32_t mrg32k3a_random(mrg32k3a_state* state)
2323
{
2424
int64_t p1 = 0;
2525
int64_t p2 = 0;

randomstate/src/pcg/pcg32.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ typedef struct {
2525
#define PCG_STATE_SETSEQ_64_INITIALIZER \
2626
{ 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL }
2727

28-
inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot)
28+
static inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot)
2929
{
3030
#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__)
3131
asm ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot));
@@ -35,32 +35,32 @@ inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot)
3535
#endif
3636
}
3737

38-
inline void pcg_setseq_64_step_r(pcg_state_setseq_64* rng)
38+
static inline void pcg_setseq_64_step_r(pcg_state_setseq_64* rng)
3939
{
4040
rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_64 + rng->inc;
4141
}
4242

43-
inline uint32_t pcg_output_xsl_rr_64_32(uint64_t state)
43+
static inline uint32_t pcg_output_xsl_rr_64_32(uint64_t state)
4444
{
4545
return pcg_rotr_32(((uint32_t)(state >> 32u)) ^ (uint32_t)state,
4646
state >> 59u);
4747
}
4848

49-
inline uint32_t pcg_output_xsh_rr_64_32(uint64_t state)
49+
static inline uint32_t pcg_output_xsh_rr_64_32(uint64_t state)
5050
{
5151
return pcg_rotr_32(((state >> 18u) ^ state) >> 27u, state >> 59u);
5252
}
5353

5454

55-
inline uint32_t
55+
static inline uint32_t
5656
pcg_setseq_64_xsh_rr_32_random_r(pcg_state_setseq_64* rng)
5757
{
5858
uint64_t oldstate = rng->state;
5959
pcg_setseq_64_step_r(rng);
6060
return pcg_output_xsh_rr_64_32(oldstate);
6161
}
6262

63-
inline void pcg_setseq_64_srandom_r(pcg_state_setseq_64* rng,
63+
static inline void pcg_setseq_64_srandom_r(pcg_state_setseq_64* rng,
6464
uint64_t initstate, uint64_t initseq)
6565
{
6666
rng->state = 0U;
@@ -70,15 +70,15 @@ inline void pcg_setseq_64_srandom_r(pcg_state_setseq_64* rng,
7070
pcg_setseq_64_step_r(rng);
7171
}
7272

73-
inline uint32_t
73+
static inline uint32_t
7474
pcg_setseq_64_xsl_rr_32_random_r(pcg_state_setseq_64* rng)
7575
{
7676
uint64_t oldstate = rng->state;
7777
pcg_setseq_64_step_r(rng);
7878
return pcg_output_xsl_rr_64_32(oldstate);
7979
}
8080

81-
inline uint32_t
81+
static inline uint32_t
8282
pcg_setseq_64_xsl_rr_32_boundedrand_r(pcg_state_setseq_64* rng,
8383
uint32_t bound)
8484
{
@@ -95,7 +95,7 @@ extern uint64_t pcg_advance_lcg_64(uint64_t state, uint64_t delta,
9595

9696

9797

98-
inline void pcg_setseq_64_advance_r(pcg_state_setseq_64* rng,
98+
static inline void pcg_setseq_64_advance_r(pcg_state_setseq_64* rng,
9999
uint64_t delta)
100100
{
101101
rng->state = pcg_advance_lcg_64(rng->state, delta,

randomstate/src/pcg64-compat/pcg64.h

+15-16
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <inttypes.h>
3535
#endif
3636

37-
3837
#if __GNUC_GNU_INLINE__ && !defined(__cplusplus)
3938
#error Nonstandard GNU inlining semantics. Compile with -std=c99 or better.
4039
#endif
@@ -53,7 +52,7 @@ extern "C" {
5352
uint64_t low;
5453
} pcg128_t;
5554

56-
inline pcg128_t PCG_128BIT_CONSTANT(uint64_t high, uint64_t low) {
55+
static inline pcg128_t PCG_128BIT_CONSTANT(uint64_t high, uint64_t low) {
5756
pcg128_t result;
5857
result.high = high;
5958
result.low = low;
@@ -80,22 +79,22 @@ extern "C" {
8079
{ PCG_128BIT_CONSTANT(0x979c9a98d8462005ULL, 0x7d3e9cb6cfe0549bULL), \
8180
PCG_128BIT_CONSTANT(0x0000000000000001ULL, 0xda3e39cb94b95bdbULL) }
8281

83-
inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot)
82+
static inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot)
8483
{
8584
return (value >> rot) | (value << ((- rot) & 63));
8685
}
8786

8887
#ifdef PCG_EMULATED_128BIT_MATH
8988

90-
inline pcg128_t _pcg128_add(pcg128_t a, pcg128_t b) {
89+
static inline pcg128_t _pcg128_add(pcg128_t a, pcg128_t b) {
9190
pcg128_t result;
9291

9392
result.low = a.low + b.low;
9493
result.high = a.high + b.high + (result.low < b.low);
9594
return result;
9695
}
9796

98-
inline void _pcg_mult64(uint64_t x, uint64_t y, uint64_t* z1, uint64_t* z0) {
97+
static inline void _pcg_mult64(uint64_t x, uint64_t y, uint64_t* z1, uint64_t* z0) {
9998
uint64_t x0, x1, y0, y1;
10099
uint64_t w0, w1, w2, t;
101100
/* Lower 64 bits are straightforward clock-arithmetic. */
@@ -113,7 +112,7 @@ extern "C" {
113112
*z1 = x1 * y1 + w2 + (w1 >> 32);
114113
}
115114

116-
inline pcg128_t _pcg128_mult(pcg128_t a, pcg128_t b) {
115+
static inline pcg128_t _pcg128_mult(pcg128_t a, pcg128_t b) {
117116
uint64_t h1;
118117
pcg128_t result;
119118

@@ -123,18 +122,18 @@ extern "C" {
123122
return result;
124123
}
125124

126-
inline void pcg_setseq_128_step_r(pcg_state_setseq_128* rng)
125+
static inline void pcg_setseq_128_step_r(pcg_state_setseq_128* rng)
127126
{
128127
rng->state = _pcg128_add(_pcg128_mult(rng->state, PCG_DEFAULT_MULTIPLIER_128), rng->inc);
129128
}
130129

131-
inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t state)
130+
static inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t state)
132131
{
133132
return pcg_rotr_64(state.high ^ state.low,
134133
state.high >> 58u);
135134
}
136135

137-
inline void pcg_setseq_128_srandom_r(pcg_state_setseq_128* rng,
136+
static inline void pcg_setseq_128_srandom_r(pcg_state_setseq_128* rng,
138137
pcg128_t initstate, pcg128_t initseq)
139138
{
140139
rng->state = PCG_128BIT_CONSTANT(0ULL, 0ULL);
@@ -148,18 +147,18 @@ extern "C" {
148147

149148
#else /* PCG_EMULATED_128BIT_MATH */
150149

151-
inline void pcg_setseq_128_step_r(pcg_state_setseq_128* rng)
150+
static inline void pcg_setseq_128_step_r(pcg_state_setseq_128* rng)
152151
{
153152
rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_128 + rng->inc;
154153
}
155154

156-
inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t state)
155+
static inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t state)
157156
{
158157
return pcg_rotr_64(((uint64_t)(state >> 64u)) ^ (uint64_t)state,
159158
state >> 122u);
160159
}
161160

162-
inline void pcg_setseq_128_srandom_r(pcg_state_setseq_128* rng,
161+
static inline void pcg_setseq_128_srandom_r(pcg_state_setseq_128* rng,
163162
pcg128_t initstate, pcg128_t initseq)
164163
{
165164
rng->state = 0U;
@@ -172,14 +171,14 @@ extern "C" {
172171
#endif /* PCG_EMULATED_128BIT_MATH */
173172

174173

175-
inline uint64_t
174+
static inline uint64_t
176175
pcg_setseq_128_xsl_rr_64_random_r(pcg_state_setseq_128* rng)
177176
{
178177
pcg_setseq_128_step_r(rng);
179178
return pcg_output_xsl_rr_128_64(rng->state);
180179
}
181180

182-
inline uint64_t
181+
static inline uint64_t
183182
pcg_setseq_128_xsl_rr_64_boundedrand_r(pcg_state_setseq_128* rng,
184183
uint64_t bound)
185184
{
@@ -194,7 +193,7 @@ extern "C" {
194193
extern pcg128_t pcg_advance_lcg_128(pcg128_t state, pcg128_t delta, pcg128_t cur_mult,
195194
pcg128_t cur_plus);
196195

197-
inline void pcg_setseq_128_advance_r(pcg_state_setseq_128* rng, pcg128_t delta)
196+
static inline void pcg_setseq_128_advance_r(pcg_state_setseq_128* rng, pcg128_t delta)
198197
{
199198
rng->state = pcg_advance_lcg_128(rng->state, delta,
200199
PCG_DEFAULT_MULTIPLIER_128, rng->inc);
@@ -211,4 +210,4 @@ extern "C" {
211210
}
212211
#endif
213212

214-
#endif /* PCG64_H_INCLUDED */
213+
#endif /* PCG64_H_INCLUDED */

randomstate/src/random-kit/random-kit.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern void randomkit_seed(randomkit_state *state, uint32_t seed);
3131
extern void randomkit_gen(randomkit_state *state);
3232

3333
/* Slightly optimized reference implementation of the Mersenne Twister */
34-
inline uint32_t randomkit_random(randomkit_state *state)
34+
static inline uint32_t randomkit_random(randomkit_state *state)
3535
{
3636
uint32_t y;
3737

randomstate/src/xoroshiro128plus/xoroshiro128plus.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
extern inline uint64_t xoroshiro128plus_next(xoroshiro128plus_state* state);
55

6-
inline uint64_t rotl(const uint64_t x, int k);
6+
extern inline uint64_t rotl(const uint64_t x, int k);
77

88
void xoroshiro128plus_jump(xoroshiro128plus_state* state) {
99
static const uint64_t JUMP[] = { 0xbeac0467eba5facb, 0xd86b048b86aa9922 };

randomstate/src/xoroshiro128plus/xoroshiro128plus.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ void xoroshiro128plus_seed_by_array(xoroshiro128plus_state* state, uint64_t *see
2020

2121
void xoroshiro128plus_init_state(xoroshiro128plus_state* state, uint64_t seed, uint64_t inc);
2222

23-
inline uint64_t rotl(const uint64_t x, int k) {
23+
static inline uint64_t rotl(const uint64_t x, int k) {
2424
return (x << k) | (x >> (64 - k));
2525
}
2626

27-
inline uint64_t xoroshiro128plus_next(xoroshiro128plus_state* state) {
27+
static inline uint64_t xoroshiro128plus_next(xoroshiro128plus_state* state) {
2828
const uint64_t s0 = state->s[0];
2929
uint64_t s1 = state->s[1];
3030
const uint64_t result = s0 + s1;

randomstate/src/xorshift1024/xorshift1024.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef struct s_xorshift1024_state
1313
int p;
1414
} xorshift1024_state;
1515

16-
inline uint64_t xorshift1024_next(xorshift1024_state* state) {
16+
static inline uint64_t xorshift1024_next(xorshift1024_state* state) {
1717
const uint64_t s0 = state->s[state->p];
1818
uint64_t s1;
1919
state->p = (state->p + 1) & 15;

randomstate/src/xorshift128/xorshift128.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void xorshift128_seed_by_array(xorshift128_state* state, uint64_t *seed_array, i
2121

2222
void xorshift128_init_state(xorshift128_state* state, uint64_t seed, uint64_t inc);
2323

24-
inline uint64_t xorshift128_next(xorshift128_state* state) {
24+
static inline uint64_t xorshift128_next(xorshift128_state* state) {
2525
uint64_t s1 = state->s[0];
2626
const uint64_t s0 = state->s[1];
2727
state->s[0] = s0;

setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838

3939
extra_defs = [('_CRT_SECURE_NO_WARNINGS', '1')] if os.name == 'nt' else []
4040
extra_link_args = ['/LTCG', '/OPT:REF', 'Advapi32.lib', 'Kernel32.lib'] if os.name == 'nt' else []
41-
base_extra_compile_args = [] if os.name == 'nt' else ['-std=c99']
41+
# TODO: The unddefine is to handle a problem when building
42+
# TODO: manylinux1 on CentOS 5/GCC 4.8.2
43+
base_extra_compile_args = [] if os.name == 'nt' else ['-std=c99', '-U__GNUC_GNU_INLINE__']
4244

4345
if USE_SSE2:
4446
if os.name == 'nt':

0 commit comments

Comments
 (0)