Add feature to print array data sizes on JNI code
#include "utils.h"
#define PRINT_DATA_TIMES 0
+#define PRINT_DATA_SIZES 1
#ifdef PRINT_DATA_TIMES
#include "opencl_time_utils.h"
@@ -67,7 +68,9 @@ CREATE_ARRAY(Java_uk_ac_manchester_tornado_drivers_opencl_OCLContext, D, double)
jsize num_bytes = (cb != -1) ? cb : (*env)->GetArrayLength(env, array1) * sizeof ( j ## TYPE ); \
OPENCL_DECODE_WAITLIST(array2, events, num_events) \
JNI_ACQUIRE_ARRAY(jbyte,buffer,array1);\
+ if(PRINT_DATA_SIZES) { \
debug("uk.ac.manchester.tornado.drivers.opencl> write array 0x%lx (%d bytes) from %p \n",offset, num_bytes, buffer);\
+ } \
cl_event event; \
OPENCL_SOFT_ERROR("clEnqueueWriteBuffer (" #TYPE ")", clEnqueueWriteBuffer((cl_command_queue) queue_id, (cl_mem) device_ptr, blocking_write, (size_t) offset, (size_t) num_bytes, (void *) buffer,(cl_uint) num_events, (cl_event*) events, &event),-1); \
if(PRINT_DATA_TIMES) { \
@@ -96,7 +99,9 @@ WRITE_ARRAY(Java_uk_ac_manchester_tornado_drivers_opencl_OCLCommandQueue, D, dou
jsize num_bytes = (cb != -1) ? cb : (*env)->GetArrayLength(env, array1) * sizeof ( j ## TYPE ); \
OPENCL_DECODE_WAITLIST(array2, events, num_events) \
JNI_ACQUIRE_ARRAY(jbyte,buffer,array1);\
- debug("uk.ac.manchester.tornado.drivers.opencl> read array 0x%lx (%d bytes) to %p\n",offset, num_bytes, buffer);\
+ if(PRINT_DATA_SIZES) { \
+ printf("uk.ac.manchester.tornado.drivers.opencl> read array 0x%lx (%d bytes) to %p\n",offset, num_bytes, buffer);\
+ }\
cl_event event; \
OPENCL_SOFT_ERROR("clEnqueueReadBuffer (" #TYPE ")", clEnqueueReadBuffer((cl_command_queue) queue_id, (cl_mem) device_ptr, blocking, (size_t) offset, (size_t) num_bytes, (void *) buffer, (cl_uint) num_events, (cl_event*) events, &event), -1); \
if(PRINT_DATA_TIMES) { \
