From bf64faab7dd9da8683484971a64c6c87f40a89a3 Mon Sep 17 00:00:00 2001 From: "jan.reininghaus" Date: Fri, 7 Jun 2013 12:41:23 +0000 Subject: performance improvements through OpenMP git-svn-id: https://phat.googlecode.com/svn/trunk@88 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d --- include/phat/boundary_matrix.h | 1 + include/phat/helpers/dualize.h | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/phat/boundary_matrix.h b/include/phat/boundary_matrix.h index 7be14d8..1bdee61 100644 --- a/include/phat/boundary_matrix.h +++ b/include/phat/boundary_matrix.h @@ -176,6 +176,7 @@ namespace phat { const index nr_of_columns = (index)input_matrix.size(); this->set_num_cols( nr_of_columns ); column temp_col; + #pragma omp parallel for private( temp_col ) for( index cur_col = 0; cur_col < nr_of_columns; cur_col++ ) { this->set_dim( cur_col, (dimension)input_dims[ cur_col ] ); diff --git a/include/phat/helpers/dualize.h b/include/phat/helpers/dualize.h index e3ae9ed..3ffedf8 100644 --- a/include/phat/helpers/dualize.h +++ b/include/phat/helpers/dualize.h @@ -40,13 +40,13 @@ namespace phat { for( index cur_col = 0; cur_col < nr_of_columns; cur_col++ ) { boundary_matrix.get_col( cur_col, temp_col ); for( index idx = 0; idx < (index)temp_col.size(); idx++) - dual_sizes[ nr_of_columns - 1 - temp_col[ idx ] ]++; + dual_sizes[ nr_of_columns - 1 - temp_col[ idx ] ]++; } - for( index cur_col = 0; cur_col < nr_of_columns; cur_col++ ) { + #pragma omp parallel for + for( index cur_col = 0; cur_col < nr_of_columns; cur_col++ ) dual_matrix[cur_col].reserve(dual_sizes[cur_col]); - } - + for( index cur_col = 0; cur_col < nr_of_columns; cur_col++ ) { boundary_matrix.get_col( cur_col, temp_col ); for( index idx = 0; idx < (index)temp_col.size(); idx++) @@ -54,9 +54,11 @@ namespace phat { } const dimension max_dim = boundary_matrix.get_max_dim(); + #pragma omp parallel for for( index cur_col = 0; cur_col < nr_of_columns; cur_col++ ) dual_dims[ nr_of_columns - 1 - cur_col ] = max_dim - boundary_matrix.get_dim( cur_col ); + #pragma omp parallel for for( index cur_col = 0; cur_col < nr_of_columns; cur_col++ ) std::reverse( dual_matrix[ cur_col ].begin(), dual_matrix[ cur_col ].end() ); -- cgit v1.2.3