Fixed bug with bli_get_range_weighted

This commit is contained in:
Tyler Smith
2014-05-14 14:59:04 -05:00
parent 45957cc774
commit 13a4c717ed

View File

@@ -235,45 +235,6 @@ void bli_get_range( void* thr, dim_t all_start, dim_t all_end, dim_t block_facto
*end = bli_min( *start + n_pt, size + all_start );
}
void bli_get_range_weighted( void* thr, dim_t all_start, dim_t all_end, dim_t block_factor, bool_t forward, dim_t* out_start, dim_t* out_end)
{
//bli_get_range( thr, all_start, all_end, block_factor, out_start, out_end );
//return;
thrinfo_t* thread = (thrinfo_t*) thr;
dim_t n_way = thread->n_way;
dim_t work_id = thread->work_id;
dim_t size = all_end - all_start;
dim_t start = all_start;
dim_t end = all_end;
if( !forward ) {
work_id = n_way - work_id - 1;
}
dim_t curr_caucus = n_way - 1;
dim_t len = 0;
dim_t num = size*size / n_way; // 2xArea per thread?
while(1){
dim_t width = sqrt( len*len + num ) - len; // The width of the current caucus
width = (width % block_factor == 0) ? width : width + block_factor - (width % block_factor);
if( curr_caucus == work_id ) {
if( end > width )
start = bli_max(end - width, start);
break;
}
else{
end -= width;
len += width;
curr_caucus--;
}
}
*out_start = start;
*out_end = end;
}
/*
void bli_get_range_weighted( void* thr, dim_t all_start, dim_t all_end, dim_t block_factor, bool_t forward, dim_t* start, dim_t* end)
{
thrinfo_t* thread = (thrinfo_t*) thr;
@@ -281,8 +242,8 @@ void bli_get_range_weighted( void* thr, dim_t all_start, dim_t all_end, dim_t bl
dim_t work_id = thread->work_id;
dim_t size = all_end - all_start;
*start = all_start;
*end = all_end;
*start = 0;
*end = all_end - all_start;
if( forward ) {
dim_t curr_caucus = n_way - 1;
@@ -294,6 +255,9 @@ void bli_get_range_weighted( void* thr, dim_t all_start, dim_t all_end, dim_t bl
if( curr_caucus == work_id ) {
if( *end > width )
*start = *end - width;
*start = *start + all_start;
*end = *end + all_start;
return;
}
else{
@@ -304,6 +268,7 @@ void bli_get_range_weighted( void* thr, dim_t all_start, dim_t all_end, dim_t bl
}
}
else{
dim_t len = *end - *start;
dim_t num = size*size / n_way;
while(1){
@@ -312,6 +277,9 @@ void bli_get_range_weighted( void* thr, dim_t all_start, dim_t all_end, dim_t bl
if( work_id == 0 ) {
*end = bli_min( *start + width, *end );
*start = *start + all_start;
*end = *end + all_start;
return;
}
else{
@@ -321,7 +289,6 @@ void bli_get_range_weighted( void* thr, dim_t all_start, dim_t all_end, dim_t bl
}
}
}
*/
void bli_level3_thread_decorator( dim_t n_threads,
level3_int_t func,