Skip to content

Commit 8a39093

Browse files
authored
Merge pull request #499 from abergeron/rel_07
API-breaking changes planned for 0.7
2 parents 3bab96a + e570513 commit 8a39093

40 files changed

+2297
-755
lines changed

.appveyor.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '0.6.9.{build}'
1+
version: '0.7.0.{build}'
22

33
pull_requests:
44
do_not_increment_build_number: true
@@ -26,6 +26,9 @@ environment:
2626
- PYTHON: "C:\\Python35"
2727
VS_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC"
2828

29+
install:
30+
- python -m pip install mako cython
31+
2932
build_script:
3033
- echo "Python:" "%PYTHON%"
3134
- echo "Config:" "%CONFIGURATION%"

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
99
if(MSVC)
1010
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W3")
1111
else()
12-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -Werror=format-security -Wdeclaration-after-statement -std=gnu89")
12+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-parameter -Werror=format-security -Wdeclaration-after-statement -std=gnu89")
1313
endif()
1414

1515
enable_testing()

doc/installation.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Installation
22
============
33

4-
The library is routinely tested on OS X and linux and, less
5-
frequently, on Windows. The OS most frequently tested are:
4+
The library is routinely tested on linux and, less frequently, on
5+
Windows and Mac OS X. The OS most frequently tested are:
66

77
- Debian 6
88
- Ubuntu 16.04
@@ -55,9 +55,17 @@ functionality.
5555

5656
* For OpenCL:
5757

58-
- OpenCL version 1.1 or more
58+
- OpenCL version 1.2 or more
5959
- (optional) clBLAS (clblas_) or CLBlast (clblast_) for blas functionality
6060

61+
.. note::
62+
63+
The OpenCL that comes with OS X is fundamentally broken and
64+
doesn't work with some of the kernels in the library. You can
65+
use it at your own risk, but don't report problems with it we
66+
can't fix them.
67+
68+
6169
Download
6270
--------
6371

pygpu/basic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
def _generate_kernel(ctx, cols, upper=True):
66
tmpl = Template("""
7+
#include "cluda.h"
78
KERNEL void extract_tri(GLOBAL_MEM ga_float *a, ga_size a_off, ga_uint N) {
89
a = (GLOBAL_MEM ga_float *)(((char *)a) + a_off);
910
unsigned int idx = GID_1 * LDIM_0 * GDIM_0 +

pygpu/gpuarray.pxd

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ cdef extern from "gpuarray/error.h":
6565
GA_UNALIGNED_ERROR, GA_COPY_ERROR, GA_COMM_ERROR
6666

6767
cdef extern from "gpuarray/buffer.h":
68+
ctypedef struct gpucontext_props:
69+
pass
6870
ctypedef struct gpucontext:
6971
pass
7072
ctypedef struct gpudata:
@@ -74,7 +76,17 @@ cdef extern from "gpuarray/buffer.h":
7476

7577
int gpu_get_platform_count(const char* name, unsigned int* platcount)
7678
int gpu_get_device_count(const char* name, unsigned int platform, unsigned int* devcount)
77-
gpucontext *gpucontext_init(const char *name, int devno, int flags, int *ret)
79+
80+
int gpucontext_props_new(gpucontext_props **res)
81+
int gpucontext_props_cuda_dev(gpucontext_props *p, int devno)
82+
int gpucontext_props_opencl_dev(gpucontext_props *p, int platno, int devno)
83+
int gpucontext_props_sched(gpucontext_props *p, int sched)
84+
int gpucontext_props_set_single_stream(gpucontext_props *p)
85+
int gpucontext_props_kernel_cache(gpucontext_props *p, const char *path)
86+
int gpucontext_props_alloc_cache(gpucontext_props *p, size_t initial, size_t max)
87+
void gpucontext_props_del(gpucontext_props *p)
88+
89+
int gpucontext_init(gpucontext **res, const char *name, gpucontext_props *p)
7890
void gpucontext_deref(gpucontext *ctx)
7991
char *gpucontext_error(gpucontext *ctx, int err)
8092
int gpudata_property(gpudata *ctx, int prop_id, void *res)
@@ -83,18 +95,14 @@ cdef extern from "gpuarray/buffer.h":
8395
gpucontext *gpudata_context(gpudata *)
8496
gpucontext *gpukernel_context(gpukernel *)
8597

86-
int GA_CTX_DEFAULT
87-
int GA_CTX_MULTI_THREAD
88-
int GA_CTX_SINGLE_THREAD
89-
int GA_CTX_SINGLE_STREAM
90-
int GA_CTX_DISABLE_ALLOCATION_CACHE
98+
int GA_CTX_SCHED_AUTO
99+
int GA_CTX_SCHED_SINGLE
100+
int GA_CTX_SCHED_MULTI
91101

92102
int GA_CTX_PROP_DEVNAME
93-
int GA_CTX_PROP_PCIBUSID
94-
int GA_CTX_PROP_MAXLSIZE
103+
int GA_CTX_PROP_UNIQUE_ID
95104
int GA_CTX_PROP_LMEMSIZE
96105
int GA_CTX_PROP_NUMPROCS
97-
int GA_CTX_PROP_MAXGSIZE
98106
int GA_CTX_PROP_BIN_ID
99107
int GA_CTX_PROP_TOTAL_GMEM
100108
int GA_CTX_PROP_FREE_GMEM
@@ -114,8 +122,8 @@ cdef extern from "gpuarray/buffer.h":
114122
int GA_KERNEL_PROP_TYPES
115123

116124
cdef enum ga_usefl:
117-
GA_USE_CLUDA, GA_USE_SMALL, GA_USE_DOUBLE, GA_USE_COMPLEX, GA_USE_HALF,
118-
GA_USE_BINARY, GA_USE_CUDA, GA_USE_OPENCL
125+
GA_USE_SMALL, GA_USE_DOUBLE, GA_USE_COMPLEX, GA_USE_HALF,
126+
GA_USE_CUDA, GA_USE_OPENCL
119127

120128
cdef extern from "gpuarray/kernel.h":
121129
ctypedef struct _GpuKernel "GpuKernel":
@@ -131,7 +139,6 @@ cdef extern from "gpuarray/kernel.h":
131139
int GpuKernel_call(_GpuKernel *k, unsigned int n,
132140
const size_t *gs, const size_t *ls,
133141
size_t shared, void **args)
134-
int GpuKernel_binary(_GpuKernel *, size_t *, void **)
135142

136143
cdef extern from "gpuarray/array.h":
137144
ctypedef struct _GpuArray "GpuArray":
@@ -165,10 +172,6 @@ cdef extern from "gpuarray/array.h":
165172
gpudata *data, size_t offset, int typecode,
166173
unsigned int nd, const size_t *dims,
167174
const ssize_t *strides, int writable)
168-
int GpuArray_copy_from_host(_GpuArray *a,
169-
gpucontext *ctx, void *buf, int typecode,
170-
unsigned int nd, const size_t *dims,
171-
const ssize_t *strides) nogil
172175
int GpuArray_view(_GpuArray *v, _GpuArray *a)
173176
int GpuArray_sync(_GpuArray *a) nogil
174177
int GpuArray_index(_GpuArray *r, _GpuArray *a, const ssize_t *starts,
@@ -234,10 +237,6 @@ cdef int array_fromdata(GpuArray a,
234237
gpudata *data, size_t offset, int typecode,
235238
unsigned int nd, const size_t *dims,
236239
const ssize_t *strides, int writeable) except -1
237-
cdef int array_copy_from_host(GpuArray a,
238-
gpucontext *ctx, void *buf, int typecode,
239-
unsigned int nd, const size_t *dims,
240-
const ssize_t *strides) except -1
241240
cdef int array_view(GpuArray v, GpuArray a) except -1
242241
cdef int array_sync(GpuArray a) except -1
243242
cdef int array_index(GpuArray r, GpuArray a, const ssize_t *starts,
@@ -271,7 +270,6 @@ cdef int kernel_sched(GpuKernel k, size_t n, size_t *gs, size_t *ls) except -1
271270
cdef int kernel_call(GpuKernel k, unsigned int n,
272271
const size_t *gs, const size_t *ls,
273272
size_t shared, void **args) except -1
274-
cdef int kernel_binary(GpuKernel k, size_t *, void **) except -1
275273
cdef int kernel_property(GpuKernel k, int prop_id, void *res) except -1
276274

277275
cdef int ctx_property(GpuContext c, int prop_id, void *res) except -1
@@ -281,19 +279,14 @@ cdef api GpuContext pygpu_default_context()
281279

282280
cdef api bint pygpu_GpuArray_Check(object o)
283281

284-
cdef api GpuContext pygpu_init(object dev, int flags)
282+
cdef api GpuContext pygpu_init(object dev, gpucontext_props *p)
285283

286284
cdef api GpuArray pygpu_zeros(unsigned int nd, const size_t *dims,
287285
int typecode, ga_order order,
288286
GpuContext context, object cls)
289287
cdef api GpuArray pygpu_empty(unsigned int nd, const size_t *dims,
290288
int typecode, ga_order order,
291289
GpuContext context, object cls)
292-
cdef api GpuArray pygpu_fromhostdata(void *buf, int typecode, unsigned int nd,
293-
const size_t *dims,
294-
const ssize_t *strides,
295-
GpuContext context, object cls)
296-
297290
cdef api GpuArray pygpu_fromgpudata(gpudata *buf, size_t offset, int typecode,
298291
unsigned int nd, const size_t *dims,
299292
const ssize_t *strides, GpuContext context,

0 commit comments

Comments
 (0)