Accéder au contenu.
Menu Sympa

starpu-devel - Re: [starpu-devel] StarPU Question: Using Local Variable as Data Handles?

Objet : Developers list for StarPU

Archives de la liste

Re: [starpu-devel] StarPU Question: Using Local Variable as Data Handles?


Chronologique Discussions 
  • From: Samuel Thibault <samuel.thibault@inria.fr>
  • To: Xinbo Li <lix34545@myumanitoba.ca>
  • Cc: "starpu-devel@inria.fr" <starpu-devel@inria.fr>
  • Subject: Re: [starpu-devel] StarPU Question: Using Local Variable as Data Handles?
  • Date: Thu, 17 Apr 2025 23:34:56 +0200
  • Authentication-results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=samuel.thibault@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr
  • Organization: I am not organized

Hello,

Xinbo Li, le jeu. 17 avril 2025 21:20:56 +0000, a ecrit:
> Is it safe to define a starpu_data_handle_t as a local variable for the
> purpose
> of task submission?
[...]
> My concern is whether StarPU may run into undefined behavior or errors
> when the scheduled task is executed, since it may no longer be able to
> access the handle:

starpu_data_handle_t is just a pointer, so losing it is "safe", sure,
but you need to deallocate it first :)

> For example, in the code snippet below, the handle is
> declared within a local scope. Once the block ends, the variable handle is
> no
> longer accessible.

So you need to unregister it. Either waiting for tasks with
starpu_data_unregister or without waiting for tasks with
starpu_data_unregister_submit.

Samuel

> DataType data;
>
> {
> preparation(&data);
>
> starpu_data_handle_t handle;
> starpu_custom_data_register(&handle, STARPU_MAIN_RAM, &data);
>
> starpu_task_insert(
> &some_codelet,
> STARPU_RW, handle,
> 0);
> }



Archives gérées par MHonArc 2.6.19+.

Haut de le page