diff options
author | Ulrich Bauer <ulrich.bauer@tum.de> | 2015-02-02 10:18:20 +0100 |
---|---|---|
committer | Ulrich Bauer <ulrich.bauer@tum.de> | 2015-02-02 10:18:20 +0100 |
commit | 42a0a04f53d4253df484d07699bee5ab252d4c64 (patch) | |
tree | 33cc7e329c6c0961f5e2ad7f847745b075574605 /include | |
parent | c95e71eef54cd36ba206e497d564b96682b2e926 (diff) |
chunk sqrt
Diffstat (limited to 'include')
-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> {};
}
|