Skip to content

Commit

Permalink
Use less memory for sub-sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Nov 30, 2023
1 parent f453f73 commit 015c9e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
vertex_readers.push_back(readers[i].vertexfile);
rewind(readers[i].vertexfile);
}
fqsort(vertex_readers, sizeof(vertex), vertexcmp, vertex_out, memsize / 10, 0);
fqsort(vertex_readers, sizeof(vertex), vertexcmp, vertex_out, memsize / 20, 0);

for (size_t i = 0; i < CPUS; i++) {
if (fclose(readers[i].vertexfile) != 0) {
Expand Down Expand Up @@ -2107,7 +2107,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
rewind(readers[i].nodefile);
}

fqsort(node_readers, sizeof(node), nodecmp, node_out, memsize / 10, 0);
fqsort(node_readers, sizeof(node), nodecmp, node_out, memsize / 20, 0);

for (size_t i = 0; i < CPUS; i++) {
if (fclose(readers[i].nodefile) != 0) {
Expand Down
1 change: 1 addition & 0 deletions sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void fqsort(std::vector<FILE *> &inputs, size_t width, int (*cmp)(const void *,
std::string pivot;
FILE *fp1, *fp2;
size_t first = 0, second = 0;
fprintf(stderr, "using maximum of %zu bytes of memory for sort\n", mem);

{
// read some elements into memory to choose a pivot from
Expand Down

0 comments on commit 015c9e4

Please sign in to comment.