Commit ae0554b2 authored by Nathalie Furmento's avatar Nathalie Furmento
Browse files

bubble/tests/basic: improve tests

parent 05bc2422
Pipeline #274018 failed with stages
in 32 minutes and 31 seconds
......@@ -45,9 +45,10 @@ struct starpu_codelet sub_data_codelet =
int rec_is_bubble(struct starpu_task *t, void *arg)
{
int *v = (int *)arg;
fprintf(stderr, "%s is a %s\n", t->name, (*v == 0)?"task":"bubble");
return *v;
int v = *(int *)arg;
fprintf(stderr, "'%s' is a %s\n", starpu_task_get_name(t), (v == 0)?"task":"bubble");
free(arg);
return v;
}
void rec2_bubble_gen_dag(struct starpu_task *t, void *arg)
......@@ -59,7 +60,7 @@ void rec2_bubble_gen_dag(struct starpu_task *t, void *arg)
{
int ret = starpu_task_insert(&sub_data_codelet,
STARPU_RW, subdata[i],
STARPU_NAME, "task_L3",
STARPU_NAME, "T_L3",
0);
STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
......@@ -82,7 +83,9 @@ void rec_bubble_gen_dag(struct starpu_task *t, void *arg)
{
int *is_bubble = malloc(sizeof(int));
*is_bubble = random() & 1;
char *name = (*is_bubble == 0) ? "task_L2" : "bubble_L2";
char *name;
asprintf(&name, "%s %s", starpu_task_get_name(t), (*is_bubble == 0) ? "T_L2" : "B_L2");
int ret = starpu_task_insert(&sub_data_codelet,
STARPU_RW, subdata[i],
STARPU_BUBBLE_PARENT, t,
......@@ -90,8 +93,8 @@ void rec_bubble_gen_dag(struct starpu_task *t, void *arg)
STARPU_BUBBLE_FUNC_ARG, is_bubble,
STARPU_BUBBLE_GEN_DAG_FUNC, &rec2_bubble_gen_dag,
STARPU_BUBBLE_GEN_DAG_FUNC_ARG, sub_handles_l2[i],
STARPU_CALLBACK_WITH_ARG_NFREE, &free_memory, name,
STARPU_NAME, name,
STARPU_CALLBACK_WITH_ARG_NFREE, &free_memory, is_bubble,
0);
STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
}
......@@ -121,20 +124,15 @@ int main(int argv, char **argc)
starpu_data_partition_plan(sub_handles_l1[i], &f, sub_handles_l2[i]);
}
#define STEPS 2
char *names[STEPS];
int *is_bubbles[STEPS];
#define STEPS 10
for(i=0 ; i<STEPS ; i++)
{
int *is_bubble = malloc(sizeof(int));
*is_bubble = random() & 1;
is_bubbles[i] = is_bubble;
char *name;
asprintf(&name, "%s %d", (*is_bubble == 0) ? "task_L1" : "bubble_L1", i);
names[i] = name;
asprintf(&name, "%s %d", (*is_bubble == 0) ? "T_L1" : "B_L1", i);
ret = starpu_task_insert(&sub_data_codelet,
STARPU_RW, main_handle,
......@@ -143,6 +141,7 @@ int main(int argv, char **argc)
STARPU_BUBBLE_GEN_DAG_FUNC, &rec_bubble_gen_dag,
STARPU_BUBBLE_GEN_DAG_FUNC_ARG, sub_handles_l1,
STARPU_NAME, name,
STARPU_CALLBACK_WITH_ARG_NFREE, &free_memory, name,
0);
STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
}
......@@ -157,12 +156,6 @@ int main(int argv, char **argc)
starpu_data_unregister(main_handle);
starpu_shutdown();
for(i=0 ; i<STEPS ; i++)
{
free(is_bubbles[i]);
free(names[i]);
}
for (i=0; i<SIZE; i++)
{
int x=(i+1);
......
......@@ -16,7 +16,7 @@
*/
#include <starpu.h>
#define PARTS 1
#define PARTS 2
#define SIZE 24
#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment