Loading examples/gfind/gfind.cpp +47 −38 Original line number Diff line number Diff line Loading @@ -200,6 +200,14 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help, } argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-M") == 0) { res->mountdir = strdup(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-S") == 0) { res->num_servers = atoi(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if (!firstarg) { firstarg = strdup(argv[i]); argv[i][0] = 0; Loading Loading @@ -254,12 +262,12 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help, case 's': res->stonewall_timer = atol(optarg); break; case 'S': res->num_servers = atoi(optarg); break; case 'M': res->mountdir = strdup(optarg); break; // case 'S': // res->num_servers = atoi(optarg); // break; // case 'M': // res->mountdir = strdup(optarg); // break; case 'v': res->verbosity++; break; Loading Loading @@ -303,9 +311,9 @@ string recv_newPath() { MPI_Bcast(&count, 1, MPI_INT, 0, MPI_COMM_WORLD); if (count == 0) return "Terminate"; char buf[count]; MPI_Bcast(buf, count, MPI_CHAR, 0, MPI_COMM_WORLD); return buf; std::vector<char> buf(count); MPI_Bcast(buf.data(), count, MPI_CHAR, 0, MPI_COMM_WORLD); return std::string(buf.begin(), buf.end()); } /* Client Processing a path. Loading @@ -331,7 +339,7 @@ void dirProcess(const string path, unsigned long long &checked, servers_per_node++; for (int it = 0; it < servers_per_node; it++) { auto server = (world_rank - 1) * servers_per_node + it; if (server >= opt->num_servers) if (server >= (unsigned int) opt->num_servers) break; unsigned long long total_size = 0; Loading @@ -340,7 +348,7 @@ void dirProcess(const string path, unsigned long long &checked, (sizeof(struct dirent_extended) + 255) * 1024 * 100, server); struct dirent_extended *temp = getdir; while (total_size < n) { while (total_size < (unsigned long long) n) { if (strlen(temp->d_name) == 0) break; total_size += temp->d_reclen; Loading Loading @@ -401,36 +409,37 @@ int process(char *processor_name, int world_rank, int world_size, dirs.push(workdir); do { string processpath = dirs.front(); std::string processpath = dirs.front(); dirs.pop(); // DISTRIBUTE WORK send_newPath(processpath); auto received_strings = true; // We need to gather new directories found (we use send-recv) for (auto i = 1; i < world_size; i++) { received_strings = true; while (received_strings) { received_strings = false; // cout << " Checking from " << i << endl; MPI_Status mpistatus; MPI_Probe(i, 0, MPI_COMM_WORLD, &mpistatus); int count; MPI_Get_count(&mpistatus, MPI_CHAR, &count); char buf[count]; MPI_Recv(&buf, count, MPI_CHAR, i, 0, MPI_COMM_WORLD, &mpistatus); std::vector<char> buf(count); MPI_Recv(buf.data(), count, MPI_CHAR, i, 0, MPI_COMM_WORLD, &mpistatus); if (count == 0) { continue; } // cout << " Receiving from " << i << " ---- " << buf << endl; string s = buf; std::string s(buf.begin(), buf.end()); dirs.push(s); received_strings = true; } } // cout << "NO more paths " << dirs.size() << endl; } while (!dirs.empty()); auto count = 0; MPI_Bcast(&count, 1, MPI_INT, 0, MPI_COMM_WORLD); Loading examples/gfind/sfind.cpp +14 −6 Original line number Diff line number Diff line Loading @@ -209,6 +209,14 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help){ } argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-M") == 0) { res->mountdir = strdup(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-S") == 0) { res->num_servers = atoi(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if (!firstarg) { firstarg = strdup(argv[i]); argv[i][0] = 0; Loading Loading @@ -263,12 +271,12 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help){ case 's': res->stonewall_timer = atol(optarg); break; case 'S': res->num_servers = atoi(optarg); break; case 'M': res->mountdir = strdup(optarg); break; // case 'S': // res->num_servers = atoi(optarg); // break; // case 'M': // res->mountdir = strdup(optarg); // break; case 'v': res->verbosity++; break; Loading Loading
examples/gfind/gfind.cpp +47 −38 Original line number Diff line number Diff line Loading @@ -200,6 +200,14 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help, } argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-M") == 0) { res->mountdir = strdup(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-S") == 0) { res->num_servers = atoi(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if (!firstarg) { firstarg = strdup(argv[i]); argv[i][0] = 0; Loading Loading @@ -254,12 +262,12 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help, case 's': res->stonewall_timer = atol(optarg); break; case 'S': res->num_servers = atoi(optarg); break; case 'M': res->mountdir = strdup(optarg); break; // case 'S': // res->num_servers = atoi(optarg); // break; // case 'M': // res->mountdir = strdup(optarg); // break; case 'v': res->verbosity++; break; Loading Loading @@ -303,9 +311,9 @@ string recv_newPath() { MPI_Bcast(&count, 1, MPI_INT, 0, MPI_COMM_WORLD); if (count == 0) return "Terminate"; char buf[count]; MPI_Bcast(buf, count, MPI_CHAR, 0, MPI_COMM_WORLD); return buf; std::vector<char> buf(count); MPI_Bcast(buf.data(), count, MPI_CHAR, 0, MPI_COMM_WORLD); return std::string(buf.begin(), buf.end()); } /* Client Processing a path. Loading @@ -331,7 +339,7 @@ void dirProcess(const string path, unsigned long long &checked, servers_per_node++; for (int it = 0; it < servers_per_node; it++) { auto server = (world_rank - 1) * servers_per_node + it; if (server >= opt->num_servers) if (server >= (unsigned int) opt->num_servers) break; unsigned long long total_size = 0; Loading @@ -340,7 +348,7 @@ void dirProcess(const string path, unsigned long long &checked, (sizeof(struct dirent_extended) + 255) * 1024 * 100, server); struct dirent_extended *temp = getdir; while (total_size < n) { while (total_size < (unsigned long long) n) { if (strlen(temp->d_name) == 0) break; total_size += temp->d_reclen; Loading Loading @@ -401,36 +409,37 @@ int process(char *processor_name, int world_rank, int world_size, dirs.push(workdir); do { string processpath = dirs.front(); std::string processpath = dirs.front(); dirs.pop(); // DISTRIBUTE WORK send_newPath(processpath); auto received_strings = true; // We need to gather new directories found (we use send-recv) for (auto i = 1; i < world_size; i++) { received_strings = true; while (received_strings) { received_strings = false; // cout << " Checking from " << i << endl; MPI_Status mpistatus; MPI_Probe(i, 0, MPI_COMM_WORLD, &mpistatus); int count; MPI_Get_count(&mpistatus, MPI_CHAR, &count); char buf[count]; MPI_Recv(&buf, count, MPI_CHAR, i, 0, MPI_COMM_WORLD, &mpistatus); std::vector<char> buf(count); MPI_Recv(buf.data(), count, MPI_CHAR, i, 0, MPI_COMM_WORLD, &mpistatus); if (count == 0) { continue; } // cout << " Receiving from " << i << " ---- " << buf << endl; string s = buf; std::string s(buf.begin(), buf.end()); dirs.push(s); received_strings = true; } } // cout << "NO more paths " << dirs.size() << endl; } while (!dirs.empty()); auto count = 0; MPI_Bcast(&count, 1, MPI_INT, 0, MPI_COMM_WORLD); Loading
examples/gfind/sfind.cpp +14 −6 Original line number Diff line number Diff line Loading @@ -209,6 +209,14 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help){ } argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-M") == 0) { res->mountdir = strdup(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if(strcmp(argv[i], "-S") == 0) { res->num_servers = atoi(argv[i + 1]); argv[i][0] = 0; argv[++i][0] = 0; } else if (!firstarg) { firstarg = strdup(argv[i]); argv[i][0] = 0; Loading Loading @@ -263,12 +271,12 @@ pfind_options_t *pfind_parse_args(int argc, char **argv, int force_print_help){ case 's': res->stonewall_timer = atol(optarg); break; case 'S': res->num_servers = atoi(optarg); break; case 'M': res->mountdir = strdup(optarg); break; // case 'S': // res->num_servers = atoi(optarg); // break; // case 'M': // res->mountdir = strdup(optarg); // break; case 'v': res->verbosity++; break; Loading