// // Copyright (c) 2017 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include "harness/compat.h" #include #include #include #include #include "procs.h" const char *copy_kernel_code = "__kernel void test_copy(__global unsigned int *src, __global unsigned int *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" " dst[tid] = src[tid];\n" "}\n"; int test_arraycopy(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) { cl_uint *input_ptr, *output_ptr; cl_mem streams[4], results; cl_program program; cl_kernel kernel; unsigned num_elements = 128 * 1024; cl_uint num_copies = 1; size_t delta_offset; unsigned i; cl_int err; MTdata d; int error_count = 0; input_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); // results results = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_uint) * num_elements, NULL, &err); test_error(err, "clCreateBuffer failed"); /*****************************************************************************************************************************************/ #pragma mark client backing log_info("Testing CL_MEM_USE_HOST_PTR buffer with clEnqueueCopyBuffer\n"); // randomize data d = init_genrand( gRandomSeed ); for (i=0; i