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

make the splitting of outputs conditional on _OPENMP

parent d5c10ae3
No related branches found
No related tags found
No related merge requests found
......@@ -361,10 +361,13 @@ void cluster(string config_file, string data_file, string output_path) {
#ifdef _OPENMP
myompthread = omp_get_thread_num();
if (myompthread == 0) ompnumthreads = omp_get_num_threads();
#endif
FILE *output_2 = fopen((output_path + "/c_OCLU_" + to_string(myompthread)).c_str(), "w");
fstream tppoan_2;
tppoan_2.open((output_path + "/c_TPPOAN_" + to_string(myompthread)).c_str(), ios::out | ios::binary);
#else
FILE *output_2 = output;
fstream &tppoan_2 = tppoan;
#endif
double *gaps_2 = new double[nsph]();
double **tqse_2 = new double*[2];
double **tqce_2 = new double*[2];
......@@ -533,8 +536,10 @@ void cluster(string config_file, string data_file, string output_path) {
delete c4_2;
delete c6_2;
delete c9_2;
#ifdef _OPENMP
fclose(output_2);
tppoan_2.close();
#endif
delete[] gaps_2;
for (int ti = 0; ti <2 -1; ti++) {
delete[] tqse_2[ti];
......@@ -604,6 +609,7 @@ void cluster(string config_file, string data_file, string output_path) {
delete[] am_2;
} // jxi488 loop
#ifdef _OPENMP
for (int ri = 0; ri < ompnumthreads; ri++) {
// Giovanni, please add here in this loop code to reopen the temporary files, reread them and append them respectively to the global output and tppoan, before closing them
string partial_file_name = output_path + "/c_OCLU_" + to_string(ri);
......@@ -630,6 +636,7 @@ void cluster(string config_file, string data_file, string output_path) {
remove(partial_file_name.c_str());
printf("done.\n");
}
#endif
tppoan.close();
} else { // In case TPPOAN could not be opened. Should never happen.
printf("\nERROR: failed to open TPPOAN file.\n");
......
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