forked from pradsubedi/dspaces
-
Notifications
You must be signed in to change notification settings - Fork 3
Feat/file #54
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
Open
bozhang-hpc
wants to merge
28
commits into
sci-ndp:master
Choose a base branch
from
bozhang-hpc:feat/file
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/file #54
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ecbd7a1
add hdf5 backend for data swap
bozhang-hpc fd4e8fa
add swap policy and swap logic to put() & get()
bozhang-hpc a151dd9
fix comments
bozhang-hpc f05bf48
add toml default for swap space; add simple file debug logic
bozhang-hpc 2ae4152
Merge branch 'master' into feat/file
bozhang-hpc 3e3c3a5
fix conf header
bozhang-hpc 90ac132
add swap config
bozhang-hpc e66c849
add directory operations
bozhang-hpc 21cc604
change default swap dir path
bozhang-hpc 44295a2
fix creating hdf5 files in a non-existing directory; fix no dataset w…
bozhang-hpc 33aeacd
fix write_od arguments; add rm swap dir at server finalization
bozhang-hpc 002675b
fix bbox init in read_od; fix hdf5 dataset name
bozhang-hpc 8f2312b
fix dspaces DATATYPE translation in get()
bozhang-hpc 3921641
add error info for empty swap list; rm hdf5 debug codes
bozhang-hpc 26cb0c6
move all the bbox functions for swap to bbox.h & bbox.c
bozhang-hpc ca59ef7
fix the curl find_package(); conditionally required HDF5 & NetCDF; ad…
bozhang-hpc 68dac37
conditionally enable file swap & HDF5
bozhang-hpc af34945
refactor the swap conf settings
bozhang-hpc 6748f5a
add an abstraction for file swap backend; conditionally include file …
bozhang-hpc 3a959c8
switch memory value type to an enum
bozhang-hpc e79e1b2
fix the potential fatal exit(); use uint64_t for memory values
bozhang-hpc ed4e692
add a default file backend setting into the swap_conf and adpat all o…
bozhang-hpc d84a86e
remove swap dir cleanup
bozhang-hpc 407a6b9
fix conditional compilation for od swap in put()/get(); make the file…
bozhang-hpc e72bc53
fix od allocation when there is no file backend
bozhang-hpc caf0eee
more fix on conditional compilation
bozhang-hpc ab2df4a
add set_default_swap() to non toml conf setup
bozhang-hpc d8a8703
fix the declaration order
bozhang-hpc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| # Copied from VTK's FindNetCDF.cmake | ||
|
|
||
| #[==[ | ||
| Provides the following variables: | ||
|
|
||
| * `NetCDF_FOUND`: Whether NetCDF was found or not. | ||
| * `NetCDF_INCLUDE_DIRS`: Include directories necessary to use NetCDF. | ||
| * `NetCDF_LIBRARIES`: Libraries necessary to use NetCDF. | ||
| * `NetCDF_VERSION`: The version of NetCDF found. | ||
| * `NetCDF::NetCDF`: A target to use with `target_link_libraries`. | ||
| * `NetCDF_HAS_PARALLEL`: Whether or not NetCDF was found with parallel IO support. | ||
| #]==] | ||
|
|
||
| function(FindNetCDF_get_is_parallel_aware include_dir) | ||
| file(STRINGS "${include_dir}/netcdf_meta.h" _netcdf_lines | ||
| REGEX "#define[ \t]+NC_HAS_PARALLEL[ \t]") | ||
| string(REGEX REPLACE ".*NC_HAS_PARALLEL[ \t]*([0-1]+).*" "\\1" _netcdf_has_parallel "${_netcdf_lines}") | ||
| if (_netcdf_has_parallel) | ||
| set(NetCDF_HAS_PARALLEL TRUE PARENT_SCOPE) | ||
| else() | ||
| set(NetCDF_HAS_PARALLEL FALSE PARENT_SCOPE) | ||
| endif() | ||
| endfunction() | ||
|
|
||
| # Try to find a CMake-built NetCDF. | ||
| find_package(netCDF CONFIG QUIET) | ||
| if (netCDF_FOUND) | ||
| # Forward the variables in a consistent way. | ||
| set(NetCDF_FOUND "${netCDF_FOUND}") | ||
| set(NetCDF_INCLUDE_DIRS "${netCDF_INCLUDE_DIR}") | ||
| set(NetCDF_LIBRARIES "${netCDF_LIBRARIES}") | ||
| set(NetCDF_VERSION "${NetCDFVersion}") | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(NetCDF | ||
| REQUIRED_VARS NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES | ||
| VERSION_VAR NetCDF_VERSION) | ||
|
|
||
| if (NOT TARGET NetCDF::NetCDF) | ||
| add_library(NetCDF::NetCDF INTERFACE IMPORTED) | ||
| if (TARGET "netCDF::netcdf") | ||
| # 4.7.3 | ||
| set_target_properties(NetCDF::NetCDF PROPERTIES | ||
| INTERFACE_LINK_LIBRARIES "netCDF::netcdf") | ||
| elseif (TARGET "netcdf") | ||
| set_target_properties(NetCDF::NetCDF PROPERTIES | ||
| INTERFACE_LINK_LIBRARIES "netcdf") | ||
| else () | ||
| set_target_properties(NetCDF::NetCDF PROPERTIES | ||
| INTERFACE_LINK_LIBRARIES "${netCDF_LIBRARIES}") | ||
| endif () | ||
| endif () | ||
|
|
||
| FindNetCDF_get_is_parallel_aware("${NetCDF_INCLUDE_DIRS}") | ||
| # Skip the rest of the logic in this file. | ||
| return () | ||
| endif () | ||
|
|
||
| find_package(PkgConfig QUIET) | ||
| if (PkgConfig_FOUND) | ||
| pkg_check_modules(_NetCDF QUIET netcdf IMPORTED_TARGET) | ||
| if (_NetCDF_FOUND) | ||
| # Forward the variables in a consistent way. | ||
| set(NetCDF_FOUND "${_NetCDF_FOUND}") | ||
| set(NetCDF_INCLUDE_DIRS "${_NetCDF_INCLUDE_DIRS}") | ||
| set(NetCDF_LIBRARIES "${_NetCDF_LIBRARIES}") | ||
| set(NetCDF_VERSION "${_NetCDF_VERSION}") | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(NetCDF | ||
| REQUIRED_VARS NetCDF_LIBRARIES | ||
| # This is not required because system-default include paths are not | ||
| # reported by `FindPkgConfig`, so this might be empty. Assume that if we | ||
| # have a library, the include directories are fine (if any) since | ||
| # PkgConfig reported that the package was found. | ||
| # NetCDF_INCLUDE_DIRS | ||
| VERSION_VAR NetCDF_VERSION) | ||
|
|
||
| if (NOT TARGET NetCDF::NetCDF) | ||
| add_library(NetCDF::NetCDF INTERFACE IMPORTED) | ||
| set_target_properties(NetCDF::NetCDF PROPERTIES | ||
| INTERFACE_LINK_LIBRARIES "PkgConfig::_NetCDF") | ||
| endif () | ||
|
|
||
| FindNetCDF_get_is_parallel_aware("${_NetCDF_INCLUDEDIR}") | ||
| # Skip the rest of the logic in this file. | ||
| return () | ||
| endif () | ||
| endif () | ||
|
|
||
| find_path(NetCDF_INCLUDE_DIR | ||
| NAMES netcdf.h | ||
| DOC "netcdf include directories") | ||
| mark_as_advanced(NetCDF_INCLUDE_DIR) | ||
|
|
||
| find_library(NetCDF_LIBRARY | ||
| NAMES netcdf | ||
| DOC "netcdf library") | ||
| mark_as_advanced(NetCDF_LIBRARY) | ||
|
|
||
| if (NetCDF_INCLUDE_DIR) | ||
| file(STRINGS "${NetCDF_INCLUDE_DIR}/netcdf_meta.h" _netcdf_version_lines | ||
| REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)") | ||
| string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*" "\\1" _netcdf_version_major "${_netcdf_version_lines}") | ||
| string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*" "\\1" _netcdf_version_minor "${_netcdf_version_lines}") | ||
| string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*" "\\1" _netcdf_version_patch "${_netcdf_version_lines}") | ||
| string(REGEX REPLACE ".*NC_VERSION_NOTE *\"\([^\"]*\)\".*" "\\1" _netcdf_version_note "${_netcdf_version_lines}") | ||
| set(NetCDF_VERSION "${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}") | ||
| unset(_netcdf_version_major) | ||
| unset(_netcdf_version_minor) | ||
| unset(_netcdf_version_patch) | ||
| unset(_netcdf_version_note) | ||
| unset(_netcdf_version_lines) | ||
|
|
||
| FindNetCDF_get_is_parallel_aware("${NetCDF_INCLUDE_DIR}") | ||
| endif () | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(NetCDF | ||
| REQUIRED_VARS NetCDF_LIBRARY NetCDF_INCLUDE_DIR | ||
| VERSION_VAR NetCDF_VERSION) | ||
|
|
||
| if (NetCDF_FOUND) | ||
| set(NetCDF_INCLUDE_DIRS "${NetCDF_INCLUDE_DIR}") | ||
| set(NetCDF_LIBRARIES "${NetCDF_LIBRARY}") | ||
|
|
||
| if (NOT TARGET NetCDF::NetCDF) | ||
| add_library(NetCDF::NetCDF UNKNOWN IMPORTED) | ||
| set_target_properties(NetCDF::NetCDF PROPERTIES | ||
| IMPORTED_LOCATION "${NetCDF_LIBRARY}" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_INCLUDE_DIR}") | ||
| endif () | ||
| endif () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #ifndef __DSPACES_FILE_STORAGE_H__ | ||
| #define __DSPACES_FILE_STORAGE_H__ | ||
|
|
||
| #include "ss_data.h" | ||
| #include "file_storage/policy.h" | ||
|
|
||
| int file_write_od(struct swap_config* swap_conf, struct obj_data *od); | ||
| int file_read_od(struct swap_config* swap_conf, struct obj_data *od); | ||
|
|
||
| #endif // __DSPACES_FILE_STORAGE_H__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #ifndef __DSPACES_FILE_STORAGE_HDF5_H__ | ||
| #define __DSPACES_FILE_STORAGE_HDF5_H__ | ||
|
|
||
| #include "ss_data.h" | ||
| #include "file_storage/policy.h" | ||
|
|
||
| int hdf5_write_od(struct swap_config* swap_conf, struct obj_data *od); | ||
| int hdf5_read_od(struct swap_config* swap_conf, struct obj_data *od); | ||
|
|
||
| #endif // __DSPACES_FILE_STORAGE_HDF5_H__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #ifndef __DSPACES_FILE_STORAGE_POLICY_H__ | ||
| #define __DSPACES_FILE_STORAGE_POLICY_H__ | ||
|
|
||
| #include "stdint.h" | ||
|
|
||
|
|
||
| #include "ss_data.h" | ||
|
|
||
| /* Server swap space configuration parameters */ | ||
| typedef enum mem_value_type {DS_MEM_BYTES, DS_MEM_PERCENT} ds_mem_val_t; | ||
|
|
||
| typedef enum file_type { | ||
| #ifdef DSPACES_HAVE_HDF5 | ||
| DS_FILE_HDF5, | ||
| #endif | ||
| #ifdef DSPACES_HAVE_NetCDF | ||
| DS_FILE_NetCDF | ||
| #endif | ||
| } ds_file_t; | ||
|
|
||
| struct swap_config | ||
| { | ||
| char *file_dir; | ||
| ds_mem_val_t mem_quota_type; | ||
| ds_file_t file_backend; | ||
| char *policy; | ||
| float disk_quota_MB; | ||
| union { | ||
| float MB; | ||
| float percent; | ||
| } mem_quota; | ||
| }; | ||
|
|
||
| void free_ls_od_list(struct list_head* ls_od_list); | ||
|
|
||
| void memory_quota_parser(char* str, struct swap_config* swap); | ||
| void disk_quota_parser(char* str, struct swap_config* swap); | ||
|
|
||
| int policy_str_check(const char*str); | ||
|
|
||
| int need_swap_out(struct swap_config *swap, uint64_t size_MB); | ||
|
|
||
| struct obj_data* which_swap_out(struct swap_config* swap, struct list_head* ls_od_list); | ||
|
|
||
| #endif // __DSPACES_FILE_STORAGE_POLICY_H__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.