66#include "gpuarray/buffer_collectives.h"
77#include "gpuarray/error.h"
88
9+ #include "util/error.h"
910#include "private.h"
1011
1112extern const gpuarray_buffer_ops cuda_ops ;
@@ -22,7 +23,7 @@ const gpuarray_buffer_ops *gpuarray_get_ops(const char *name) {
2223int gpu_get_platform_count (const char * name , unsigned int * platcount ) {
2324 const gpuarray_buffer_ops * ops = gpuarray_get_ops (name );
2425 if (ops == NULL ) {
25- return GA_INVALID_ERROR ;
26+ return error_set ( & global_err , GA_INVALID_ERROR , "Invalid platform" ) ;
2627 }
2728 return ops -> get_platform_count (platcount );
2829}
@@ -31,7 +32,7 @@ int gpu_get_device_count(const char* name, unsigned int platform,
3132 unsigned int * devcount ) {
3233 const gpuarray_buffer_ops * ops = gpuarray_get_ops (name );
3334 if (ops == NULL ) {
34- return GA_INVALID_ERROR ;
35+ return error_set ( & global_err , GA_INVALID_ERROR , "Invalid platform" ) ;
3536 }
3637 return ops -> get_device_count (platform , devcount );
3738}
@@ -121,7 +122,7 @@ int gpudata_transfer(gpudata *dst, size_t dstoff, gpudata *src, size_t srcoff,
121122 /* Fallback to host copy */
122123 tmp = malloc (sz );
123124 if (tmp == NULL )
124- return GA_MEMORY_ERROR ;
125+ return error_sys ( ctx -> err , "malloc" ) ;
125126 res = src_ctx -> ops -> buffer_read (tmp , src , srcoff , sz );
126127 if (res != GA_NO_ERROR ) {
127128 free (tmp );
0 commit comments