diff --git a/setup.py b/setup.py index 152c599c0a7841f9a3e4993d4699d51beacc9ad3..0baf6f13e4c44f17b08f251746bd6cdeefd0ae92 100644 --- a/setup.py +++ b/setup.py @@ -60,6 +60,7 @@ def main(): EXTRA_LIBRARIES = [] EXTRA_DEFINES["PYGPU_PACKAGE"] = "pyopencl" + EXTRA_DEFINES["PYGPU_PYOPENCL"] = "1" if conf["CL_TRACE"]: EXTRA_DEFINES["PYOPENCL_TRACE"] = 1 diff --git a/src/wrapper/mempool.hpp b/src/wrapper/mempool.hpp index e2f2314dc2e1dd8e3e6bc212a53ca0569206e42e..f13483438d5774e8f0d447158c08f1649c5e95e3 100644 --- a/src/wrapper/mempool.hpp +++ b/src/wrapper/mempool.hpp @@ -179,7 +179,12 @@ namespace PYGPU_PACKAGE throw PYGPU_PACKAGE::error( "memory_pool::allocate", +#ifdef PYGPU_PYCUDA + CUDA_ERROR_OUT_OF_MEMORY, +#endif +#ifdef PYGPU_PYOPENCL CL_MEM_OBJECT_ALLOCATION_FAILURE, +#endif "failed to free memory for allocation"); } @@ -309,7 +314,13 @@ namespace PYGPU_PACKAGE else throw PYGPU_PACKAGE::error( "pooled_device_allocation::free", - CL_INVALID_VALUE); +#ifdef PYGPU_PYCUDA + CUDA_ERROR_INVALID_HANDLE +#endif +#ifdef PYGPU_PYOPENCL + CL_INVALID_VALUE +#endif + ); } pointer_type ptr() const