diff options
Diffstat (limited to 'include/phat/algorithms')
-rw-r--r-- | include/phat/algorithms/chunk_reduction.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/phat/algorithms/chunk_reduction.h b/include/phat/algorithms/chunk_reduction.h index 1797023..ed864f2 100644 --- a/include/phat/algorithms/chunk_reduction.h +++ b/include/phat/algorithms/chunk_reduction.h @@ -22,7 +22,7 @@ #include <phat/boundary_matrix.h>
namespace phat {
- class chunk_reduction {
+ template <bool use_sqrt = false> class chunk_reduction_impl {
public:
enum column_type { GLOBAL
, LOCAL_POSITIVE
@@ -43,7 +43,7 @@ namespace phat { std::vector < column_type > column_type( nr_columns, GLOBAL );
std::vector< char > is_active( nr_columns, false );
- const index chunk_size = omp_get_max_threads() == 1 ? (index)sqrt( (double)nr_columns ) : nr_columns / omp_get_max_threads();
+ const index chunk_size = use_sqrt ? (index)sqrt( (double)nr_columns ) : nr_columns / omp_get_max_threads();
std::vector< index > chunk_boundaries;
for( index cur_boundary = 0; cur_boundary < nr_columns; cur_boundary += chunk_size )
@@ -220,4 +220,7 @@ namespace phat { boundary_matrix.set_col( col_idx, temp_col );
}
};
+
+ class chunk_reduction : public chunk_reduction_impl<false> {};
+ class chunk_reduction_sqrt : public chunk_reduction_impl<true> {};
}
|