summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-03-16 08:49:56 +0000
committerjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-03-16 08:49:56 +0000
commit4bd916d24e2ed2bb656d73bcc1e8f6c9d1c82d42 (patch)
treee9ff65444762a9e32f220ff5758ad4955245eac5
parentee42d394247bd368818f4131a5f993c768f63e4b (diff)
changed 'private' usage in OpenMP context to 'thread_local_storage' to fix a compile bug with gcc 4.2 on OSX
git-svn-id: https://phat.googlecode.com/svn/trunk@8 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d
-rw-r--r--include/phat/algorithms/chunk_reduction.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/phat/algorithms/chunk_reduction.h b/include/phat/algorithms/chunk_reduction.h
index ebba266..91976e6 100644
--- a/include/phat/algorithms/chunk_reduction.h
+++ b/include/phat/algorithms/chunk_reduction.h
@@ -71,11 +71,11 @@ namespace phat {
// Phase 2+3: Simplify columns and reduce them
for( dimension cur_dim = max_dim; cur_dim >= 1; cur_dim-- ) {
// Phase 2: Simplify columns
- std::vector< index > temp_col;
- #pragma omp parallel for schedule( guided, 1 ), private( temp_col )
+ thread_local_storage< std::vector< index > > temp_col;
+ #pragma omp parallel for schedule( guided, 1 )
for( index idx = 0; idx < (index)global_columns.size(); idx++ )
if( boundary_matrix.get_dim( global_columns[ idx ] ) == cur_dim )
- _global_column_simplification( global_columns[ idx ], boundary_matrix, lowest_one_lookup, column_type, is_active, temp_col );
+ _global_column_simplification( global_columns[ idx ], boundary_matrix, lowest_one_lookup, column_type, is_active, temp_col() );
boundary_matrix.sync();
// Phase 3: Reduce columns
@@ -159,10 +159,12 @@ namespace phat {
const index nr_columns = boundary_matrix.get_num_cols();
std::vector< char > finished( nr_columns, false );
- std::vector< std::pair < index, index > > stack;
- std::vector< index > cur_col_values;
- #pragma omp parallel for schedule( guided, 1 ), private( stack, cur_col_values )
+ thread_local_storage< std::vector< std::pair < index, index > > > stack_buffer;
+ thread_local_storage< std::vector< index > > cur_col_values_buffer;
+ #pragma omp parallel for schedule( guided, 1 )
for( index idx = 0; idx < (index)global_columns.size(); idx++ ) {
+ std::vector< std::pair < index, index > >& stack = stack_buffer();
+ std::vector< index >& cur_col_values = cur_col_values_buffer();
bool pop_next = false;
index start_col = global_columns[ idx ];
stack.push_back( std::pair< index, index >( start_col, -1 ) );