From b41f5c6d75dc3b6e1b7c724d43aadf51ecff2f71 Mon Sep 17 00:00:00 2001 From: Bogdan Nicolae <bnicolae@anl.gov> Date: Wed, 31 Jan 2024 15:44:45 -0600 Subject: [PATCH] flushAll() returns result and can be called multiple times --- GenericIO.h | 8 +++++++- README.md | 7 ++++--- thirdparty/veloc/FileIOVELOC.cxx | 7 +++++-- thirdparty/veloc/FileIOVELOC.hpp | 3 ++- veloc.cfg | 3 --- 5 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 veloc.cfg diff --git a/GenericIO.h b/GenericIO.h index 6c2c817..6e435ff 100644 --- a/GenericIO.h +++ b/GenericIO.h @@ -461,7 +461,13 @@ public: static void setNaturalDefaultPartition(); - static void flushAll() { + static bool flushAll() { +#ifdef GENERICIO_WITH_VELOC + return GenericFileIO_VELOC::flush(); +#endif + } + + static void shutdown() { #ifdef GENERICIO_WITH_VELOC GenericFileIO_VELOC::flush(); #endif diff --git a/README.md b/README.md index f585b05..9641838 100644 --- a/README.md +++ b/README.md @@ -115,10 +115,11 @@ Instructions can be found here: [https://veloc.readthedocs.io](https://veloc.rea **Install** -Set the VELOC_INSTALL_DIR variable in GNUMakefile to the root of the VELOC installation directory. +Set the VELOC_INSTALL_DIR variable in GNUMakefile to the root of the VELOC installation directory. Then proceed to compile and link GIO as usual. **Run** -Define the GENERICIO_USE_VELOC environment variable as the path to the VELOC configuration file. -An example is available here: veloc.cfg +Define the GENERICIO_USE_VELOC environment variable as the path to the scratch directory. +The scratch directory will be used as a local cache and needs to be a NVMe mount point on the compute node. +Define the VELOC_MAX_CACHE_SIZE environment variable as the maximum size (in bytes) of unflushed data allowed in the scratch folder. diff --git a/thirdparty/veloc/FileIOVELOC.cxx b/thirdparty/veloc/FileIOVELOC.cxx index e0114c3..8f7ecf1 100644 --- a/thirdparty/veloc/FileIOVELOC.cxx +++ b/thirdparty/veloc/FileIOVELOC.cxx @@ -40,8 +40,11 @@ void GenericFileIO_VELOC::write(const void *buf, size_t count, off_t offset, con throw std::runtime_error("Unable to write " + D + " to file: " + FileName + ": " + strerror(errno)); } -void GenericFileIO_VELOC::flush() { - veloc::cached_file_t::flush(); +bool GenericFileIO_VELOC::flush() { + return veloc::cached_file_t::flush(); +} + +void GenericFileIO_VELOC::shutdown() { veloc::cached_file_t::shutdown(); } diff --git a/thirdparty/veloc/FileIOVELOC.hpp b/thirdparty/veloc/FileIOVELOC.hpp index 66b791d..e9187d5 100644 --- a/thirdparty/veloc/FileIOVELOC.hpp +++ b/thirdparty/veloc/FileIOVELOC.hpp @@ -15,7 +15,8 @@ public: void setSize(size_t sz); void read(void *buf, size_t count, off_t offset, const std::string &D); void write(const void *buf, size_t count, off_t offset, const std::string &D); - static void flush(); + static bool flush(); + static void shutdown(); protected: int FH; diff --git a/veloc.cfg b/veloc.cfg deleted file mode 100644 index cadd6f2..0000000 --- a/veloc.cfg +++ /dev/null @@ -1,3 +0,0 @@ -scratch = /tmp/scratch -persistent = /tmp/persistent -mode = async \ No newline at end of file -- GitLab