From 42a0a04f53d4253df484d07699bee5ab252d4c64 Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Mon, 2 Feb 2015 10:18:20 +0100 Subject: chunk sqrt --- include/phat/algorithms/chunk_reduction.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') 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 namespace phat { - class chunk_reduction { + template 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 {}; + class chunk_reduction_sqrt : public chunk_reduction_impl {}; } -- cgit v1.2.3