Skip to content
Snippets Groups Projects
Commit 5b8f20c6 authored by Mulas, Giacomo's avatar Mulas, Giacomo
Browse files

move crucial allocations out of #ifdef USE_OPENMP

parent 9a0ceb74
No related branches found
No related tags found
No related merge requests found
......@@ -340,12 +340,12 @@ void cluster(const string& config_file, const string& data_file, const string& o
#ifdef _OPENMP
// If OpenMP is enabled, give actual values to myompthread and ompnumthreads, and open thread-local output files
myompthread = omp_get_thread_num();
if (myompthread == 0) ompnumthreads = omp_get_num_threads();
#endif
if (myompthread == 0) {
ompnumthreads = omp_get_num_threads();
p_outarray = new VirtualAsciiFile*[ompnumthreads];
vtppoanarray = new VirtualBinaryFile*[ompnumthreads];
}
#endif
// To test parallelism, I will now start feeding this function with "clean" copies of the parameters, so that they will not be changed by previous iterations, and each one will behave as the first one. Define all (empty) variables here, so they have the correct scope, then they get different definitions depending on thread number
ClusterIterationData *cid_2 = NULL;
//FILE *output_2 = NULL;
......@@ -569,12 +569,12 @@ void cluster(const string& config_file, const string& data_file, const string& o
#ifdef _OPENMP
// If OpenMP is enabled, give actual values to myompthread and ompnumthreads, and open thread-local output files
myompthread = omp_get_thread_num();
if (myompthread == 0) ompnumthreads = omp_get_num_threads();
#endif
if (myompthread == 0) {
ompnumthreads = omp_get_num_threads();
p_outarray = new VirtualAsciiFile*[ompnumthreads];
vtppoanarray = new VirtualBinaryFile*[ompnumthreads];
}
#endif
// To test parallelism, I will now start feeding this function with "clean" copies of the parameters, so that they will not be changed by previous iterations, and each one will behave as the first one. Define all (empty) variables here, so they have the correct scope, then they get different definitions depending on thread number
ClusterIterationData *cid_2 = NULL;
//FILE *output_2 = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment