Skip to content
Snippets Groups Projects
Commit 3a84c78d authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Remove also the c_OCLU_MPIRANK_0 files

parent b1b06a1b
No related branches found
No related tags found
No related merge requests found
...@@ -258,34 +258,39 @@ void cluster(const string& config_file, const string& data_file, const string& o ...@@ -258,34 +258,39 @@ void cluster(const string& config_file, const string& data_file, const string& o
#pragma omp barrier #pragma omp barrier
{ {
// thread 0 already wrote on global files, skip it and take care of appending the others // thread 0 already wrote on global files, skip it and take care of appending the others
for (int ri = 1; ri < ompnumthreads; ri++) { for (int ri = 0; ri < ompnumthreads; ri++) {
// still, we need to remove all c_OCLU_RANK_0 files
string partial_file_name = output_path + "/c_OCLU_" + to_string(mpidata->rank) + "_" + to_string(ri); string partial_file_name = output_path + "/c_OCLU_" + to_string(mpidata->rank) + "_" + to_string(ri);
string message = "Copying ASCII output in MPI process " + to_string(mpidata->rank) + " of thread " + to_string(ri) + " of " + to_string(ompnumthreads - 1) + "... "; if (ri == 0) {
logger->log(message, LOG_DEBG); remove(partial_file_name.c_str());
FILE *partial_output = fopen(partial_file_name.c_str(), "r"); } else {
int c = fgetc(partial_output); string message = "Copying ASCII output in MPI process " + to_string(mpidata->rank) + " of thread " + to_string(ri) + " of " + to_string(ompnumthreads - 1) + "... ";
while (c != EOF) { logger->log(message, LOG_DEBG);
fputc(c, output); FILE *partial_output = fopen(partial_file_name.c_str(), "r");
c = fgetc(partial_output); int c = fgetc(partial_output);
while (c != EOF) {
fputc(c, output);
c = fgetc(partial_output);
}
fclose(partial_output);
remove(partial_file_name.c_str());
logger->log("done.\n", LOG_DEBG);
partial_file_name = output_path + "/c_TPPOAN_" + to_string(mpidata->rank) + "_" + to_string(ri);
message = "Copying binary output in MPI process " + to_string(mpidata->rank) + " of thread " + to_string(ri) + " of " + to_string(ompnumthreads - 1) + "... ";
logger->log(message, LOG_DEBG);
fstream partial_tppoan;
partial_tppoan.open(partial_file_name.c_str(), ios::in | ios::binary);
partial_tppoan.seekg(0, ios::end);
long buffer_size = partial_tppoan.tellg();
char *binary_buffer = new char[buffer_size];
partial_tppoan.seekg(0, ios::beg);
partial_tppoan.read(binary_buffer, buffer_size);
tppoan.write(binary_buffer, buffer_size);
partial_tppoan.close();
delete[] binary_buffer;
remove(partial_file_name.c_str());
logger->log("done.\n", LOG_DEBG);
} }
fclose(partial_output);
remove(partial_file_name.c_str());
logger->log("done.\n", LOG_DEBG);
partial_file_name = output_path + "/c_TPPOAN_" + to_string(mpidata->rank) + "_" + to_string(ri);
message = "Copying binary output in MPI process " + to_string(mpidata->rank) + " of thread " + to_string(ri) + " of " + to_string(ompnumthreads - 1) + "... ";
logger->log(message, LOG_DEBG);
fstream partial_tppoan;
partial_tppoan.open(partial_file_name.c_str(), ios::in | ios::binary);
partial_tppoan.seekg(0, ios::end);
long buffer_size = partial_tppoan.tellg();
char *binary_buffer = new char[buffer_size];
partial_tppoan.seekg(0, ios::beg);
partial_tppoan.read(binary_buffer, buffer_size);
tppoan.write(binary_buffer, buffer_size);
partial_tppoan.close();
delete[] binary_buffer;
remove(partial_file_name.c_str());
logger->log("done.\n", LOG_DEBG);
} }
} }
#endif #endif
...@@ -453,6 +458,7 @@ void cluster(const string& config_file, const string& data_file, const string& o ...@@ -453,6 +458,7 @@ void cluster(const string& config_file, const string& data_file, const string& o
MPI_Send(&chunk_buffer_size, 1, MPI_INT, 0, 1, MPI_COMM_WORLD); MPI_Send(&chunk_buffer_size, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
partial_output.close(); partial_output.close();
delete[] chunk_buffer; delete[] chunk_buffer;
remove(partial_file_name.c_str());
partial_file_name = output_path + "/c_TPPOAN_" + to_string(mpidata->rank) + "_" + to_string(ri); partial_file_name = output_path + "/c_TPPOAN_" + to_string(mpidata->rank) + "_" + to_string(ri);
message = "Copying binary output in MPI process " + to_string(mpidata->rank) + " of thread " + to_string(ri) + " of " + to_string(ompnumthreads - 1) + "... "; message = "Copying binary output in MPI process " + to_string(mpidata->rank) + " of thread " + to_string(ri) + " of " + to_string(ompnumthreads - 1) + "... ";
......
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