/* * StarPU * Copyright (C) INRIA 2008-2009 (see AUTHORS file) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU Lesser General Public License in COPYING.LGPL for more details. */ #include #include #include #include void cpu_codelet(void *descr[], __attribute__ ((unused)) void *_args) { float *block = (float *)STARPU_GET_BLOCK_PTR(descr[0]); int nx = (int)STARPU_GET_BLOCK_NX(descr[0]); int ny = (int)STARPU_GET_BLOCK_NY(descr[0]); int nz = (int)STARPU_GET_BLOCK_NZ(descr[0]); float *multiplier = (float *)STARPU_GET_VARIABLE_PTR(descr[1]); int i; for(i=0 ; icl = &cl; task->callback_func = NULL; task->buffers[0].handle = block_handle; task->buffers[0].mode = STARPU_RW; task->buffers[1].handle = multiplier_handle; task->buffers[1].mode = STARPU_RW; int ret = starpu_task_submit(task); if (STARPU_UNLIKELY(ret == -ENODEV)) { fprintf(stderr, "No worker may execute this task\n"); return 1; } starpu_task_wait_for_all(); /* update the array in RAM */ starpu_data_sync_with_mem(block_handle, STARPU_R); for(i=0 ; i