|
49 | 49 | ctoc = time.time() |
50 | 50 | tc = (ctoc - ctic) / NREP |
51 | 51 | print( |
52 | | - f" Time for tensorflow (tf.io.serialize):\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ", |
| 52 | + f" Time for tensorflow (tf.io.serialize):\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ", |
53 | 53 | end="", |
54 | 54 | ) |
55 | 55 | print(f"\tcr: {in_.size * in_.dtype.itemsize * 1.0 / len(c):5.1f}x") |
|
66 | 66 | ctoc = time.time() |
67 | 67 | tc = (ctoc - ctic) / NREP |
68 | 68 | print( |
69 | | - f" Time for torch (torch.save):\t\t\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ", |
| 69 | + f" Time for torch (torch.save):\t\t\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ", |
70 | 70 | end="", |
71 | 71 | ) |
72 | 72 | buff.seek(0) |
|
87 | 87 | ctoc = time.time() |
88 | 88 | tc = (ctoc - ctic) / NREP |
89 | 89 | print( |
90 | | - f" Time for tensorflow (blosc2.pack_tensor):\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ", |
| 90 | + f" Time for tensorflow (blosc2.pack_tensor):\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ", |
91 | 91 | end="", |
92 | 92 | ) |
93 | 93 | print(f"\tcr: {in_.size * in_.dtype.itemsize * 1.0 / len(c):5.1f}x") |
|
103 | 103 | ctoc = time.time() |
104 | 104 | tc = (ctoc - ctic) / NREP |
105 | 105 | print( |
106 | | - f" Time for torch (blosc2.pack_tensor):\t\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ", |
| 106 | + f" Time for torch (blosc2.pack_tensor):\t\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ", |
107 | 107 | end="", |
108 | 108 | ) |
109 | 109 | print(f"\tcr: {in_.size * in_.dtype.itemsize * 1.0 / len(c):5.1f}x") |
|
122 | 122 | dtoc = time.time() |
123 | 123 | td = (dtoc - dtic) / NREP |
124 | 124 | print( |
125 | | - f" Time for tensorflow (tf.io.parse_tensor):\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ", |
| 125 | + f" Time for tensorflow (tf.io.parse_tensor):\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ", |
126 | 126 | ) |
127 | 127 |
|
128 | 128 | with open("serialize_torch.bin", "rb") as f: |
|
136 | 136 | dtoc = time.time() |
137 | 137 | td = (dtoc - dtic) / NREP |
138 | 138 | print( |
139 | | - f" Time for torch (torch.load):\t\t\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ", |
| 139 | + f" Time for torch (torch.load):\t\t\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ", |
140 | 140 | ) |
141 | 141 |
|
142 | 142 | with open("pack_tensorflow.bl2", "rb") as f: |
|
149 | 149 | dtoc = time.time() |
150 | 150 | td = (dtoc - dtic) / NREP |
151 | 151 | print( |
152 | | - f" Time for tensorflow (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ", |
| 152 | + f" Time for tensorflow (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ", |
153 | 153 | ) |
154 | 154 | assert np.array_equal(in_, out) |
155 | 155 |
|
|
165 | 165 |
|
166 | 166 | td = (dtoc - dtic) / NREP |
167 | 167 | print( |
168 | | - f" Time for torch (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ", |
| 168 | + f" Time for torch (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ", |
169 | 169 | ) |
170 | 170 | assert np.array_equal(in_, out) |
0 commit comments