-
Notifications
You must be signed in to change notification settings - Fork 10
Added HDF5 compression to EmpCylSL disk cache files #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Changes from all commits
56a7559
87cb7c6
2d61ad0
7349fe3
02a96bc
a5eb863
fab96b8
e7f8f8b
020b521
e8fb1a5
ceb51ad
e0f6b65
c410a77
1d68525
251c1c0
e1625e5
2acf6bc
cf6f176
ed43344
c2ce07a
d822cfa
9b37116
3295b99
63e71d5
1072aa3
447734e
f8d281b
1afbfdc
a02348f
a6b232f
6b7271e
13f867e
ae5b00f
4a9fa02
a4f1c09
fa6ad6d
5712475
9bef58a
ecf706a
e2c0a88
71bf386
2cdc8a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,11 @@ | ||
|
|
||
| build/* | ||
|
|
||
| # Python cache files | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
|
|
||
| Makefile | ||
| *.lo | ||
| *.a | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| . |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -241,6 +241,17 @@ protected: | |
| //! Cache versioning | ||
| inline static const std::string Version = "1.0"; | ||
|
|
||
| //@{ | ||
| //! H5 compression | ||
The9Cat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /*! | ||
| * H5compress: Compression level for HDF5 cache. | ||
| * Valid range: 0-9 (0 = no compression, 9 = maximum compression) | ||
| */ | ||
| unsigned H5compress = 5; | ||
| bool H5shuffle = true; | ||
| bool H5szip = false; | ||
| //@} | ||
The9Cat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| //! The cache file name | ||
| std::string cachefile; | ||
| // 1=write, 0=read | ||
|
|
@@ -934,6 +945,36 @@ public: | |
| } | ||
| } | ||
|
|
||
| //! Set HDF5 compression parameters for cache files | ||
| //! @param compress Compression level for deflate/gzip (valid range: 0-9, where 0=no compression, 9=max compression) | ||
| //! @param shuffle Enable byte shuffle filter (default: true) | ||
| //! @param szip Enable szip compression (default: false) | ||
| //! @note Szip and deflate compression are mutually exclusive. When both are configured, deflate compression takes precedence and the szip parameter is ignored. | ||
| void setH5Params(unsigned compress, bool shuffle=true, bool szip=false) | ||
| { | ||
| // Validate compression level (unsigned type prevents negative values) | ||
| if (compress > 9) { | ||
| if (myid==0) { | ||
| std::cout << "EmpCylSL: compression level " << compress | ||
| << " out of range [0,9], using 9" << std::endl; | ||
| } | ||
| compress = 9; | ||
| } | ||
|
|
||
| // Warn if both szip and deflate compression are configured | ||
| if (szip && compress > 0) { | ||
| if (myid==0) { | ||
| std::cout << "EmpCylSL: szip and deflate compression are mutually exclusive. " | ||
| << "Using deflate; szip parameter will be ignored." << std::endl; | ||
| } | ||
| szip = false; // Disable szip when both are configured | ||
| } | ||
|
|
||
| H5compress = compress; | ||
| H5shuffle = shuffle; | ||
| H5szip = szip; | ||
| } | ||
|
Comment on lines
948
to
976
|
||
|
|
||
| vector<double> sanity() { | ||
| vector<double> ret; | ||
| for (int m=0; m<=MMAX; m++) ret.push_back(accum_cos[0][m]); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,7 +74,9 @@ Cylinder::valid_keys = { | |
| "coefCompute", | ||
| "coefMaster", | ||
| "pyname", | ||
| "dumpbasis" | ||
| "dumpbasis", | ||
| "compress", | ||
| "shuffle" | ||
| }; | ||
|
|
||
| Cylinder::Cylinder(Component* c0, const YAML::Node& conf, MixtureBasis *m) : | ||
|
|
@@ -184,6 +186,14 @@ Cylinder::Cylinder(Component* c0, const YAML::Node& conf, MixtureBasis *m) : | |
| if (EVEN_M) ortho->setEven(EVEN_M); | ||
| ortho->setSampT(defSampT); | ||
|
|
||
| // Set HDF5 compression parameters for cache files | ||
| if (conf["compress"]) { | ||
| unsigned compress = conf["compress"].as<unsigned>(); | ||
| bool shuffle = true; | ||
| if (conf["shuffle"]) shuffle = conf["shuffle"].as<bool>(); | ||
| ortho->setH5Params(compress, shuffle); | ||
| } | ||
|
Comment on lines
189
to
195
|
||
|
|
||
| try { | ||
| if (conf["tk_type"]) ortho->setTK(conf["tk_type"].as<std::string>()); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.