diff --git a/CMakeLists.txt b/CMakeLists.txt index dc54a23..47d7c4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,8 +99,8 @@ set(SOURCES gemma/vit.h gemma/weights.cc gemma/weights.h - io/blob_finder.cc - io/blob_finder.h + io/blob_store.cc + io/blob_store.h io/fields.cc io/fields.h io/io_win.cc @@ -225,7 +225,7 @@ set(GEMMA_TEST_FILES gemma/gemma_args_test.cc gemma/flash_attention_test.cc gemma/tensor_info_test.cc - io/blob_finder_test.cc + io/blob_store_test.cc io/fields_test.cc ops/bench_matmul.cc ops/dot_test.cc diff --git a/io/blob_finder.cc b/io/blob_store.cc similarity index 99% rename from io/blob_finder.cc rename to io/blob_store.cc index c0866b3..990d0d7 100644 --- a/io/blob_finder.cc +++ b/io/blob_store.cc @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "io/blob_finder.h" +#include "io/blob_store.h" #include #include @@ -412,8 +412,8 @@ class BlobStore { std::vector directory_; // two per blob, see `SetRange`. }; // BlobStore -BlobReader::BlobReader(const Path& blob_path) : blob_path_(blob_path) { - PROFILER_ZONE("Startup.BlobReader"); +BlobFinder::BlobFinder(const Path& blob_path) : blob_path_(blob_path) { + PROFILER_ZONE("Startup.BlobFinder"); file_ = OpenFileOrAbort(blob_path, "r"); file_bytes_ = file_->FileSize(); diff --git a/io/blob_finder.h b/io/blob_store.h similarity index 95% rename from io/blob_finder.h rename to io/blob_store.h index 0acb0ec..6f1548e 100644 --- a/io/blob_finder.h +++ b/io/blob_store.h @@ -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_FINDER_H_ -#define THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_ +#ifndef THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_ +#define THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_ // Reads/writes arrays of bytes from/to file. @@ -46,7 +46,7 @@ struct BlobRange { // Reads `BlobStore` header, converts keys to strings and creates a hash map for // faster lookups. -// TODO(janwas): rename to BlobFinder or similar. +// Finds and manages the location of data blobs within the store. // Thread-safe: it is safe to concurrently call all methods except `CloseFile`. class BlobFinder { public: @@ -136,4 +136,4 @@ class BlobWriter { } // namespace gcpp -#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_ +#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_ \ No newline at end of file diff --git a/io/blob_finder_test.cc b/io/blob_store_test.cc similarity index 96% rename from io/blob_finder_test.cc rename to io/blob_store_test.cc index dd27d38..3d7783b 100644 --- a/io/blob_finder_test.cc +++ b/io/blob_store_test.cc @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "io/blob_finder.h" +#include "io/blob_store.h" #include @@ -32,10 +32,11 @@ namespace gcpp { namespace { #if !HWY_TEST_STANDALONE -class BlobFinderTest : public testing::Test {}; +class BlobStoreTest : public testing::Test {}; #endif -TEST(BlobFinderTest, TestReadWrite) { +// Change the first argument from BlobFinderTest to BlobStoreTest +TEST(BlobStoreTest, TestReadWrite) { ThreadingArgs threading_args; ThreadingContext ctx(threading_args); @@ -92,7 +93,7 @@ TEST(BlobFinderTest, TestReadWrite) { } // Ensures padding works for any number of random-sized blobs. -TEST(BlobFinderTest, TestNumBlobs) { +TEST(BlobStoreTest, TestNumBlobs) { ThreadingArgs threading_args; ThreadingContext ctx(threading_args); hwy::RandomState rng;