123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #include <starpu.h>
- struct params {
- int i;
- float f;
- };
- void cpu_func(void *buffers[], void *cl_arg)
- {
- struct params *params = cl_arg;
- printf("Hello world (params = {%i, %f} )\n", params->i, params->f);
- }
- struct starpu_codelet cl =
- {
- .where = STARPU_CPU,
- .cpu_funcs = {cpu_func, NULL},
- .nbuffers = 0
- };
- void callback_func(void *callback_arg)
- {
- printf("Callback function (arg %x)\n", callback_arg);
- }
- int main(int argc, char **argv)
- {
-
- starpu_init(NULL);
- struct starpu_task *task = starpu_task_create();
- task->cl = &cl;
- struct params params = { 1, 2.0f };
- task->cl_arg = ¶ms;
- task->cl_arg_size = sizeof(params);
- task->callback_func = callback_func;
- task->callback_arg = 0x42;
-
- task->synchronous = 1;
-
- starpu_task_submit(task);
-
- starpu_shutdown();
- return 0;
- }
|