Accéder au contenu.
Menu Sympa

starpu-devel - [Starpu-devel] Task which accesses multiple time the same handle with different access modes.

Objet : Developers list for StarPU

Archives de la liste

[Starpu-devel] Task which accesses multiple time the same handle with different access modes.


Chronologique Discussions 
  • From: Jean-Marie Couteyen <jean-marie.couteyen@inria.fr>
  • To: "starpu-devel@lists.gforge.inria.fr" <starpu-devel@lists.gforge.inria.fr>
  • Subject: [Starpu-devel] Task which accesses multiple time the same handle with different access modes.
  • Date: Thu, 19 Feb 2015 17:31:39 +0100
  • 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,

I used to submit tasks with multiple time the same handles in StarPU 1.1.x without issues (mostly STARPU_R / STARPU_RW). I thought this to be valid code since I never had issues with it and nothing advertise against it in the manual.

I tried the branches/1.2 and the trunk with my code and I ran into issues doing this. A deadlock occurs with some kind of cyclic dependencies between tasks according to the macro _STARPU_DEP_DEBUG. It seems that the code to detect implicit dependencies have evolved heavily between 1.1 and 1.2.

I made a MWE which illustrate the issue. It works with 1.1.3, and deadlock with branches/1.2 (I did not try trunk with this one).

Is it possible to do something?

Regards.

Jean-Marie Couteyen


//icc -g -O0 -std=c99 task_with_multiple_time_the_same_handle.c $(pkg-config
--libs starpu-1.1) $(pkg-config --cflags starpu-1.1)
#define _GNU_SOURCE
#include <starpu.h>
#include <limits.h>

static void sum_cpu(void * descr[], void *cl_arg)
{
double * v_dst = (double *) STARPU_VARIABLE_GET_PTR(descr[0]);
double * v_src = (double *) STARPU_VARIABLE_GET_PTR(descr[1]);
*v_dst+=*v_src;
}

static void sum3_cpu(void * descr[], void *cl_arg)
{
double * v_src1 = (double *) STARPU_VARIABLE_GET_PTR(descr[1]);
double * v_src2 = (double *) STARPU_VARIABLE_GET_PTR(descr[1]);
double * v_dst = (double *) STARPU_VARIABLE_GET_PTR(descr[0]);
*v_dst+=*v_src1+*v_src2;
}

static struct starpu_codelet sum_cl =
{
.cpu_funcs = {sum_cpu, NULL},
.nbuffers = 2,
.modes={STARPU_RW,STARPU_R}
};

static struct starpu_codelet sum3_cl =
{
.cpu_funcs = {sum3_cpu, NULL},
.nbuffers = 3,
.modes={STARPU_R,STARPU_R,STARPU_RW}
};

int main(int argc, char * argv[])
{
starpu_data_handle_t handle;

int ret=starpu_init(NULL);
double value=1.0;

starpu_variable_data_register(&handle,0,(uintptr_t)&value,sizeof(double));

for (int i=0; i<2; i++)
{
starpu_insert_task(&sum_cl,
STARPU_RW, handle,
STARPU_R, handle,
0);
starpu_insert_task(&sum3_cl,
STARPU_R, handle,
STARPU_R, handle,
STARPU_RW, handle,
0);
}



starpu_task_wait_for_all();
starpu_data_unregister(handle);
printf("%f\n",value);



starpu_shutdown();
}




Archives gérées par MHonArc 2.6.19+.

Haut de le page