Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ set(SOURCES
gemma/vit.h
gemma/weights.cc
gemma/weights.h
io/blob_store.cc
io/blob_store.h
io/blob_finder.cc
io/blob_finder.h
io/fields.cc
io/fields.h
io/io_win.cc
Expand Down Expand Up @@ -223,7 +223,7 @@ set(GEMMA_TEST_FILES
evals/gemma_test.cc
gemma/flash_attention_test.cc
gemma/tensor_info_test.cc
io/blob_store_test.cc
io/blob_finder_test.cc
io/fields_test.cc
ops/bench_matmul.cc
ops/dot_test.cc
Expand Down
2 changes: 1 addition & 1 deletion io/blob_store.cc → io/blob_finder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "io/blob_store.h"
#include "io/blob_finder.h"

#include <stddef.h>
#include <stdint.h>
Expand Down
10 changes: 5 additions & 5 deletions io/blob_store.h → io/blob_finder.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_
#define THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_
#ifndef THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_
#define THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_

// Reads/writes arrays of bytes from/to file.

Expand Down Expand Up @@ -48,11 +48,11 @@ struct BlobRange {
// faster lookups.
// TODO(janwas): rename to BlobFinder or similar.
// Thread-safe: it is safe to concurrently call all methods except `CloseFile`.
class BlobReader {
class BlobFinder {
public:
// Acquires ownership of `file` (which must be non-null) and reads its header.
// Aborts on error.
explicit BlobReader(const Path& blob_path);
explicit BlobFinder(const Path& blob_path);

const Path& blob_path() const { return blob_path_; }

Expand Down Expand Up @@ -136,4 +136,4 @@ class BlobWriter {

} // namespace gcpp

#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_
#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_
12 changes: 6 additions & 6 deletions io/blob_store_test.cc → io/blob_finder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "io/blob_store.h"
#include "io/blob_finder.h"

#include <stdio.h>

Expand All @@ -32,10 +32,10 @@ namespace gcpp {
namespace {

#if !HWY_TEST_STANDALONE
class BlobStoreTest : public testing::Test {};
class BlobFinderTest : public testing::Test {};
#endif

TEST(BlobStoreTest, TestReadWrite) {
TEST(BlobFinderTest, TestReadWrite) {
ThreadingArgs threading_args;
ThreadingContext ctx(threading_args);

Expand All @@ -59,7 +59,7 @@ TEST(BlobStoreTest, TestReadWrite) {

std::fill(buffer.begin(), buffer.end(), 0);

const BlobReader reader(path);
const BlobFinder reader(path);

HWY_ASSERT_EQ(reader.Keys().size(), 2);
HWY_ASSERT_STRING_EQ(reader.Keys()[0].c_str(), keyA.c_str());
Expand Down Expand Up @@ -92,7 +92,7 @@ TEST(BlobStoreTest, TestReadWrite) {
}

// Ensures padding works for any number of random-sized blobs.
TEST(BlobStoreTest, TestNumBlobs) {
TEST(BlobFinderTest, TestNumBlobs) {
ThreadingArgs threading_args;
ThreadingContext ctx(threading_args);
hwy::RandomState rng;
Expand Down Expand Up @@ -126,7 +126,7 @@ TEST(BlobStoreTest, TestNumBlobs) {
HWY_ASSERT(blobs.size() == num_blobs);
writer.Finalize();

BlobReader reader(path);
BlobFinder reader(path);
HWY_ASSERT_EQ(reader.Keys().size(), num_blobs);

ParallelFor(
Expand Down