Objet : Developers list for StarPU
Archives de la liste
- From: ASUDE ASUDE <ajitsdeshpande@gmail.com>
- To: Samuel Thibault <samuel.thibault@ens-lyon.org>, starpu-devel@lists.gforge.inria.fr
- Subject: Re: [Starpu-devel] Error - No worker may execute this task
- Date: Tue, 29 Nov 2011 12:09:45 +0000
- List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
- List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>
Hello,
Please find attached the starpu setup code w.r.t to my earlier message about Error: No worker may execute this task(0 OpenCL devices)
Basically setup is as below:
In my application main() calls the starpu function test_starpu(), which has call to starpu_submit_task() which should invoke function test_opencl_codelet() which loads the openCL kernel test_opencl_kernel() from file test_opencl_kernel.cl
Any pointers to debug this would be useful.
thank you.
On Mon, Nov 28, 2011 at 5:04 PM, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
ASUDE ASUDE, le Mon 28 Nov 2011 16:48:22 +0000, a écrit :
> But one thing i notice that in my code STARPU initialization function is calledNot a problem, it'd just use the defaults, which is to use all available
> as starpu_init(NULL) , no conf structure there passed
> Do you reckon that could be the culprit?
resources that starpu_machine_display shows you.
You should probably post your source code, so we can check whether
something else lies in it.
Samuel
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <unistd.h> #include <assert.h> #ifdef __OPENCL__ #ifdef __Apple__ #include <OpenCL/OpenCL.h> #else #include <CL/opencl.h> #endif #endif #ifdef __STARPU__ #include <starpu.h> #include <starpu_profiling.h> #ifdef __OPENCL__ #include <starpu_opencl.h> #endif #ifdef __CUDA__ #include <starpu_cuda.h> #endif #endif #include <test.h> typedef struct _test_arg { float depth; int xoffset; int yoffset; int verbose; } test_arg; static struct starpu_perfmodel_t test_model = { .type = STARPU_HISTORY_BASED, .symbol = "test" }; static struct starpu_perfmodel_t test_power_model = { .type = STARPU_HISTORY_BASED, .symbol = "test_power" }; void test_cpu_codelet(void *buffers[], void *cl_arg){ int devid,id; unsigned width = STARPU_MATRIX_GET_NX(buffers[0]); unsigned height = STARPU_MATRIX_GET_NY(buffers[0]); unsigned ld = STARPU_MATRIX_GET_LD(buffers[0]); float *d_dst = (float *)STARPU_MATRIX_GET_PTR(buffers[0]); float *d_src = (float *)STARPU_MATRIX_GET_PTR(buffers[1]); id = starpu_worker_get_id(); devid = starpu_worker_get_devid(id); test_arg * arg=cl_arg; if(arg->verbose) { char dst[128]; starpu_worker_get_name(id , dst ,128); printf("Executing on %s\n", dst); } test_cpu(d_dst,d_src, ld, width, height, arg->depth, arg->xoffset, arg->yoffset, arg->verbose); } #ifdef __OPENCL__ struct starpu_opencl_program test_opencl_program; void test_opencl_codelet(void *buffers[], void *cl_arg){ cl_device_id device; cl_kernel kernel; cl_context context; cl_command_queue queue; cl_event event; int devid,id; cl_int err = 0; cl_platform_id platform; int width = STARPU_MATRIX_GET_NX(buffers[0]); int height = STARPU_MATRIX_GET_NY(buffers[0]); int ld = STARPU_MATRIX_GET_LD(buffers[0]); int size = width * height * STARPU_MATRIX_GET_ELEMSIZE(buffers[0]); cl_mem *d_dst = (cl_mem *)STARPU_MATRIX_GET_PTR(buffers[0]); cl_mem *d_src = (cl_mem *)STARPU_MATRIX_GET_PTR(buffers[1]); test_arg * arg=cl_arg; id = starpu_worker_get_id(); devid = starpu_worker_get_devid(id); if(arg->verbose) { char dst[128]; starpu_worker_get_name(id , dst ,128); printf("Executing on %s\n", dst); } err = starpu_opencl_load_kernel(&kernel, &queue, &test_opencl_program, "test_opencl_kernel", devid); if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err); assert(err == CL_SUCCESS); starpu_opencl_get_device(devid, &device); starpu_opencl_get_context(devid, &context); starpu_opencl_get_queue(devid, &queue); // Allocate device resources for input lightfield image cl_image_format format = { CL_R, CL_UNSIGNED_INT32}; cl_mem d_tex = clCreateImage2D(context, CL_MEM_READ_ONLY, &format, width, height, 0 ,(void *) d_src, &err); if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err); assert(err == CL_SUCCESS); size_t origin[3] = {0,0,0}; size_t region[3] = {width,height,1}; err = clEnqueueWriteImage(queue, d_tex, CL_TRUE, origin, region, width*sizeof(float), 0, (void *) d_src, 0, NULL, NULL); if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err); assert(err == CL_SUCCESS); cl_sampler sampler = clCreateSampler(context, CL_TRUE, CL_ADDRESS_CLAMP, CL_FILTER_LINEAR, &err); assert(err == CL_SUCCESS); // Now setup the arguments to our test_kernel err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &d_dst); err |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &d_tex); err |= clSetKernelArg(kernel, 2, sizeof(cl_sampler), &sampler); err |= clSetKernelArg(kernel, 3, sizeof(int), &ld); err |= clSetKernelArg(kernel, 4, sizeof(int), &width); err |= clSetKernelArg(kernel, 5, sizeof(int), &height); err |= clSetKernelArg(kernel, 6, sizeof(float), &arg->depth); err |= clSetKernelArg(kernel, 7, sizeof(int), &arg->xoffset); err |= clSetKernelArg(kernel, 8, sizeof(int), &arg->yoffset); assert(err == CL_SUCCESS); size_t localWorkSize[2] = {16,16}; size_t globalWorkSize[2] ={width + (64 - width%64) , height + (64 - height%64) }; err = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, globalWorkSize, localWorkSize, 0, NULL, &event); assert(err == CL_SUCCESS); clFinish(queue); starpu_opencl_collect_stats(event); clReleaseEvent(event); starpu_opencl_release_kernel(kernel); } #endif //__OPENCL__ #ifdef __CUDA__ void test_cuda_codelet(void *buffers[], void *cl_arg){ int width = STARPU_MATRIX_GET_NX(buffers[0]); int height = STARPU_MATRIX_GET_NY(buffers[0]); int ld = STARPU_MATRIX_GET_LD(buffers[0]); int size = width * height * STARPU_MATRIX_GET_ELEMSIZE(buffers[0]); float *d_dst = (float *)STARPU_MATRIX_GET_PTR(buffers[0]); float *d_src = (float *)STARPU_MATRIX_GET_PTR(buffers[1]); int id = starpu_worker_get_id(); int devid = starpu_worker_get_devid(id); test_arg * arg=cl_arg; if(arg->verbose) { char dst[128]; starpu_worker_get_name(id , dst ,128); printf("Executing =%s\n", dst); } _test_cuda(d_dst, d_src, ld, width, height, arg->depth, arg->xoffset, arg->yoffset, 0); } #endif //__CUDA__ int test_starpu(float * h_dst, float * h_src, int ld, int width, int height, float depth, int xoffset, int yoffset, int verbose) { test_arg arg= {depth, xoffset, yoffset, verbose}; starpu_codelet test_codelets = { #if __OPENCL__ && __CUDA__ // Note two GPU required for both OpenCL and CUDA. .where = STARPU_OPENCL | STARPU_CUDA | STARPU_CPU, .opencl_func = test_opencl_codelet, .cuda_func = test_cuda_codelet, #elif __OPENCL__ .where = STARPU_OPENCL, .opencl_func = test_opencl_codelet, #elif __CUDA__ .where = STARPU_CUDA | STARPU_CPU, .cuda_func = test_cuda_codelet, #else .where = STARPU_CPU, #endif .cpu_func = test_cpu_codelet, .nbuffers = 2, .model = &test_model, .power_model = &test_power_model }; starpu_init(NULL); #ifdef __OPENCL__ if(test_codelets.where & STARPU_OPENCL ){ int err = starpu_opencl_load_opencl_from_file("test_opencl_kernel.cl", &test_opencl_program, NULL); assert(err == CL_SUCCESS); } #endif struct starpu_task *task = starpu_task_create(); starpu_data_handle src_handle, dst_handle; starpu_matrix_data_register(&dst_handle, 0, (uintptr_t)h_dst, ld , width, height, sizeof(float)); starpu_matrix_data_register(&src_handle, 0, (uintptr_t)h_src, ld , width, height, sizeof(float)); task->buffers[0].handle = dst_handle; /* 1st parameter of the codelet */ task->buffers[0].mode = STARPU_W; task->buffers[1].handle = src_handle; /* 2nd parameter of the codelet */ task->buffers[1].mode = STARPU_R; task->cl = &test_codelets; task->cl_arg = &arg; /* Remaining parameters of the codelet */ task->cl_arg_size = sizeof(test_arg); task->synchronous = 1; task->callback_func = NULL; /* submit the task to StarPU */ int err = starpu_task_submit(task); if (err == -ENODEV) { printf("No worker may execute this task\n"); return 1; } starpu_task_wait_for_all(); #ifdef __OPENCL__ /* unload program */ if(test_codelets.where & STARPU_OPENCL){ starpu_opencl_unload_opencl( &test_opencl_program); } #endif /* update the array in RAM */ starpu_data_unregister(src_handle); starpu_data_unregister(dst_handle); starpu_shutdown(); return 0; }
- [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Nathalie Furmento, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 28/11/2011
- Message indisponible
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Nathalie Furmento, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 29/11/2011
- Message indisponible
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Sylvain HENRY, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 29/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, ASUDE ASUDE, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Samuel Thibault, 28/11/2011
- Re: [Starpu-devel] Error - No worker may execute this task, Nathalie Furmento, 28/11/2011
Archives gérées par MHonArc 2.6.19+.