/* * StarPU * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (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 #define NX 5 #define NY 4 #define PARTS 2 void cpu_func(void *buffers[], void *cl_arg) { unsigned i, j; int *factor = cl_arg; /* length of the matrix */ unsigned nx = STARPU_MATRIX_GET_NX(buffers[0]); unsigned ny = STARPU_MATRIX_GET_NY(buffers[0]); unsigned ld = STARPU_MATRIX_GET_LD(buffers[0]); /* local copy of the matrix pointer */ int *val = (int *)STARPU_MATRIX_GET_PTR(buffers[0]); for(j=0; jbuffers[0].handle = starpu_data_get_sub_data(handle, 1, i); task->buffers[0].mode = STARPU_RW; task->cl = &cl; task->synchronous = 1; task->cl_arg = &factor; task->cl_arg_size = sizeof(factor); starpu_task_submit(task); } /* Unpartition the data, unregister it from StarPU and shutdown */ starpu_data_unpartition(handle, 0); starpu_data_unregister(handle); starpu_shutdown(); /* Print result matrix */ fprintf(stderr,"OUT Matrix: \n"); for(j=0 ; j