Skip to content

Commit 22f2691

Browse files
committed
io_comparison on remote machine
1 parent 952276b commit 22f2691

File tree

6 files changed

+109
-9
lines changed

6 files changed

+109
-9
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ SRCS := sequential.cpp \
2929
openmp.cpp \
3030
fastflow.cpp \
3131
io_comparison.cpp \
32+
sequential_onlymmap.cpp \
33+
sequential_nommap.cpp \
3234
# mpi_omp.cpp \
3335
# mpi_ff.cpp
3436

io_comparison.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ static std::string generate_unsorted_file_streaming(std::size_t total_n,
3737
std::exit(1);
3838
}
3939

40-
// I/O buffer (1 MiB), flush when >= 512 KiB
41-
constexpr std::size_t IO_BUF_SZ = 1 << 20;
42-
constexpr std::size_t FLUSH_THRESH = 512 << 10; // 512 KiB
40+
// I/O buffer (1 GiB), flush when >= 512 MiB
41+
constexpr std::size_t IO_BUF_SZ = 1 << 30;
42+
constexpr std::size_t FLUSH_THRESH = 512 << 20; // 512 MiB
4343
std::vector<char> io_buf;
4444
io_buf.reserve(IO_BUF_SZ);
4545

@@ -201,7 +201,7 @@ static std::string generate_unsorted_file_setvbuf(std::size_t total_n,
201201

202202
// 5) tune the stdio buffer to 512 KiB
203203
std::vector<char> io_buf(512 << 10);
204-
if (std::setvbuf(f, nullptr, _IOFBF, 512 << 10) != 0) {
204+
if (std::setvbuf(f, nullptr, _IOFBF, stats.st_blksize) != 0) {
205205
std::perror("setvbuf");
206206
std::fclose(f);
207207
std::exit(1);

logs/output_comparison.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Generated “files/a_unsorted_10000000_256.bin”.
2+
[stream_write ] 33634.798 ms
3+
Streaming-generating 10000000 records into “files/b_unsorted_10000000_256.bin”…
4+
Unsorted file ready: “files/b_unsorted_10000000_256.bin”.
5+
[stdio_fwrite ] 27382.517 ms
6+
BUFSIZ is 8192, but optimal block size is 1048576
7+
Streaming-generating 10000000 records into "files/c_unsorted_10000000_256.bin"…
8+
Unsorted file ready: "files/c_unsorted_10000000_256.bin".
9+
[setvbuf_fwrite ] 21690.073 ms
10+
[generate_arrays ] 405.065 ms
11+
[open_fallocate ] 25.671 ms
12+
[mmap ] 0.026 ms
13+
[generate_records ] 14824.201 ms
14+
[teardown ] 27418.757 ms
15+
Generated “files/d_unsorted_10000000_256.bin” (1440222028 bytes).
16+
[mmap_fallocate ] 42674.708 ms
17+
Streaming-generating 10000000 records into "files/e_unsorted_10000000_256.bin" with O_DIRECT…
18+
Unsorted file ready: "files/e_unsorted_10000000_256.bin".
19+
[odirect_write ] 89396.495 ms
20+
21+
Generated “files/a_unsorted_10000000_256.bin”.
22+
[stream_write ] 108758.485 ms
23+
Streaming-generating 10000000 records into “files/b_unsorted_10000000_256.bin”…
24+
Unsorted file ready: “files/b_unsorted_10000000_256.bin”.
25+
[stdio_fwrite ] 20413.666 ms
26+
BUFSIZ is 8192, but optimal block size is 1048576
27+
Streaming-generating 10000000 records into "files/c_unsorted_10000000_256.bin"…
28+
Unsorted file ready: "files/c_unsorted_10000000_256.bin".
29+
[setvbuf_fwrite ] 47973.324 ms
30+
[generate_arrays ] 407.878 ms
31+
[open_fallocate ] 148.006 ms
32+
[mmap ] 0.040 ms
33+
[generate_records ] 14975.573 ms
34+
[teardown ] 15495.449 ms
35+
Generated “files/d_unsorted_10000000_256.bin” (1440222028 bytes).
36+
[mmap_fallocate ] 31027.866 ms
37+
Streaming-generating 10000000 records into "files/e_unsorted_10000000_256.bin" with O_DIRECT…
38+
Unsorted file ready: "files/e_unsorted_10000000_256.bin".
39+
[odirect_write ] 39236.698 ms
40+
41+
Generated “files/a_unsorted_10000000_256.bin”.
42+
[stream_write ] 48583.323 ms
43+
Streaming-generating 10000000 records into “files/b_unsorted_10000000_256.bin”…
44+
Unsorted file ready: “files/b_unsorted_10000000_256.bin”.
45+
[stdio_fwrite ] 105960.016 ms
46+
BUFSIZ is 8192, but optimal block size is 1048576
47+
Streaming-generating 10000000 records into "files/c_unsorted_10000000_256.bin"…
48+
Unsorted file ready: "files/c_unsorted_10000000_256.bin".
49+
[setvbuf_fwrite ] 39650.644 ms
50+
[generate_arrays ] 405.603 ms
51+
[open_fallocate ] 2.253 ms
52+
[mmap ] 0.025 ms
53+
[generate_records ] 14830.265 ms
54+
[teardown ] 6506.072 ms
55+
Generated “files/d_unsorted_10000000_256.bin” (1440222028 bytes).
56+
[mmap_fallocate ] 21744.966 ms
57+
Streaming-generating 10000000 records into "files/e_unsorted_10000000_256.bin" with O_DIRECT…
58+
Unsorted file ready: "files/e_unsorted_10000000_256.bin".
59+
[odirect_write ] 42179.944 ms

logs/output_onlymmap.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
srun bin/sequential_onlymmap -n 100000000 -p 8
2+
[generate_arrays ] 4018.134 ms
3+
[open_truncate ] 81.273 ms
4+
[mmap ] 0.026 ms
5+
[generate_records ] 11999.642 ms
6+
[teardown ] 185260.842 ms
7+
Generated “files/unsorted_100000000_8.bin” (2000000000 bytes).
8+
[generate_unsorted_file] 201364.572 ms
9+
[build_index ] 1068.235 ms
10+
[sort_records ] 12470.667 ms
11+
[open_and_mmap_output] 25.092 ms
12+
[rewrite_sorted ] 30734.122 ms
13+
Verifying output…
14+
File is sorted.
15+
[check_if_sorted_mmap] 476.212 ms
16+

sequential.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static std::string generate_unsorted_file_streaming(std::size_t total_n,
2525
namespace fs = std::filesystem;
2626
fs::create_directories("files");
2727

28-
std::string path = "files/a_unsorted_"
28+
std::string path = "files/unsorted_"
2929
+ std::to_string(total_n) + "_"
3030
+ std::to_string(payload_max) + ".bin";
3131

@@ -41,9 +41,9 @@ static std::string generate_unsorted_file_streaming(std::size_t total_n,
4141
std::exit(1);
4242
}
4343

44-
// I/O buffer (1 MiB), flush when >= 512 KiB
45-
constexpr std::size_t IO_BUF_SZ = 1 << 20;
46-
constexpr std::size_t FLUSH_THRESH = 512 << 10; // 512 KiB
44+
// I/O buffer (1 GiB), flush when >= 512 MiB
45+
constexpr std::size_t IO_BUF_SZ = 1 << 30;
46+
constexpr std::size_t FLUSH_THRESH = 512 << 20; // 512 MiB
4747
std::vector<char> io_buf;
4848
io_buf.reserve(IO_BUF_SZ);
4949

todo.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,27 @@ Fastflow
1717
- would remove global variable but would reuire to change the merge_record()
1818

1919

20-
Devo cancellare i file ordinati dopo il controllo?
20+
Devo cancellare i file ordinati dopo il controllo?
21+
22+
23+
----
24+
25+
Option bottom-upp (per svrapporre generazione index e ordinamento):
26+
27+
base-case = 10'000
28+
29+
1. leggo il file
30+
31+
2. Ogni struct letta controllo:
32+
33+
(Sono degli if all'interno di un for, NON uno switch!)
34+
35+
- Se la struct è la numero 2^0 * base case: Ordino gli ultimi base-case con sort()
36+
37+
- Se la struct è la numero 2^1 * base case: Mergio gli ultimi 2 array di dim. 2^0 * base-case
38+
39+
- Se la struct è la numero 2^2 * base case: Mergio glu ultimi 2 array di dim. 2^1 * base case
40+
41+
- ...
42+
43+
Caso in cui la struct letta è l'ultima?

0 commit comments

Comments
 (0)