Loading examples/gfind/sfind.cpp +22 −0 Changes for examples/gfind/sfind.cpp: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -341,6 +341,17 @@ process_parallel_pthreads(const pfind_options_t* opt) { << "-" << end_server - 1 << " using " << num_threads << " threads." << endl; // --- WRITE LOG TO A UNIQUE FILE --- string output_log = "gfind_log.rank-" + to_string(sfind_rank) + ".txt"; ofstream output_file2(output_log); if(!output_file2.is_open()) { pfind_abort("Failed to open output file: " + output_log); } output_file2 << "[Rank " << sfind_rank << "] Processing servers " << start_server << "-" << end_server - 1 << " using " << num_threads << " threads." << endl; output_file2.close(); pthread_mutex_t queue_mutex; pthread_mutex_init(&queue_mutex, nullptr); vector<pthread_t> threads(num_threads); Loading @@ -366,6 +377,17 @@ process_parallel_pthreads(const pfind_options_t* opt) { // Each process prints its own sub-total. The final aggregation must be done // externally (e.g., with a script). cout << "MATCHED " << global_found << "/" << global_checked << endl; // --- WRITE LOCAL RESULTS TO A UNIQUE FILE --- string output_filename = "gfind_results.rank-" + to_string(sfind_rank) + ".txt"; ofstream output_file(output_filename); if(!output_file.is_open()) { pfind_abort("Failed to open output file: " + output_filename); } output_file << "MATCHED " << global_found << "/" << global_checked << endl; output_file.close(); return 0; } Loading Loading
examples/gfind/sfind.cpp +22 −0 Changes for examples/gfind/sfind.cpp: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -341,6 +341,17 @@ process_parallel_pthreads(const pfind_options_t* opt) { << "-" << end_server - 1 << " using " << num_threads << " threads." << endl; // --- WRITE LOG TO A UNIQUE FILE --- string output_log = "gfind_log.rank-" + to_string(sfind_rank) + ".txt"; ofstream output_file2(output_log); if(!output_file2.is_open()) { pfind_abort("Failed to open output file: " + output_log); } output_file2 << "[Rank " << sfind_rank << "] Processing servers " << start_server << "-" << end_server - 1 << " using " << num_threads << " threads." << endl; output_file2.close(); pthread_mutex_t queue_mutex; pthread_mutex_init(&queue_mutex, nullptr); vector<pthread_t> threads(num_threads); Loading @@ -366,6 +377,17 @@ process_parallel_pthreads(const pfind_options_t* opt) { // Each process prints its own sub-total. The final aggregation must be done // externally (e.g., with a script). cout << "MATCHED " << global_found << "/" << global_checked << endl; // --- WRITE LOCAL RESULTS TO A UNIQUE FILE --- string output_filename = "gfind_results.rank-" + to_string(sfind_rank) + ".txt"; ofstream output_file(output_filename); if(!output_file.is_open()) { pfind_abort("Failed to open output file: " + output_filename); } output_file << "MATCHED " << global_found << "/" << global_checked << endl; output_file.close(); return 0; } Loading