From 5ae0bf1551495777a25f7b5b4543164689f11286 Mon Sep 17 00:00:00 2001 From: d74ksy <aidan.chalk@durham.ac.uk> Date: Thu, 10 Dec 2015 14:06:20 +0000 Subject: [PATCH] Some first fixes on the speedup --- src/qsched.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qsched.c b/src/qsched.c index dbf7b2c..ce29771 100644 --- a/src/qsched.c +++ b/src/qsched.c @@ -2267,13 +2267,13 @@ tsched_init(&ts, s); /*Storage required for the parent calculations */ #define MAX_PARENT_GUESS 64 -int *parents = (int*)malloc(sizeof(int) * MAX_PARENT_GUESS); -if(parents == NULL) - error("Failed to allocate parents array."); +//int *parents = (int*)malloc(sizeof(int) * MAX_PARENT_GUESS); +//if(parents == NULL) +// error("Failed to allocate parents array."); int *current_parents = (int*) malloc(sizeof(int) * MAX_PARENT_GUESS); if(current_parents == NULL) error("Failed to allocate current_parents array."); -int size_parents = MAX_PARENT_GUESS; +//int size_parents = MAX_PARENT_GUESS; int num_parents = 0; int num_current = 0; @@ -2426,7 +2426,7 @@ for(i = 0; i < count; i++) /* If the task has dependencies*/ /*Find the parents. */ num_parents = 0; - int max = wait_init[gettaskindex(t->id, s)]; +// int max = wait_init[gettaskindex(t->id, s)]; /* for(j = i-1; j >= 0 && num_parents < max; j--) { const struct task *t2 = &s->tasks[gettaskindex(tid[j], s)]; @@ -2459,6 +2459,7 @@ for(i = 0; i < count; i++) /* We have all the parents now. */ int *parents = &all_parents[offsets[gettaskindex(ttid,s)]]; + num_parents = offsets[gettaskindex(ttid,s)+1]-offsets[gettaskindex(ttid,s)]; /* Loop over the locked resources */ for(j = 0; j < t->nr_locks; j++) { @@ -2902,7 +2903,6 @@ for(i = 0; i < count; i++) -free(parents); free(current_parents); toc = getticks(); -- GitLab