Skip to content

Instantly share code, notes, and snippets.

@kwmsmith
kwmsmith / pairwise_cython.pyx
Last active August 12, 2022 04:25
Numba vs. Cython: Parallel Cython with OMP
#cython:boundscheck=False
#cython:wraparound=False
import numpy as np
from cython.parallel cimport prange
from libc.math cimport sqrt
cdef inline double dotp(int i, int j, int N, double[:, ::1] X) nogil:
cdef:
int k
@kwmsmith
kwmsmith / np_c_data.pyx
Created October 17, 2011 18:42
Create NumPy array using data from a C pointer
cimport numpy as cnp
cimport stdlib
cnp.import_array()
cdef class _dealloc_obj:
cdef void *_data
def __cinit__(self):
@kwmsmith
kwmsmith / gist:1229277
Created September 20, 2011 14:41 — forked from srossross/gist:1188971
Template to build a stable jenkins build
#Clean everything like a brand new checkout
#Don't remove "jenkins-upstream" directory
if test -t 1 ; then
echo "stdout is a tty. Are you sure you want to continue? This operation will clean any uncommitted files."
read -p "CTRL-C to exit. Enter to continue:"
fi
git clean -dxf -e "jenkins-upstream"
#Unlink any current development d