diff --git a/examples/test.c b/examples/test.c index 9d181aa1d4b00ff2e5900d039ca9ab658d07f676..3a31be376fa9b92e6634fd4f99bbae9c0df7bc95 100644 --- a/examples/test.c +++ b/examples/test.c @@ -118,7 +118,7 @@ void test2 ( int m , int n , int k , int nr_threads ) { /* Build a task for each tile of the matrix c. */ for ( i = 0 ; i < m ; i++ ) for ( j = 0 ; j < n ; j++ ) { - rid = qsched_addres( &s , qsched_owner_none , qsched_res_none ); + rid = qsched_addres( &s , qsched_owner_none , qsched_res_none , NULL , 0 ); data[0] = i; data[1] = j; for ( kk = 0 ; kk < k ; kk++ ) { data[2] = kk; @@ -222,7 +222,7 @@ void test1 ( int m , int n , int k , int nr_threads ) { for ( i = 0 ; i < m ; i++ ) for ( j = 0 ; j < n ; j++ ) { data[0] = i; data[1] = j; - rid = qsched_addres( &s , qsched_owner_none , qsched_res_none ); + rid = qsched_addres( &s , qsched_owner_none , qsched_res_none , NULL , 0 ); tid = qsched_addtask( &s , 1 , task_flag_none , data , 2*sizeof(int) , 1 ); qsched_addlock( &s , tid , rid ); } diff --git a/examples/test_bh.c b/examples/test_bh.c index 906fcfd4b883399677b8a7e81c59815a2bd9e734..15f32b0a36ddc58af2c3624386013ff545bdbe05 100644 --- a/examples/test_bh.c +++ b/examples/test_bh.c @@ -232,7 +232,7 @@ void cell_split(struct cell *c, struct qsched *s) { /* Add a resource for this cell if it doesn't have one yet. */ if (c->res == qsched_res_none) - c->res = qsched_addres(s, qsched_owner_none, qsched_res_none); + c->res = qsched_addres(s, qsched_owner_none, qsched_res_none, c->parts, sizeof(struct part) * count); /* Attach a center-of-mass task to the cell. */ #ifdef COM_AS_TASK @@ -254,7 +254,6 @@ void cell_split(struct cell *c, struct qsched *s) { cp->loc[1] = c->loc[1]; cp->loc[2] = c->loc[2]; cp->h = c->h * 0.5; - cp->res = qsched_addres(s, qsched_owner_none, c->res); if (k & 4) cp->loc[0] += cp->h; if (k & 2) cp->loc[1] += cp->h; if (k & 1) cp->loc[2] += cp->h; @@ -320,8 +319,10 @@ void cell_split(struct cell *c, struct qsched *s) { /* Store the counts and offsets. */ for (k = 0; k < 8; k++) { - progenitors[k]->count = right[k] - left[k] + 1; - progenitors[k]->parts = &c->parts[left[k]]; + cp = progenitors[k]; + cp->count = right[k] - left[k] + 1; + cp->parts = &c->parts[left[k]]; + cp->res = qsched_addres(s, qsched_owner_none, c->res, cp->parts, sizeof(struct part) * cp->count); } /* Find the first non-empty progenitor */ diff --git a/examples/test_bh_sorted.c b/examples/test_bh_sorted.c index de3928df60d0d8e19248955b174a74360357a066..0080bfa830884d27e8d8221f5b6d9f10e712c913 100644 --- a/examples/test_bh_sorted.c +++ b/examples/test_bh_sorted.c @@ -595,7 +595,7 @@ void cell_split(struct cell *c, struct qsched *s) { /* Add a resource for this cell if it doesn't have one yet. */ if (c->res == qsched_res_none) - c->res = qsched_addres(s, qsched_owner_none, qsched_res_none); + c->res = qsched_addres(s, qsched_owner_none, qsched_res_none, parts, sizeof(struct part) * count); /* Attach a center-of-mass task to the cell. */ #ifdef COM_AS_TASK @@ -617,7 +617,6 @@ void cell_split(struct cell *c, struct qsched *s) { cp->loc[1] = c->loc[1]; cp->loc[2] = c->loc[2]; cp->h = c->h * 0.5; - cp->res = qsched_addres(s, qsched_owner_none, c->res); if (k & 4) cp->loc[0] += cp->h; if (k & 2) cp->loc[1] += cp->h; if (k & 1) cp->loc[2] += cp->h; @@ -683,8 +682,10 @@ void cell_split(struct cell *c, struct qsched *s) { /* Store the counts and offsets. */ for (k = 0; k < 8; k++) { - progenitors[k]->count = right[k] - left[k] + 1; - progenitors[k]->parts = &c->parts[left[k]]; + cp = progenitors[k]; + cp->count = right[k] - left[k] + 1; + cp->parts = &c->parts[left[k]]; + cp->res = qsched_addres(s, qsched_owner_none, c->res, cp->parts, sizeof(struct part) * cp->count); } /* Find the first non-empty progenitor */ diff --git a/examples/test_fmm_sorted.c b/examples/test_fmm_sorted.c index ec33c0d53f412d723f93c24563d7cd0af07afc27..8578208fb315149f64daa126258395b83aa91794 100644 --- a/examples/test_fmm_sorted.c +++ b/examples/test_fmm_sorted.c @@ -593,7 +593,7 @@ void cell_split(struct cell *c, struct qsched *s) { /* Add a resource for this cell if it doesn't have one yet. */ if (c->res == qsched_res_none) - c->res = qsched_addres(s, qsched_owner_none, qsched_res_none); + c->res = qsched_addres(s, qsched_owner_none, qsched_res_none, parts, sizeof(struct part) * count); /* Attach a center-of-mass task to the cell. */ #ifdef COM_AS_TASK @@ -615,7 +615,6 @@ void cell_split(struct cell *c, struct qsched *s) { cp->loc[1] = c->loc[1]; cp->loc[2] = c->loc[2]; cp->h = c->h * 0.5; - cp->res = qsched_addres(s, qsched_owner_none, c->res); if (k & 4) cp->loc[0] += cp->h; if (k & 2) cp->loc[1] += cp->h; if (k & 1) cp->loc[2] += cp->h; @@ -681,8 +680,10 @@ void cell_split(struct cell *c, struct qsched *s) { /* Store the counts and offsets. */ for (k = 0; k < 8; k++) { - progenitors[k]->count = right[k] - left[k] + 1; - progenitors[k]->parts = &c->parts[left[k]]; + cp = progenitors[k]; + cp->count = right[k] - left[k] + 1; + cp->parts = &c->parts[left[k]]; + cp->res = qsched_addres(s, qsched_owner_none, c->res, cp->parts, sizeof(struct part) * cp->count); } /* Find the first non-empty progenitor */ diff --git a/examples/test_qr.c b/examples/test_qr.c index b9cdbecde7b6a2d430f0afbbe24015c88ba8a028..d70977c8ce1722f689a62c689f8aa01a16fef5dc 100644 --- a/examples/test_qr.c +++ b/examples/test_qr.c @@ -531,7 +531,7 @@ void test_qr(int m, int n, int K, int nr_threads, int runs, double* matrix) { error("Failed to allocate tid/rid matrix."); for (k = 0; k < m * n; k++) { tid[k] = qsched_task_none; - rid[k] = qsched_addres(&s, qsched_owner_none, qsched_res_none); + rid[k] = qsched_addres(&s, qsched_owner_none, qsched_res_none, &rid[k], sizeof(qsched_res_t)); } /* Build the tasks. */ diff --git a/src/res.h b/src/res.h index 52d38c705be5ece5b0efb520b5fb5ae805ee9133..2dbd7c34ee2eb39da162115c408292c6a718b547 100644 --- a/src/res.h +++ b/src/res.h @@ -32,5 +32,11 @@ struct res { /* The resource's parent. */ int parent; + + /* The resource's data. */ + void *data; + + /* The resource's size. */ + size_t size; };