├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── build-and-test.yml ├── .gitignore ├── .gitlab-ci.yml ├── .gitlab ├── ascent.yml ├── lassen.yml └── quartz.yml ├── .readthedocs.yaml ├── .spack-env ├── unifyfs-lsf-gcc11_2_1 │ └── spack.yaml ├── unifyfs-lsf-gcc4_9_3 │ └── spack.yaml ├── unifyfs-lsf-gcc8_3_1 │ └── spack.yaml ├── unifyfs-slurm-gcc10_3_1 │ └── spack.yaml └── unifyfs-slurm-gcc12_1_1 │ └── spack.yaml ├── LICENSE ├── LICENSE.ANL ├── LICENSE.BURSTFS ├── LICENSE.CRUISE ├── Makefile.am ├── README.md ├── autogen.sh ├── bootstrap.sh ├── client ├── Makefile.am ├── check_fns │ ├── README.md │ ├── cstdio_list.txt │ ├── fakechroot_list.txt │ ├── gnulibc_list.txt │ ├── posix_list.txt │ ├── unifyfs_check_fns │ ├── unifyfs_list.txt │ ├── unifyfs_translate.py │ └── unifyfs_unsupported_list.txt ├── src │ ├── Makefile.am │ ├── client_api.c │ ├── client_read.c │ ├── client_read.h │ ├── client_transfer.c │ ├── client_transfer.h │ ├── gotcha_map_unifyfs_list.c │ ├── margo_client.c │ ├── margo_client.h │ ├── pmpi_wrappers.c │ ├── pmpi_wrappers.h │ ├── posix_client.c │ ├── posix_client.h │ ├── preload.c │ ├── unifyfs-dirops.c │ ├── unifyfs-dirops.h │ ├── unifyfs-internal.h │ ├── unifyfs-stdio.c │ ├── unifyfs-stdio.h │ ├── unifyfs-sysio.c │ ├── unifyfs-sysio.h │ ├── unifyfs.c │ ├── unifyfs.h │ ├── unifyfs_api.c │ ├── unifyfs_api.h │ ├── unifyfs_api_file.c │ ├── unifyfs_api_internal.h │ ├── unifyfs_api_io.c │ ├── unifyfs_api_transfer.c │ ├── unifyfs_fid.c │ ├── unifyfs_fid.h │ ├── unifyfs_wrap.h │ ├── unifyfsf.c │ ├── unifyfsf.h │ ├── uthash.h │ └── utlist.h ├── unifyfs-api.pc.in ├── unifyfs-config.in ├── unifyfs-static.pc.in └── unifyfs.pc.in ├── common └── src │ ├── LICENSE.inih │ ├── LICENSE.tedium │ ├── LICENSE.tinyexpr │ ├── LICENSE.tree_dot_h │ ├── Makefile.mk │ ├── arraylist.c │ ├── arraylist.h │ ├── compare_fn.c │ ├── compare_fn.h │ ├── ini.c │ ├── ini.h │ ├── rm_enumerator.c │ ├── rm_enumerator.h │ ├── seg_tree.c │ ├── seg_tree.h │ ├── slotmap.c │ ├── slotmap.h │ ├── tinyexpr.c │ ├── tinyexpr.h │ ├── tree.h │ ├── unifyfs-stack.c │ ├── unifyfs-stack.h │ ├── unifyfs_client.h │ ├── unifyfs_client_rpcs.h │ ├── unifyfs_configurator.c │ ├── unifyfs_configurator.h │ ├── unifyfs_const.h │ ├── unifyfs_keyval.c │ ├── unifyfs_keyval.h │ ├── unifyfs_log.c │ ├── unifyfs_log.h │ ├── unifyfs_logio.c │ ├── unifyfs_logio.h │ ├── unifyfs_meta.c │ ├── unifyfs_meta.h │ ├── unifyfs_misc.c │ ├── unifyfs_misc.h │ ├── unifyfs_rc.c │ ├── unifyfs_rc.h │ ├── unifyfs_rpc_types.h │ ├── unifyfs_rpc_util.c │ ├── unifyfs_rpc_util.h │ ├── unifyfs_server_rpcs.h │ ├── unifyfs_shm.c │ └── unifyfs_shm.h ├── configure.ac ├── docs ├── .gitignore ├── Makefile ├── _static │ └── theme_overrides.css ├── _themes │ └── sphinx_rtd_theme2 │ │ └── sphinx_rtd_theme │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── breadcrumbs.html │ │ ├── footer.html │ │ ├── layout.html │ │ ├── search.html │ │ ├── searchbox.html │ │ ├── static │ │ ├── css │ │ │ ├── badge_only.css │ │ │ └── theme.css │ │ ├── fonts │ │ │ ├── Inconsolata-Bold.ttf │ │ │ ├── Inconsolata-Regular.ttf │ │ │ ├── Lato-Bold.ttf │ │ │ ├── Lato-Regular.ttf │ │ │ ├── RobotoSlab-Bold.ttf │ │ │ ├── RobotoSlab-Regular.ttf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ │ └── js │ │ │ ├── modernizr.min.js │ │ │ └── theme.js │ │ ├── theme.conf │ │ └── versions.html ├── add-rpcs.rst ├── api.rst ├── assumptions.rst ├── build.rst ├── conf.py ├── configuration.rst ├── contribute-ways.rst ├── definitions.rst ├── dependencies.rst ├── examples.rst ├── images │ ├── UnifyFS-developers-documentation.png │ ├── UnifyFS-logo.png │ ├── UnifyFS-logo_sml.png │ ├── UnifyFS-tutorial-May2022.png │ ├── design-high-lvl.png │ └── tap-output.png ├── index.rst ├── library_api.rst ├── limitations.rst ├── link.rst ├── make.bat ├── overview.rst ├── requirements.in ├── requirements.txt ├── run.rst ├── slides │ ├── UnifyFS-developers-documentation.pdf │ └── UnifyFS-tutorial-May2022.pdf ├── style-guides.rst ├── testing.rst ├── verifyio.rst └── wrappers.rst ├── examples ├── Makefile.am ├── README.md └── src │ ├── Makefile.am │ ├── Makefile.examples.in │ ├── app-btio.c │ ├── app-hdf5-create.c │ ├── app-hdf5-writeread.c │ ├── app-mpiio.c │ ├── app-tileio.c │ ├── checkpoint-restart.c │ ├── chmod.c │ ├── multi-write.c │ ├── read-data.c │ ├── read.c │ ├── simul.c │ ├── size.c │ ├── testlib.h │ ├── testutil.c │ ├── testutil.h │ ├── testutil_rdwr.h │ ├── transfer.c │ ├── write-transfer.c │ ├── write.c │ ├── writeread.c │ └── writeread.f90 ├── extras ├── Makefile.am └── unifyfs.conf.in ├── m4 ├── ax_lib_hdf5.m4 ├── gotcha.m4 ├── inttypes-pri.m4 ├── leveldb.m4 ├── lx_find_mpi.m4 ├── margo.m4 ├── openssl.m4 └── spath.m4 ├── scripts ├── README.md ├── checkpatch.sh ├── git_log_test_env.sh ├── linux_kernel_checkpatch │ ├── checkpatch.pl │ ├── const_structs.checkpatch │ └── spelling.txt └── unifyfs.astyle ├── server ├── Makefile.am └── src │ ├── Makefile.am │ ├── extent_tree.c │ ├── extent_tree.h │ ├── margo_server.c │ ├── margo_server.h │ ├── unifyfs_client_rpc.c │ ├── unifyfs_fops.h │ ├── unifyfs_fops_rpc.c │ ├── unifyfs_global.h │ ├── unifyfs_group_rpc.c │ ├── unifyfs_group_rpc.h │ ├── unifyfs_inode.c │ ├── unifyfs_inode.h │ ├── unifyfs_inode_tree.c │ ├── unifyfs_inode_tree.h │ ├── unifyfs_p2p_rpc.c │ ├── unifyfs_p2p_rpc.h │ ├── unifyfs_request_manager.c │ ├── unifyfs_request_manager.h │ ├── unifyfs_server.c │ ├── unifyfs_server_pid.c │ ├── unifyfs_service_manager.c │ ├── unifyfs_service_manager.h │ ├── unifyfs_transfer.c │ ├── unifyfs_transfer.h │ ├── unifyfs_tree.c │ └── unifyfs_tree.h ├── t ├── 0001-setup.t ├── 0100-sysio-gotcha.t ├── 0110-statfs-gotcha.t ├── 0200-stdio-gotcha.t ├── 0500-sysio-static.t ├── 0510-statfs-static.t ├── 0600-stdio-static.t ├── 0700-unifyfs-stage-full.t ├── 8000-library-api.t ├── 9005-unifyfs-unmount.t ├── 9010-stop-unifyfsd.t ├── 9020-mountpoint-empty.t ├── 9200-seg-tree-test.t ├── 9201-slotmap-test.t ├── 9999-cleanup.t ├── Makefile.am ├── README.md ├── api │ ├── api_suite.c │ ├── api_suite.h │ ├── create-open-remove.c │ ├── gfid-metadata.c │ ├── init-fini.c │ ├── laminate.c │ ├── storage-reuse.c │ ├── transfer.c │ └── write-read-sync-stat.c ├── ci │ ├── 001-setup.sh │ ├── 002-start-server.sh │ ├── 100-writeread-tests.sh │ ├── 110-write-tests.sh │ ├── 120-read-tests.sh │ ├── 300-producer-consumer-tests.sh │ ├── 800-stage-tests.sh │ ├── 990-stop-server.sh │ ├── README.md │ ├── RUN_CI_STAGE_TESTS.sh │ ├── RUN_CI_TESTS.sh │ ├── ci-functions.sh │ ├── setup-lsf.sh │ └── setup-slurm.sh ├── common │ ├── seg_tree_test.c │ └── slotmap_test.c ├── lib │ ├── Makefile.am │ ├── tap.c │ ├── tap.h │ ├── testutil.c │ └── testutil.h ├── sharness.d │ ├── 00-test-env.sh │ ├── 01-unifyfs-settings.sh │ └── 02-functions.sh ├── sharness.sh ├── std │ ├── fflush.c │ ├── fopen-fclose.c │ ├── fseek-ftell.c │ ├── fwrite-fread.c │ ├── size.c │ ├── stdio_suite.c │ └── stdio_suite.h ├── sys │ ├── chdir.c │ ├── creat-close.c │ ├── creat64.c │ ├── lseek.c │ ├── mkdir-rmdir.c │ ├── open.c │ ├── open64.c │ ├── stat.c │ ├── statfs.c │ ├── statfs_suite.c │ ├── statfs_suite.h │ ├── sysio_suite.c │ ├── sysio_suite.h │ ├── truncate.c │ ├── unlink.c │ ├── write-read-hole.c │ └── write-read.c ├── tap-driver.sh └── unifyfs_unmount.c └── util ├── Makefile.am ├── scripts ├── Makefile.am └── lsfcsm │ ├── Makefile.am │ ├── README.md │ ├── unifyfs_lsfcsm_epilog.in │ └── unifyfs_lsfcsm_prolog.in ├── unifyfs-api-client ├── Makefile.am └── src │ ├── Makefile.am │ ├── unifyfs-laminate.c │ ├── unifyfs-ls.cpp │ └── unifyfs-remove.c ├── unifyfs-stage ├── Makefile.am └── src │ ├── Makefile.am │ ├── unifyfs-stage-transfer.c │ ├── unifyfs-stage.c │ └── unifyfs-stage.h └── unifyfs ├── Makefile.am └── src ├── Makefile.am ├── unifyfs-rm.c ├── unifyfs.c └── unifyfs.h /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | ### System information 12 | 13 | Type | Version/Name 14 | --- | --- 15 | Operating System | 16 | OS Version | 17 | Architecture | 18 | UnifyFS Version | 19 | 20 | ### Describe the problem you're observing 21 | 22 | ### Describe how to reproduce the problem 23 | 24 | ### Include any warning or errors or releveant debugging data 25 | 35 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Description 4 | 5 | 6 | ### Motivation and Context 7 | 8 | 9 | 10 | ### How Has This Been Tested? 11 | 12 | 13 | 14 | 15 | 16 | ### Types of changes 17 | 18 | - [ ] Bug fix (non-breaking change which fixes an issue) 19 | - [ ] New feature (non-breaking change which adds functionality) 20 | - [ ] Performance enhancement (non-breaking change which improves efficiency) 21 | - [ ] Code cleanup (non-breaking change which makes code smaller or more readable) 22 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 23 | - [ ] Testing (addition of new tests or update to current tests) 24 | - [ ] Documentation (a change to man pages or other documentation) 25 | 26 | ### Checklist: 27 | 28 | 29 | - [ ] My code follows the UnifyFS code style requirements. 30 | - [ ] I have updated the documentation accordingly. 31 | - [ ] I have read the **CONTRIBUTING** document. 32 | - [ ] I have added tests to cover my changes. 33 | - [ ] All new and existing tests passed. 34 | - [ ] All commit messages are properly formatted. 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | aclocal.m4 2 | autom4te.cache 3 | build 4 | config.* 5 | configure 6 | cscope.* 7 | tags 8 | depcomp 9 | INSTALL 10 | install-sh 11 | ltmain.sh 12 | Makefile 13 | Makefile.in 14 | missing 15 | stamp-h1 16 | stamp-h2 17 | test-driver 18 | *compile 19 | *.gcda 20 | *.gcno 21 | *.sw? 22 | *~ 23 | *.lo 24 | *.la 25 | *.o 26 | *.tar.gz 27 | *.rpm 28 | *.diff 29 | *.patch 30 | .libs 31 | .deps 32 | .nfs* 33 | 34 | # Softlinks to test and log 35 | log 36 | *.vol 37 | 38 | # editor 39 | *.swp 40 | 41 | # nfs files 42 | *.nfs0* 43 | 44 | # cmocka unit tests 45 | *.log 46 | *.trs 47 | *_unittest 48 | 49 | # project files 50 | server/src/unifyfsd 51 | util/unifyfs/src/unifyfs 52 | 53 | # generated package files 54 | client/unifyfs-config 55 | client/unifyfs.pc 56 | extras/unifyfs.conf 57 | libtool 58 | m4/libtool.m4 59 | m4/ltoptions.m4 60 | m4/ltsugar.m4 61 | m4/ltversion.m4 62 | m4/lt~obsolete.m4 63 | meta/src/Mlog2/.dirstamp 64 | t/sys/.dirstamp 65 | 66 | # test files 67 | client/unifyfs-runtime-config.h 68 | examples/src/*-gotcha 69 | examples/src/*-posix 70 | examples/src/*-static 71 | t/sys/open.t 72 | t/test-results/ 73 | t/unifyfs_unmount.t 74 | t/seg_tree_test.t 75 | t/test_run_env.sh 76 | deps 77 | install 78 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | formats: 9 | - pdf 10 | - epub 11 | 12 | # Set the version of Python and other tools you might need 13 | build: 14 | os: ubuntu-22.04 15 | tools: 16 | python: "3.12" 17 | jobs: 18 | post_checkout: 19 | # Cancel building pull requests when there aren't changed in the docs directory or YAML file. 20 | - | 21 | if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/dev -- docs/ .readthedocs.yaml; 22 | then 23 | exit 183; 24 | fi 25 | pre_install: 26 | # pip-compile was used to generate the requirements.txt file to enable 27 | # reproducible builds. 28 | # 29 | # If adding or updating top-level dependencies, update requirements.in and 30 | # then overwrite existing requirements.txt with results of `pip-compile`. 31 | # 32 | # If simply wanting to update transitive dependencies to pin a new 33 | # reproducible build, then overwrite existing requirements.txt with 34 | # results of `pip-compile`. 35 | # 36 | # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html#pin-your-transitive-dependencies 37 | - python -m pip install pip-tools 38 | - pip-compile --strip-extras -o docs/new_requirements.txt docs/requirements.in --upgrade 39 | 40 | # Build documentation in the docs/ directory with Sphinx 41 | sphinx: 42 | configuration: docs/conf.py 43 | fail_on_warning: true 44 | 45 | # We recommend specifying your dependencies to enable reproducible builds: 46 | # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 47 | python: 48 | install: 49 | # If needing to update for pinning a new reproducible build, then overwrite with 50 | # results of `pip-compile` command above. 51 | - requirements: docs/requirements.txt 52 | -------------------------------------------------------------------------------- /.spack-env/unifyfs-lsf-gcc11_2_1/spack.yaml: -------------------------------------------------------------------------------- 1 | spack: 2 | packages: 3 | all: 4 | compiler: [gcc@11.2.1] 5 | providers: 6 | mpi: [spectrum-mpi] 7 | target: [ppc64le] 8 | specs: 9 | - automake@1.15.1 10 | - gotcha@1.0.5 11 | - mochi-margo@0.13.1 ^mercury~boostsys ^libfabric fabrics=rxm,sockets,tcp 12 | - spath~mpi 13 | view: true 14 | concretizer: 15 | unify: true 16 | -------------------------------------------------------------------------------- /.spack-env/unifyfs-lsf-gcc4_9_3/spack.yaml: -------------------------------------------------------------------------------- 1 | spack: 2 | packages: 3 | all: 4 | compiler: [gcc@4.9.3] 5 | providers: 6 | mpi: [spectrum-mpi] 7 | target: [ppc64le] 8 | specs: 9 | - automake@1.15.1 10 | - gotcha@1.0.5 cflags="-std-gnu99" 11 | - mochi-margo@0.13.1 cflags="-std=gnu99" ^mercury~boostsys ^libfabric fabrics=rxm,sockets,tcp 12 | - spath~mpi 13 | view: true 14 | concretizer: 15 | unify: true 16 | -------------------------------------------------------------------------------- /.spack-env/unifyfs-lsf-gcc8_3_1/spack.yaml: -------------------------------------------------------------------------------- 1 | spack: 2 | packages: 3 | all: 4 | compiler: [gcc@8.3.1] 5 | providers: 6 | mpi: [spectrum-mpi] 7 | target: [ppc64le] 8 | specs: 9 | - automake@1.15.1 10 | - gotcha@1.0.5 11 | - mochi-margo@0.13.1 ^mercury~boostsys ^libfabric fabrics=rxm,sockets,tcp 12 | - spath~mpi 13 | view: true 14 | concretizer: 15 | unify: true 16 | -------------------------------------------------------------------------------- /.spack-env/unifyfs-slurm-gcc10_3_1/spack.yaml: -------------------------------------------------------------------------------- 1 | spack: 2 | packages: 3 | all: 4 | compiler: [gcc@10.3.1] 5 | providers: 6 | mpi: [mvapich2] 7 | target: [x86_64_v3] 8 | specs: 9 | - gotcha@1.0.5 10 | - mochi-margo@0.13.1 ^mercury~boostsys ^libfabric fabrics=rxm,sockets,tcp 11 | - spath~mpi 12 | view: true 13 | concretizer: 14 | unify: true 15 | -------------------------------------------------------------------------------- /.spack-env/unifyfs-slurm-gcc12_1_1/spack.yaml: -------------------------------------------------------------------------------- 1 | spack: 2 | packages: 3 | all: 4 | compiler: [gcc@12.1.1] 5 | providers: 6 | mpi: [mvapich2] 7 | target: [x86_64_v3] 8 | specs: 9 | - gotcha@1.0.5 10 | - mochi-margo@0.13.1 ^mercury~boostsys ^libfabric fabrics=rxm,sockets,tcp 11 | - spath~mpi 12 | view: true 13 | concretizer: 14 | unify: true 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ******************** 2 | Copyright (c) 2017, Lawrence Livermore National Security, LLC. 3 | Produced at the Lawrence Livermore National Laboratory. 4 | 5 | Copyright 2017, UT-Battelle, LLC. 6 | 7 | LLNL-CODE-741539 8 | All rights reserved. 9 | 10 | This is the license for UnifyFS. For details, see 11 | https://github.com/LLNL/UnifyFS. 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights to 16 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 17 | the Software, and to permit persons to whom the Software is furnished to do so, 18 | subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 25 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 26 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 27 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | ***************** 30 | -------------------------------------------------------------------------------- /LICENSE.ANL: -------------------------------------------------------------------------------- 1 | COPYRIGHT 2 | 3 | The following is a notice of limited availability of the code, and disclaimer 4 | which must be included in the prologue of the code and in all source listings 5 | of the code. 6 | 7 | Copyright Notice 8 | + 2009 University of Chicago 9 | 10 | Permission is hereby granted to use, reproduce, prepare derivative works, and 11 | to redistribute to others. This software was authored by: 12 | 13 | Argonne National Laboratory Group 14 | P. Carns: (630) 685-1268; e-mail: carns@mcs.anl.gov 15 | Mathematics and Computer Science Division 16 | Argonne National Laboratory, Argonne IL 60439 17 | 18 | 19 | GOVERNMENT LICENSE 20 | 21 | Portions of this material resulted from work developed under a U.S. 22 | Government Contract and are subject to the following license: the Government 23 | is granted for itself and others acting on its behalf a paid-up, nonexclusive, 24 | irrevocable worldwide license in this computer software to reproduce, prepare 25 | derivative works, and perform publicly and display publicly. 26 | 27 | DISCLAIMER 28 | 29 | This computer code material was prepared, in part, as an account of work 30 | sponsored by an agency of the United States Government. Neither the United 31 | States, nor the University of Chicago, nor any of their employees, makes any 32 | warranty express or implied, or assumes any legal liability or responsibility 33 | for the accuracy, completeness, or usefulness of any information, apparatus, 34 | product, or process disclosed, or represents that its use would not infringe 35 | privately owned rights. 36 | -------------------------------------------------------------------------------- /LICENSE.BURSTFS: -------------------------------------------------------------------------------- 1 | ******************** 2 | Copyright (c) 2017, Lawrence Livermore National Security, LLC. 3 | Produced at the Lawrence Livermore National Laboratory. 4 | Copyright (c) 2017, Florida State University. Contributions from 5 | the Computer Architecture and Systems Research Laboratory (CASTL) 6 | at the Department of Computer Science. 7 | Written by 8 | Teng Wang tw15g@my.fsu.edu 9 | Adam Moody moody20@llnl.gov 10 | Weikuan Yu wyu3@fsu.edu 11 | Kento Sato kento@llnl.gov 12 | Kathryn Mohror kathryn@llnl.gov 13 | LLNL-CODE-728877 14 | All rights reserved. 15 | 16 | This is the license for BurstFS. For details, see 17 | https://github.com/llnl/burstfs. 18 | Permission is hereby granted, free of charge, to any person obtaining a copy 19 | of this software and associated documentation files (the "Software"), to deal 20 | in the Software without restriction, including without limitation the rights to 21 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 22 | the Software, and to permit persons to whom the Software is furnished to do so, 23 | subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in all 26 | copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 30 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 31 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 32 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 33 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 34 | ***************** 35 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = extras client server util examples t 2 | 3 | CONFIG = ordered 4 | 5 | ACLOCAL_AMFLAGS = -I m4 6 | 7 | pkgconfigdir = @pkgconfigdir@ 8 | pkgconfig_DATA = \ 9 | client/unifyfs.pc \ 10 | client/unifyfs-api.pc \ 11 | client/unifyfs-static.pc 12 | 13 | CLEANFILES = 14 | 15 | checkstyle: 16 | scripts/checkpatch.sh 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UnifyFS: A User-Level File System for Supercomputers 2 | 3 | Node-local storage is becoming an indispensable hardware resource on 4 | large-scale supercomputers to buffer the bursty I/O from scientific 5 | applications. However, there is a lack of software support for node-local storage to 6 | be used efficiently by applications that use shared files. 7 | 8 | UnifyFS is an ephemeral, user-level file system under active development. 9 | UnifyFS addresses a major usability factor of current and future systems because it enables 10 | applications to gain performance advantages from distributed storage devices on the system while being as easy to use as a center-wide parallel file system. 11 | 12 | ## Documentation 13 | UnifyFS documentation is at [https://unifyfs.readthedocs.io](https://unifyfs.readthedocs.io). 14 | 15 | For instructions on how to build and install UnifyFS, 16 | see [Build UnifyFS](http://unifyfs.readthedocs.io/en/dev/build.html). 17 | 18 | ## Build Status 19 | Status of UnifyFS development branch (dev): 20 | 21 | ![Build Status](https://github.com/LLNL/UnifyFS/actions/workflows/build-and-test.yml/badge.svg?branch=dev) 22 | 23 | [![Read the Docs](https://readthedocs.org/projects/unifyfs/badge/?version=dev)](https://unifyfs.readthedocs.io) 24 | 25 | ## UnifyFS Citation 26 | We recommend that you use this citation for UnifyFS: 27 | 28 | * Michael Brim, Adam Moody, Seung-Hwan Lim, Ross Miller, Swen Boehm, Cameron Stanavige, Kathryn Mohror, Sarp Oral, “UnifyFS: A User-level Shared File System for Unified Access to Distributed Local Storage,” 37th IEEE International Parallel & Distributed Processing Symposium (IPDPS 2023), St. Petersburg, FL, May 2023. 29 | 30 | ## Contribute and Develop 31 | If you would like to help, please see our [contributing guidelines](https://unifyfs.readthedocs.io/en/dev/contribute-ways.html). 32 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo 4 | echo ... UnifyFS autogen ... 5 | echo 6 | 7 | ## Check all dependencies are present 8 | MISSING="" 9 | 10 | # Check for aclocal 11 | env aclocal --version > /dev/null 2>&1 12 | if [ $? -eq 0 ]; then 13 | ACLOCAL=aclocal 14 | else 15 | MISSING="$MISSING aclocal" 16 | fi 17 | 18 | # Check for autoconf 19 | env autoconf --version > /dev/null 2>&1 20 | if [ $? -eq 0 ]; then 21 | AUTOCONF=autoconf 22 | else 23 | MISSING="$MISSING autoconf" 24 | fi 25 | 26 | # Check for autoheader 27 | env autoheader --version > /dev/null 2>&1 28 | if [ $? -eq 0 ]; then 29 | AUTOHEADER=autoheader 30 | else 31 | MISSING="$MISSING autoheader" 32 | fi 33 | 34 | # Check for automake 35 | env automake --version > /dev/null 2>&1 36 | if [ $? -eq 0 ]; then 37 | AUTOMAKE=automake 38 | else 39 | MISSING="$MISSING automake" 40 | fi 41 | 42 | # Check for libtoolize or glibtoolize 43 | env libtoolize --version > /dev/null 2>&1 44 | if [ $? -eq 0 ]; then 45 | # libtoolize was found, so use it 46 | LIBTOOLIZE=libtoolize 47 | else 48 | # libtoolize wasn't found, so check for glibtoolize 49 | env glibtoolize --version > /dev/null 2>&1 50 | if [ $? -eq 0 ]; then 51 | LIBTOOLIZE=glibtoolize 52 | else 53 | MISSING="$MISSING libtoolize" 54 | fi 55 | fi 56 | 57 | # Check for tar 58 | env tar -cf /dev/null /dev/null > /dev/null 2>&1 59 | if [ $? -ne 0 ]; then 60 | MISSING="$MISSING tar" 61 | fi 62 | 63 | ## If dependencies are missing, warn the user and abort 64 | if [ "x$MISSING" != "x" ]; then 65 | echo "Aborting." 66 | echo 67 | echo "The following build tools are missing:" 68 | echo 69 | for pkg in $MISSING; do 70 | echo " * $pkg" 71 | done 72 | echo 73 | echo "Please install them and try again." 74 | echo 75 | exit 1 76 | fi 77 | 78 | ## Do the autogeneration 79 | env autoreconf --version > /dev/null 2>&1 80 | if [ $? -eq 0 ]; then 81 | echo Running ${LIBTOOLIZE}... 82 | $LIBTOOLIZE --automake --copy --force 83 | echo Running autoreconf... 84 | autoreconf --force --install --verbose 85 | else 86 | echo Running ${LIBTOOLIZE}... 87 | $LIBTOOLIZE --automake --copy --force 88 | echo Running ${ACLOCAL}... 89 | $ACLOCAL 90 | echo Running ${AUTOHEADER}... 91 | $AUTOHEADER 92 | echo Running ${AUTOCONF}... 93 | $AUTOCONF 94 | echo Running ${AUTOMAKE}... 95 | $AUTOMAKE --add-missing --force-missing --copy --foreign 96 | fi 97 | 98 | 99 | # Instruct user on next steps 100 | echo 101 | echo "Please proceed with configuring, compiling, and installing." 102 | -------------------------------------------------------------------------------- /client/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | 3 | bin_SCRIPTS = unifyfs-config 4 | 5 | CLEANFILES = $(bin_SCRIPTS) 6 | -------------------------------------------------------------------------------- /client/check_fns/README.md: -------------------------------------------------------------------------------- 1 | # Wrappers 2 | 3 | The files in this folder help manage the set of wrappers that are implemented. 4 | In particluar, they are used to enable a tool that 5 | detects I/O routines used by an application that are not yet supported in UnifyFS. 6 | They are also used to generate the code required for GOTCHA. 7 | 8 | - fakechroot_list.txt - lists I/O routines from fakechroot 9 | - gnulibc_list.txt - I/O routines from libc 10 | - cstdio_list.txt - I/O routines from stdio 11 | - posix_list.txt - I/O routines in POSIX 12 | - unifyfs_list.txt - list of wrappers in UnifyFS 13 | - unifyfs_unsupported_list.txt - list of wrappers in UnifyFS that implemented, but not supported 14 | 15 | Our [Wrapper Guide](https://unifyfs.readthedocs.io/en/dev/wrappers.html) 16 | has the full documentation on running the unifyfs_check_fns tool, building the 17 | GOTCHA list, and building the other .txt files here. 18 | -------------------------------------------------------------------------------- /client/check_fns/cstdio_list.txt: -------------------------------------------------------------------------------- 1 | # http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf 2 | 3 | # 7.19.4 Operations on file 4 | 1 remove 5 | 2 rename 6 | 3 tmpfile 7 | 4 tmpnam 8 | 9 | # 7.19.5 file access functions 10 | 1 fclose 11 | 2 fflush 12 | 3 fopen 13 | 4 freopen 14 | 5 setbuf 15 | 6 setvbuf 16 | 17 | # 7.19.6 formatted input/output functions 18 | 1 fprintf 19 | 2 fscanf 20 | 3 printf 21 | 4 scanf 22 | 5 snprintf 23 | 6 sprintf 24 | 7 sscanf 25 | 8 vfprintf 26 | 9 vfscanf 27 | 10 vprintf 28 | 11 vscanf 29 | 12 vsnprintf 30 | 13 vsprintf 31 | 14 vsscanf 32 | 33 | # 7.19.7 character input/output functions 34 | 1 fgetc 35 | 2 fgets 36 | 3 fputc 37 | 4 fputs 38 | 5 getc 39 | 6 getchar 40 | 7 gets 41 | 8 putc 42 | 9 putchar 43 | 10 puts 44 | 11 ungetc 45 | 46 | # 7.19.8 direct input/output functions 47 | 1 fread 48 | 2 fwrite 49 | 50 | # 7.19.9 File positioning functions 51 | 1 fgetpos 52 | 2 fseek 53 | 3 fsetpos 54 | 4 ftell 55 | 5 rewind 56 | 57 | # 7.19.10 Error-handling functions 58 | 1 clearerr 59 | 2 feof 60 | 3 ferror 61 | 4 perror 62 | 63 | # 7.24.2 formatted wide characters 64 | 1 fwprintf 65 | 2 fwscanf 66 | 3 swprintf 67 | 4 swscanf 68 | 5 vfwprintf 69 | 6 vfwscanf 70 | 7 vswprintf 71 | 8 vswscanf 72 | 9 vwprintf 73 | 10 vwscanf 74 | 11 wprintf 75 | 12 wscanf 76 | 77 | # 7.24.3 wide character input/output 78 | 1 fgetwc 79 | 2 fgetws 80 | 3 fputwc 81 | 4 fputws 82 | 5 fwide 83 | 6 getwc 84 | 7 getwchar 85 | 8 putwc 86 | 9 putwchar 87 | 10 ungetwc 88 | -------------------------------------------------------------------------------- /client/check_fns/fakechroot_list.txt: -------------------------------------------------------------------------------- 1 | __fxstatat.c 2 | __fxstatat64.c 3 | __getcwd_chk.c 4 | __getwd_chk.c 5 | __lxstat.c 6 | __lxstat64.c 7 | __open.c 8 | __open64.c 9 | __open64_2.c 10 | __open_2.c 11 | __openat64_2.c 12 | __openat_2.c 13 | __opendir2.c 14 | __readlink_chk.c 15 | __readlinkat_chk.c 16 | __realpath_chk.c 17 | __statfs.c 18 | __xmknod.c 19 | __xmknodat.c 20 | __xstat.c 21 | __xstat64.c 22 | _xftw.c 23 | _xftw64.c 24 | access.c 25 | acct.c 26 | bind.c 27 | bindtextdomain.c 28 | canonicalize_file_name.c 29 | chdir.c 30 | chmod.c 31 | chown.c 32 | chroot.c 33 | connect.c 34 | creat.c 35 | creat64.c 36 | dlmopen.c 37 | dlopen.c 38 | eaccess.c 39 | euidaccess.c 40 | execl.c 41 | execle.c 42 | execlp.c 43 | execv.c 44 | execve.c 45 | execvp.c 46 | faccessat.c 47 | fchmodat.c 48 | fchownat.c 49 | fopen.c 50 | fopen64.c 51 | freopen.c 52 | freopen64.c 53 | fts.c 54 | ftw.c 55 | ftw64.c 56 | futimesat.c 57 | get_current_dir_name.c 58 | getcwd.c 59 | getpeername.c 60 | getsockname.c 61 | getwd.c 62 | getxattr.c 63 | glob.c 64 | glob64.c 65 | glob_pattern_p.c 66 | inotify_add_watch.c 67 | lchmod.c 68 | lchown.c 69 | lckpwdf.c 70 | lgetxattr.c 71 | libfakechroot.c 72 | link.c 73 | linkat.c 74 | listxattr.c 75 | llistxattr.c 76 | lremovexattr.c 77 | lsetxattr.c 78 | lstat.c 79 | lstat64.c 80 | lutimes.c 81 | mkdir.c 82 | mkdirat.c 83 | mkdtemp.c 84 | mkfifo.c 85 | mkfifoat.c 86 | mknod.c 87 | mknodat.c 88 | mkstemp.c 89 | mkstemp64.c 90 | mktemp.c 91 | open.c 92 | open64.c 93 | openat.c 94 | openat64.c 95 | opendir.c 96 | pathconf.c 97 | popen.c 98 | rawmemchr.c 99 | readlink.c 100 | readlinkat.c 101 | realpath.c 102 | remove.c 103 | removexattr.c 104 | rename.c 105 | renameat.c 106 | revoke.c 107 | rmdir.c 108 | rpl_lstat.c 109 | scandir.c 110 | scandir64.c 111 | setenv.c 112 | setxattr.c 113 | stat.c 114 | stat64.c 115 | statfs.c 116 | statfs64.c 117 | statvfs.c 118 | statvfs64.c 119 | stpcpy.c 120 | strchrnul.c 121 | symlink.c 122 | symlinkat.c 123 | system.c 124 | tempnam.c 125 | tmpnam.c 126 | truncate.c 127 | truncate64.c 128 | ulckpwdf.c 129 | unlink.c 130 | unlinkat.c 131 | unsetenv.c 132 | utime.c 133 | utimensat.c 134 | utimes.c 135 | -------------------------------------------------------------------------------- /client/check_fns/posix_list.txt: -------------------------------------------------------------------------------- 1 | readlink 2 | readlinkat 3 | symlink 4 | symlinkat 5 | 6 | chown 7 | fchown 8 | lchown 9 | fchownat 10 | 11 | chmod 12 | fchmod 13 | fchmodat 14 | 15 | utime 16 | utimes 17 | 18 | fcntl 19 | fstatvs 20 | 21 | mknod 22 | mknodat 23 | 24 | chdir 25 | getcwd 26 | getwd 27 | get_current_dir_name 28 | 29 | opendir 30 | rewinddir 31 | readdir 32 | readdir_r 33 | closedir 34 | 35 | ftw 36 | nftw 37 | -------------------------------------------------------------------------------- /client/check_fns/unifyfs_translate.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import sys 3 | import re 4 | 5 | ''' a modified version of Elsa's translate.py script here: 6 | https://github.com/LLNL/GOTCHA-tracer/blob/master/modules/translate.py 7 | this one just writes the gotcha struct to a header file 8 | and writes out the UNIFYFS_DEF macros 9 | 10 | to generate gotcha header run the following: python unifyfs_translate.py unifyfs_list 11 | ''' 12 | class func: 13 | 14 | def __init__(self, prototype): 15 | l = prototype.strip().split('(') 16 | x = filter(None, l[0].split(' ')) 17 | p = l[2:] 18 | self.params = [elem.strip("),") for elem in p] 19 | 20 | # set up useful vars 21 | self.ret_type = ' '.join(x[0:-1]) 22 | self.wrap_macro = x[-1] 23 | self.real_macro = "UNIFYFS_REAL" 24 | self.macro_def = "UNIFYFS_DEF" 25 | self.name = l[1].strip(")") 26 | 27 | self.name_quote = "\"" + self.name + "\"" 28 | self.wrapper = self.wrap_macro + "(" + self.name + ")" 29 | self.wrapee = self.real_macro + "(" + self.name + ")" 30 | 31 | def __str__(self): 32 | return self.wrap_macro + ' (' + self.name + ')' 33 | 34 | def read_functions_file(filename): 35 | functions = [] 36 | f = open(filename, 'r') 37 | for line in f: 38 | functions.append(func(line)) 39 | f.close() 40 | return functions 41 | 42 | def write_gotcha_file(filename, func_list, modulename): 43 | m = modulename.split('_')[0] 44 | f = open(filename, 'w') 45 | 46 | # write each function definition in the list 47 | for function in func_list: 48 | f.write(function.macro_def + "(" + function.name + ", " + function.ret_type + 49 | "," " (" + function.params[0] + "));" + "\n") 50 | 51 | # write map struct 52 | f.write("struct gotcha_binding_t wrap_" + modulename + "[] = {\n") 53 | for function in func_list: 54 | f.write("\t{ " + function.name_quote + ", " + function.wrapper + ", &" + function.wrapee + " },\n") 55 | f.write("};\n") 56 | 57 | # define number of functions we are wrapping for gotcha struct 58 | f.write("\n#define GOTCHA_NFUNCS (sizeof(wrap_unifyfs_list) / sizeof(wrap_unifyfs_list[0]))\n") 59 | 60 | # close struct and file 61 | f.close() 62 | 63 | def main(modulename): 64 | functions = read_functions_file(modulename+".txt") 65 | write_gotcha_file("gotcha_map_"+modulename+".h", functions, modulename) 66 | 67 | if __name__ == "__main__": 68 | if len(sys.argv) < 2: 69 | print("Usage: python", sys.argv[0], "modulename") 70 | else: 71 | main(sys.argv[1]) 72 | -------------------------------------------------------------------------------- /client/check_fns/unifyfs_unsupported_list.txt: -------------------------------------------------------------------------------- 1 | # wrapped but not implemented 2 | 3 | freopen 4 | fwprintf 5 | fwscanf 6 | vfwprintf 7 | vfwscanf 8 | fgetwc 9 | fgetws 10 | fputwc 11 | fputws 12 | fwide 13 | getwc 14 | putwc 15 | ungetwc 16 | -------------------------------------------------------------------------------- /client/src/client_api.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include "unifyfs.h" 16 | #include "unifyfs_api_internal.h" 17 | #include "posix_client.h" 18 | 19 | 20 | /* ======================================= 21 | * Global variable declarations 22 | * ======================================= */ 23 | 24 | char* unifyfs_mount_prefix; 25 | size_t unifyfs_mount_prefixlen; 26 | 27 | 28 | /* ======================================= 29 | * Operations to mount/unmount file system 30 | * ======================================= */ 31 | 32 | /** 33 | * Mount UnifyFS file system at given prefix 34 | * 35 | * @param prefix: directory prefix 36 | * @param rank: client rank within application 37 | * @param size: the number of application clients 38 | * 39 | * @return success/error code 40 | */ 41 | int unifyfs_mount(const char prefix[], 42 | int rank, 43 | size_t size) 44 | { 45 | // generate app_id from mountpoint prefix 46 | int app_id = unifyfs_generate_gfid(prefix); 47 | if (-1 != unifyfs_mount_id) { 48 | if (app_id != unifyfs_mount_id) { 49 | LOGERR("multiple mount support not yet implemented"); 50 | return UNIFYFS_FAILURE; 51 | } else { 52 | LOGDBG("already mounted"); 53 | return UNIFYFS_SUCCESS; 54 | } 55 | } 56 | 57 | // record our rank for debugging messages 58 | client_rank = rank; 59 | global_rank_cnt = (int)size; 60 | 61 | // record mountpoint prefix string 62 | unifyfs_mount_prefix = strdup(prefix); 63 | unifyfs_mount_prefixlen = strlen(prefix); 64 | 65 | // initialize as UnifyFS POSIX client 66 | return posix_client_init(); 67 | } 68 | 69 | /** 70 | * Unmount the mounted UnifyFS file system 71 | * 72 | * @return success/error code 73 | */ 74 | int unifyfs_unmount(void) 75 | { 76 | if (-1 == unifyfs_mount_id) { 77 | return UNIFYFS_SUCCESS; 78 | } 79 | 80 | int rc = posix_client_fini(); 81 | if (UNIFYFS_SUCCESS != rc) { 82 | return rc; 83 | } 84 | 85 | /* free mount prefix string */ 86 | if (unifyfs_mount_prefix != NULL) { 87 | free(unifyfs_mount_prefix); 88 | unifyfs_mount_prefix = NULL; 89 | unifyfs_mount_prefixlen = 0; 90 | } 91 | 92 | return UNIFYFS_SUCCESS; 93 | } 94 | -------------------------------------------------------------------------------- /client/src/client_transfer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include "unifyfs-internal.h" 16 | #include "unifyfs_api_internal.h" 17 | #include "margo_client.h" 18 | 19 | typedef struct transfer_request_status { 20 | unifyfs_client* client; 21 | unifyfs_transfer_request* req; 22 | 23 | /* set to 1 if source file is in client namespace, otherwise 24 | * destination file is in the namespace */ 25 | int src_in_unify; 26 | 27 | /* the following is for synchronizing access/updates to below state */ 28 | ABT_mutex sync; 29 | volatile unsigned int complete; /* has request completed? */ 30 | } client_transfer_status; 31 | 32 | 33 | /* Create a new transfer status for the given transfer request and 34 | * insert it into client->active_transfers arraylist */ 35 | int client_create_transfer(unifyfs_client* client, 36 | unifyfs_transfer_request* req, 37 | bool src_in_unify); 38 | 39 | /* Retrieve the transfer status for request with the given id */ 40 | client_transfer_status* client_get_transfer(unifyfs_client* client, 41 | unsigned int transfer_id); 42 | 43 | /* Check if the transfer has completed */ 44 | bool client_check_transfer_complete(client_transfer_status* transfer); 45 | 46 | /* Remove the transfer status from client->active_transfers arraylist */ 47 | int client_cleanup_transfer(unifyfs_client* client, 48 | client_transfer_status* transfer); 49 | 50 | /* Update the transfer status for the client (app_id + client_id) 51 | * transfer request (transfer_id) using the given error_code, transfer 52 | * size, and transfer time */ 53 | int client_complete_transfer(unifyfs_client* client, 54 | int transfer_id, 55 | int error_code, 56 | size_t transfer_size_bytes, 57 | double transfer_time_seconds); 58 | 59 | /* Given an array of transfer requests, submit each request after 60 | * creating a transfer status structure for the request and storing it 61 | * within client->active_transfers */ 62 | int client_submit_transfers(unifyfs_client* client, 63 | unifyfs_transfer_request* t_reqs, 64 | size_t n_reqs); 65 | -------------------------------------------------------------------------------- /client/src/pmpi_wrappers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_PMPI_WRAPPERS_H 16 | #define UNIFYFS_PMPI_WRAPPERS_H 17 | 18 | #include 19 | 20 | /* MPI_Init PMPI wrapper */ 21 | int unifyfs_mpi_init(int* argc, char*** argv, int required, int* provided); 22 | int MPI_Init(int* argc, char*** argv); 23 | int MPI_Init_thread(int* argc, char*** argv, int required, int* provided); 24 | void mpi_init_(MPI_Fint* ierr); 25 | void mpi_init_thread_(MPI_Fint* required, MPI_Fint* provided, MPI_Fint* ierr); 26 | 27 | /* MPI_Finalize PMPI wrapper */ 28 | int unifyfs_mpi_finalize(void); 29 | int MPI_Finalize(void); 30 | void mpi_finalize_(MPI_Fint* ierr); 31 | 32 | #endif /* UNIFYFS_PMPI_WRAPPERS_H */ 33 | -------------------------------------------------------------------------------- /client/src/preload.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2022, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "unifyfs.h" 20 | #include "unifyfs_rc.h" 21 | 22 | static int preload_initialized; // = 0 23 | 24 | void unifyfs_preload_init(void) __attribute__ ((constructor)); 25 | void unifyfs_preload_fini(void) __attribute__ ((destructor)); 26 | 27 | static void unifyfs_preload_mount(void) 28 | { 29 | if (preload_initialized) { 30 | return; 31 | } 32 | 33 | char* mountpoint = getenv("UNIFYFS_PRELOAD_MOUNTPOINT"); 34 | if (NULL == mountpoint) { 35 | mountpoint = strdup("/unifyfs"); 36 | } 37 | 38 | int rank = 0; 39 | int world_sz = 1; 40 | int rc = unifyfs_mount(mountpoint, rank, (size_t)world_sz); 41 | if (UNIFYFS_SUCCESS != rc) { 42 | fprintf(stderr, 43 | "UNIFYFS ERROR: unifyfs_mount(%s) failed with '%s'\n", 44 | mountpoint, unifyfs_rc_enum_description((unifyfs_rc)rc)); 45 | } else { 46 | fprintf(stderr, "DEBUG: mounted\n"); 47 | preload_initialized = 1; 48 | } 49 | } 50 | 51 | static void unifyfs_preload_unmount(void) 52 | { 53 | if (preload_initialized) { 54 | int rc = unifyfs_unmount(); 55 | if (UNIFYFS_SUCCESS != rc) { 56 | fprintf(stderr, 57 | "UNIFYFS ERROR: unifyfs_unmount() failed with '%s'\n", 58 | unifyfs_rc_enum_description((unifyfs_rc)rc)); 59 | } 60 | fprintf(stderr, "DEBUG: unmounted\n"); 61 | preload_initialized = 0; 62 | } 63 | } 64 | 65 | void unifyfs_preload_init(void) 66 | { 67 | unifyfs_preload_mount(); 68 | fflush(NULL); 69 | } 70 | 71 | void unifyfs_preload_fini(void) 72 | { 73 | unifyfs_preload_unmount(); 74 | fflush(NULL); 75 | } 76 | -------------------------------------------------------------------------------- /client/src/unifyfs-dirops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2017, 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_DIROPS_H 16 | #define UNIFYFS_DIROPS_H 17 | 18 | #include "unifyfs-internal.h" 19 | #include "unifyfs_wrap.h" 20 | 21 | /* 22 | * FIXME: is this portable to use the linux dirent structure? 23 | */ 24 | 25 | /* 26 | * standard clib functions to be wrapped: 27 | * 28 | * opendir(3) 29 | * fdopendir(3) 30 | * closedir(3) 31 | * readdir(3) 32 | * rewinddir(3) 33 | * dirfd(3) 34 | * telldir(3) 35 | * scandir(3) 36 | * seekdir(3) 37 | */ 38 | 39 | UNIFYFS_DECL(opendir, DIR*, (const char* name)); 40 | UNIFYFS_DECL(fdopendir, DIR*, (int fd)); 41 | UNIFYFS_DECL(closedir, int, (DIR* dirp)); 42 | UNIFYFS_DECL(readdir, struct dirent*, (DIR* dirp)); 43 | UNIFYFS_DECL(rewinddir, void, (DIR* dirp)); 44 | UNIFYFS_DECL(dirfd, int, (DIR* dirp)); 45 | UNIFYFS_DECL(telldir, long, (DIR* dirp)); 46 | UNIFYFS_DECL(scandir, int, (const char* dirp, struct dirent** namelist, 47 | int (*filter)(const struct dirent*), 48 | int (*compar)(const struct dirent**, 49 | const struct dirent**))); 50 | UNIFYFS_DECL(seekdir, void, (DIR* dirp, long loc)); 51 | 52 | #endif /* UNIFYFS_DIROPS_H */ 53 | 54 | -------------------------------------------------------------------------------- /client/src/unifyfs-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * Copyright (c) 2017, Lawrence Livermore National Security, LLC. 17 | * Produced at the Lawrence Livermore National Laboratory. 18 | * Copyright (c) 2017, Florida State University. Contributions from 19 | * the Computer Architecture and Systems Research Laboratory (CASTL) 20 | * at the Department of Computer Science. 21 | * 22 | * Written by: Teng Wang, Adam Moody, Weikuan Yu, Kento Sato, Kathryn Mohror 23 | * LLNL-CODE-728877. All rights reserved. 24 | * 25 | * This file is part of burstfs. 26 | * For details, see https://github.com/llnl/burstfs 27 | * Please read https://github.com/llnl/burstfs/LICENSE for full license text. 28 | */ 29 | 30 | /* 31 | * Copyright (c) 2013, Lawrence Livermore National Security, LLC. 32 | * Produced at the Lawrence Livermore National Laboratory. 33 | * code Written by 34 | * Raghunath Rajachandrasekar 35 | * Kathryn Mohror 36 | * Adam Moody 37 | * All rights reserved. 38 | * This file is part of CRUISE. 39 | * For details, see https://github.com/hpc/cruise 40 | * Please also read this file LICENSE.CRUISE 41 | */ 42 | 43 | #ifndef UNIFYFS_INTERNAL_H 44 | #define UNIFYFS_INTERNAL_H 45 | 46 | #include "config.h" 47 | 48 | #ifdef HAVE_OFF64_T 49 | #define _FILE_OFFSET_BITS 64 50 | #define _LARGEFILE64_SOURCE 51 | #else 52 | #define off64_t int64_t 53 | #endif 54 | 55 | /* ------------------------------- 56 | * Common includes 57 | * ------------------------------- 58 | */ 59 | 60 | #ifndef _GNU_SOURCE 61 | #define _GNU_SOURCE 62 | #endif 63 | 64 | // system headers 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #include 85 | #include 86 | #include 87 | #include 88 | #include 89 | #include 90 | #include 91 | #include 92 | #include 93 | 94 | #ifdef HAVE_SYS_STATFS_H 95 | #include 96 | #endif 97 | 98 | // common headers 99 | #include "arraylist.h" 100 | #include "unifyfs_configurator.h" 101 | #include "unifyfs_const.h" 102 | #include "unifyfs_keyval.h" 103 | #include "unifyfs_log.h" 104 | #include "unifyfs_logio.h" 105 | #include "unifyfs_meta.h" 106 | #include "unifyfs_shm.h" 107 | #include "seg_tree.h" 108 | 109 | // client headers 110 | #include "unifyfs-stack.h" 111 | #include "utlist.h" 112 | #include "uthash.h" 113 | 114 | 115 | #endif /* UNIFYFS_INTERNAL_H */ 116 | -------------------------------------------------------------------------------- /client/src/unifyfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_H 16 | #define UNIFYFS_H 17 | 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* "UNFY" in ASCII */ 25 | //#define UNIFYFS_SUPER_MAGIC (0x554E4659) 26 | 27 | /* "UnifyFS!" in ASCII */ 28 | #define UNIFYFS_SUPER_MAGIC (0x556E696679465321) 29 | 30 | /** 31 | * Mount UnifyFS file system at given prefix 32 | * 33 | * @param prefix mountpoint prefix 34 | * @param rank client rank within application 35 | * @param size the number of application clients 36 | * 37 | * @return success/error code 38 | */ 39 | int unifyfs_mount(const char prefix[], int rank, size_t size); 40 | 41 | /** 42 | * Unmount the UnifyFS file system 43 | * 44 | * @return success/error code 45 | */ 46 | int unifyfs_unmount(void); 47 | 48 | 49 | /* Enumeration to control transfer mode */ 50 | enum { 51 | UNIFYFS_TRANSFER_SERIAL = 0, 52 | UNIFYFS_TRANSFER_PARALLEL = 1, 53 | }; 54 | 55 | /** 56 | * Transfer a single file between UnifyFS and another file system. 57 | * Either @src or @dst (not both) should specify a path within 58 | * the UnifyFS namespace prefixed by the mountpoint, e.g., /unifyfs/.. 59 | * 60 | * @param src source file path 61 | * @param dst destination file path 62 | * @param mode transfer mode 63 | * 64 | * @return 0 on success, negative errno otherwise. 65 | */ 66 | int unifyfs_transfer_file(const char* src, 67 | const char* dst, 68 | int mode); 69 | 70 | static inline 71 | int unifyfs_transfer_file_serial(const char* src, const char* dst) 72 | { 73 | return unifyfs_transfer_file(src, dst, UNIFYFS_TRANSFER_SERIAL); 74 | } 75 | 76 | static inline 77 | int unifyfs_transfer_file_parallel(const char* src, const char* dst) 78 | { 79 | return unifyfs_transfer_file(src, dst, UNIFYFS_TRANSFER_PARALLEL); 80 | } 81 | 82 | 83 | #ifdef __cplusplus 84 | } // extern "C" 85 | #endif 86 | 87 | #endif /* UNIFYFS_H */ 88 | -------------------------------------------------------------------------------- /client/src/unifyfsf.h: -------------------------------------------------------------------------------- 1 | ! Copyright (c) 2020, Lawrence Livermore National Security, LLC. 2 | ! Produced at the Lawrence Livermore National Laboratory. 3 | ! 4 | ! Copyright 2020, UT-Battelle, LLC. 5 | ! 6 | ! LLNL-CODE-741539 7 | ! All rights reserved. 8 | ! 9 | ! This is the license for UnifyFS. 10 | ! For details, see https://github.com/LLNL/UnifyFS. 11 | ! Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 12 | ! 13 | ! return codes 14 | INTEGER UNIFYFS_SUCCESS 15 | PARAMETER (UNIFYFS_SUCCESS=0) 16 | -------------------------------------------------------------------------------- /client/unifyfs-api.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: UnifyFS 7 | Description: API library for UnifyFS unified local storage file system 8 | Version: @LIBUNIFYFS_API_VERSION@ 9 | Requires.private: margo 10 | Libs: -L${libdir} -lunifyfs_api 11 | Cflags: -I${includedir} -I${includedir}/unifyfs 12 | -------------------------------------------------------------------------------- /client/unifyfs-config.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # (C) 2012 by Argonne National Laboratory. 5 | # See COPYRIGHT in top-level directory. 6 | # 7 | 8 | 9 | 10 | LINK_WRAPPERS="@LINK_WRAPPERS@" 11 | UNIFYFS_LIB_PATH="@unifyfs_lib_path@" 12 | UNIFYFS_LD_FLAGS="@LDFLAGS@" 13 | 14 | PRE_LD_FLAGS="-L$UNIFYFS_LIB_PATH $UNIFYFS_LD_FLAGS $LINK_WRAPPERS" 15 | POST_LD_FLAGS="$UNIFYFS_LIB_PATH/libunifyfs.a -lcrypto -lm -lrt -lpthread -lz" 16 | 17 | 18 | usage="\ 19 | Usage: unifyfs-config [--pre-ld-flags] [--post-ld-flags]" 20 | 21 | if test $# -eq 0; then 22 | echo "${usage}" 1>&2 23 | exit 1 24 | fi 25 | 26 | while test $# -gt 0; do 27 | case "$1" in 28 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 29 | *) optarg= ;; 30 | esac 31 | 32 | case $1 in 33 | --pre-ld-flags) 34 | echo $PRE_LD_FLAGS 35 | ;; 36 | --post-ld-flags) 37 | echo $POST_LD_FLAGS 38 | ;; 39 | *) 40 | echo "${usage}" 1>&2 41 | exit 1 42 | ;; 43 | esac 44 | shift 45 | done 46 | -------------------------------------------------------------------------------- /client/unifyfs-static.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: UnifyFS 7 | Description: client library for UnifyFS unified local storage file system 8 | Version: @LIBUNIFYFS_API_VERSION@ 9 | Requires: margo 10 | Libs: @LINK_WRAPPERS@ ${libdir}/libunifyfs.a @SPATH_LIBS@ -lcrypto -lm -lrt -lpthread -lz 11 | Cflags: -I${includedir} -I${includedir}/unifyfs -D__FILE_OFFSET_BITS=64 12 | 13 | -------------------------------------------------------------------------------- /client/unifyfs.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: UnifyFS 7 | Description: client library for UnifyFS unified local storage file system 8 | Version: @LIBUNIFYFS_API_VERSION@ 9 | Requires.private: margo 10 | Libs: -L${libdir} -lunifyfs_gotcha 11 | Cflags: -I${includedir} -I${includedir}/unifyfs -D__FILE_OFFSET_BITS=64 12 | -------------------------------------------------------------------------------- /common/src/LICENSE.inih: -------------------------------------------------------------------------------- 1 | 2 | The "inih" library is distributed under the New BSD license: 3 | 4 | Copyright (c) 2009, Ben Hoyt 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of Ben Hoyt nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY BEN HOYT ''AS IS'' AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL BEN HOYT BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /common/src/LICENSE.tedium: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Michael J. Brim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /common/src/LICENSE.tinyexpr: -------------------------------------------------------------------------------- 1 | zlib License 2 | 3 | Copyright (C) 2015, 2016 Lewis Van Winkle 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgement in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | -------------------------------------------------------------------------------- /common/src/LICENSE.tree_dot_h: -------------------------------------------------------------------------------- 1 | Copyright 2002 Niels Provos 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /common/src/Makefile.mk: -------------------------------------------------------------------------------- 1 | UNIFYFS_COMMON_INSTALL_HDRS = \ 2 | %reldir%/unifyfs_configurator.h \ 3 | %reldir%/unifyfs_const.h \ 4 | %reldir%/unifyfs_rc.h 5 | 6 | UNIFYFS_COMMON_BASE_SRCS = \ 7 | %reldir%/arraylist.h \ 8 | %reldir%/arraylist.c \ 9 | %reldir%/compare_fn.h \ 10 | %reldir%/compare_fn.c \ 11 | %reldir%/ini.h \ 12 | %reldir%/ini.c \ 13 | %reldir%/rm_enumerator.h \ 14 | %reldir%/rm_enumerator.c \ 15 | %reldir%/seg_tree.h \ 16 | %reldir%/seg_tree.c \ 17 | %reldir%/slotmap.h \ 18 | %reldir%/slotmap.c \ 19 | %reldir%/tinyexpr.h \ 20 | %reldir%/tinyexpr.c \ 21 | %reldir%/tree.h \ 22 | %reldir%/unifyfs_client.h \ 23 | %reldir%/unifyfs_const.h \ 24 | %reldir%/unifyfs_configurator.h \ 25 | %reldir%/unifyfs_configurator.c \ 26 | %reldir%/unifyfs_keyval.h \ 27 | %reldir%/unifyfs_keyval.c \ 28 | %reldir%/unifyfs_log.h \ 29 | %reldir%/unifyfs_log.c \ 30 | %reldir%/unifyfs_logio.h \ 31 | %reldir%/unifyfs_logio.c \ 32 | %reldir%/unifyfs_meta.h \ 33 | %reldir%/unifyfs_meta.c \ 34 | %reldir%/unifyfs_misc.c \ 35 | %reldir%/unifyfs_misc.h \ 36 | %reldir%/unifyfs_rpc_util.h \ 37 | %reldir%/unifyfs_rpc_util.c \ 38 | %reldir%/unifyfs_rpc_types.h \ 39 | %reldir%/unifyfs_client_rpcs.h \ 40 | %reldir%/unifyfs_server_rpcs.h \ 41 | %reldir%/unifyfs_rc.h \ 42 | %reldir%/unifyfs_rc.c \ 43 | %reldir%/unifyfs_shm.h \ 44 | %reldir%/unifyfs_shm.c \ 45 | %reldir%/unifyfs-stack.h \ 46 | %reldir%/unifyfs-stack.c 47 | 48 | UNIFYFS_COMMON_BASE_FLAGS = \ 49 | -DSYSCONFDIR="$(sysconfdir)" \ 50 | $(MARGO_CFLAGS) $(OPENSSL_CFLAGS) 51 | 52 | UNIFYFS_COMMON_BASE_LIBS = \ 53 | $(MARGO_LDFLAGS) $(MARGO_LIBS) $(OPENSSL_LIBS) -lmercury_util \ 54 | -lm -lrt -lcrypto -lpthread 55 | 56 | UNIFYFS_COMMON_OPT_FLAGS = 57 | UNIFYFS_COMMON_OPT_LIBS = 58 | UNIFYFS_COMMON_OPT_SRCS = 59 | 60 | if USE_PMIX 61 | UNIFYFS_COMMON_OPT_FLAGS += -DUSE_PMIX 62 | UNIFYFS_COMMON_OPT_LIBS += -lpmix 63 | endif 64 | 65 | if USE_PMI2 66 | UNIFYFS_COMMON_OPT_FLAGS += -DUSE_PMI2 67 | UNIFYFS_COMMON_OPT_LIBS += -lpmi2 68 | endif 69 | 70 | UNIFYFS_COMMON_SRCS = \ 71 | $(UNIFYFS_COMMON_BASE_SRCS) \ 72 | $(UNIFYFS_COMMON_OPT_SRCS) 73 | 74 | UNIFYFS_COMMON_FLAGS = \ 75 | $(UNIFYFS_COMMON_BASE_FLAGS) \ 76 | $(UNIFYFS_COMMON_OPT_FLAGS) 77 | 78 | UNIFYFS_COMMON_LIBS = \ 79 | $(UNIFYFS_COMMON_BASE_LIBS) \ 80 | $(UNIFYFS_COMMON_OPT_LIBS) 81 | -------------------------------------------------------------------------------- /common/src/arraylist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * Copyright (c) 2017, Lawrence Livermore National Security, LLC. 17 | * Produced at the Lawrence Livermore National Laboratory. 18 | * Copyright (c) 2017, Florida State University. Contributions from 19 | * the Computer Architecture and Systems Research Laboratory (CASTL) 20 | * at the Department of Computer Science. 21 | * 22 | * Written by: Teng Wang, Adam Moody, Weikuan Yu, Kento Sato, Kathryn Mohror 23 | * LLNL-CODE-728877. All rights reserved. 24 | * 25 | * This file is part of burstfs. 26 | * For details, see https://github.com/llnl/burstfs 27 | * Please read https://github.com/llnl/burstfs/LICENSE for full license text. 28 | */ 29 | 30 | #ifndef ARRAYLIST_H 31 | #define ARRAYLIST_H 32 | 33 | #ifndef ARRAYLIST_CAPACITY 34 | # define ARRAYLIST_CAPACITY 1024 35 | #endif 36 | typedef struct { 37 | int cap; 38 | int size; 39 | void** elems; 40 | } arraylist_t; 41 | 42 | /* Create an arraylist with the given capacity. 43 | * If capacity == 0, use the default ARRAYLIST_CAPACITY. 44 | * Returns the new arraylist, or NULL on error. */ 45 | arraylist_t* arraylist_create(int capacity); 46 | 47 | /* Returns the arraylist capacity in elements, or -1 on error */ 48 | int arraylist_capacity(arraylist_t* arr); 49 | 50 | /* Returns the current arraylist size in elements, or -1 on error */ 51 | int arraylist_size(arraylist_t* arr); 52 | 53 | /* Reset the arraylist size to zero */ 54 | int arraylist_reset(arraylist_t* arr); 55 | 56 | /* Get the element at the given list index (pos)) */ 57 | void* arraylist_get(arraylist_t* arr, int pos); 58 | 59 | /* Remove the element at given list index (pos) and return it */ 60 | void* arraylist_remove(arraylist_t* arr, int pos); 61 | 62 | /* Free all arraylist elements, the array storage, and the arraylist_t. 63 | * Returns 0 on success, -1 on error */ 64 | int arraylist_free(arraylist_t* arr); 65 | 66 | /* Adds element to the end of the current list. 67 | * Returns list index of newly added element, or -1 on error */ 68 | int arraylist_add(arraylist_t* arr, void* elem); 69 | 70 | /* Insert the element at the given list index (pos) in the arraylist. 71 | * Overwrites (and frees) any existing element at that index. 72 | * Returns 0 on success, or -1 on error */ 73 | int arraylist_insert(arraylist_t* arr, int pos, void* elem); 74 | 75 | /* Sort the arraylist elements using the given comparison function (cmpfn). 76 | * Note that the comparison function should properly handle NULL pointer 77 | * elements of the array. 78 | * Return 0 on success, -1 on error */ 79 | int arraylist_sort(arraylist_t* arr, 80 | int (*cmpfn)(const void *, const void *)); 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /common/src/compare_fn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2023, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include "compare_fn.h" 16 | 17 | int int_compare_fn(const void* a, const void* b) 18 | { 19 | int ai = *(int*)a; 20 | int bi = *(int*)b; 21 | if (ai == bi) { 22 | return 0; 23 | } else if (ai > bi) { 24 | return 1; 25 | } else { 26 | return -1; 27 | } 28 | } 29 | 30 | int uint_compare_fn(const void* a, const void* b) 31 | { 32 | unsigned int ai = *(unsigned int*)a; 33 | unsigned int bi = *(unsigned int*)b; 34 | if (ai == bi) { 35 | return 0; 36 | } else if (ai > bi) { 37 | return 1; 38 | } else { 39 | return -1; 40 | } 41 | } 42 | 43 | int float_compare_fn(const void* a, const void* b) 44 | { 45 | float af = *(float*)a; 46 | float bf = *(float*)b; 47 | if (af == bf) { 48 | return 0; 49 | } else if (af > bf) { 50 | return 1; 51 | } else { 52 | return -1; 53 | } 54 | } 55 | 56 | int double_compare_fn(const void* a, const void* b) 57 | { 58 | double ad = *(double*)a; 59 | double bd = *(double*)b; 60 | if (ad == bd) { 61 | return 0; 62 | } else if (ad > bd) { 63 | return 1; 64 | } else { 65 | return -1; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /common/src/compare_fn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2023, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef COMPARE_FUNC_H 16 | #define COMPARE_FUNC_H 17 | 18 | typedef int (*compare_fn)(const void *, const void *); 19 | 20 | int int_compare_fn(const void* a, const void* b); 21 | int uint_compare_fn(const void* a, const void* b); 22 | 23 | int float_compare_fn(const void* a, const void* b); 24 | int double_compare_fn(const void* a, const void* b); 25 | 26 | #endif /* COMPARE_FN_H */ 27 | -------------------------------------------------------------------------------- /common/src/rm_enumerator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* Copyright (c) 2018 - Michael J. Brim 16 | * 17 | * Enumerator is part of https://github.com/MichaelBrim/tedium 18 | * 19 | * MIT License - See LICENSE.tedium 20 | */ 21 | 22 | #include "rm_enumerator.h" 23 | #include 24 | #include 25 | #include 26 | 27 | /* c-strings for enum names */ 28 | 29 | #define ENUMITEM(name, desc) \ 30 | const char *UNIFYFS_RM_ENUM_ ## name ## _NAME_STR = #name; 31 | UNIFYFS_RM_ENUMERATOR 32 | #undef ENUMITEM 33 | 34 | const char *unifyfs_rm_enum_str(unifyfs_rm_e e) 35 | { 36 | switch (e) { 37 | case UNIFYFS_RM_INVALID: 38 | return "UNIFYFS_RM_INVALID"; 39 | #define ENUMITEM(name, desc) \ 40 | case UNIFYFS_RM_ ## name: \ 41 | return UNIFYFS_RM_ENUM_ ## name ## _NAME_STR; 42 | UNIFYFS_RM_ENUMERATOR 43 | #undef ENUMITEM 44 | default : 45 | break; 46 | } 47 | return NULL; 48 | } 49 | 50 | /* c-strings for enum descriptions */ 51 | 52 | #define ENUMITEM(name, desc) \ 53 | const char *UNIFYFS_RM_ENUM_ ## name ## _DESC_STR = #desc; 54 | UNIFYFS_RM_ENUMERATOR 55 | #undef ENUMITEM 56 | 57 | const char *unifyfs_rm_enum_description(unifyfs_rm_e e) 58 | { 59 | switch (e) { 60 | case UNIFYFS_RM_INVALID: 61 | return "invalid unifyfs_rm_e value"; 62 | #define ENUMITEM(name, desc) \ 63 | case UNIFYFS_RM_ ## name: \ 64 | return UNIFYFS_RM_ENUM_ ## name ## _DESC_STR; 65 | UNIFYFS_RM_ENUMERATOR 66 | #undef ENUMITEM 67 | default : 68 | break; 69 | } 70 | return NULL; 71 | } 72 | 73 | unifyfs_rm_e unifyfs_rm_enum_from_str(const char *s) 74 | { 75 | if (0) 76 | ; 77 | #define ENUMITEM(name, desc) \ 78 | else if (strcmp(s, #name) == 0) \ 79 | return UNIFYFS_RM_ ## name; 80 | UNIFYFS_RM_ENUMERATOR; 81 | #undef ENUMITEM 82 | 83 | return UNIFYFS_RM_INVALID; 84 | } 85 | 86 | /* validity check */ 87 | 88 | int check_valid_unifyfs_rm_enum(unifyfs_rm_e e) 89 | { 90 | return ((e > UNIFYFS_RM_INVALID) && 91 | (e < UNIFYFS_RM_ENUM_MAX) && 92 | (unifyfs_rm_enum_str(e) != NULL)); 93 | } 94 | -------------------------------------------------------------------------------- /common/src/rm_enumerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* Copyright (c) 2018 - Michael J. Brim 16 | * 17 | * Enumerator is part of https://github.com/MichaelBrim/tedium 18 | * 19 | * MIT License - See LICENSE.tedium 20 | */ 21 | 22 | #ifndef _UNIFYFS_RM_ENUMERATOR_H_ 23 | #define _UNIFYFS_RM_ENUMERATOR_H_ 24 | 25 | /** 26 | * @brief enumerator list expanded many times with varied ENUMITEM() definitions 27 | * 28 | * @param item name 29 | * @param item short description 30 | */ 31 | #define UNIFYFS_RM_ENUMERATOR \ 32 | ENUMITEM(PBS, "Portable Batch System / TORQUE") \ 33 | ENUMITEM(SLURM, "SchedMD SLURM") \ 34 | ENUMITEM(LSF, "IBM Spectrum LSF") \ 35 | ENUMITEM(LSF_CSM, "IBM Spectrum LSF with Cluster System Management") \ 36 | ENUMITEM(FLUX, "Flux") \ 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | * @brief supported resource managers 44 | */ 45 | typedef enum { 46 | UNIFYFS_RM_INVALID = 0, 47 | #define ENUMITEM(name, desc) \ 48 | UNIFYFS_RM_ ## name, 49 | UNIFYFS_RM_ENUMERATOR 50 | #undef ENUMITEM 51 | UNIFYFS_RM_ENUM_MAX 52 | } unifyfs_rm_e; 53 | 54 | /** 55 | * @brief get resource manager C-string for given enum value 56 | */ 57 | const char *unifyfs_rm_enum_str(unifyfs_rm_e e); 58 | 59 | /** 60 | * @brief get resource manager description for given enum value 61 | */ 62 | const char *unifyfs_rm_enum_description(unifyfs_rm_e e); 63 | 64 | /** 65 | * @brief check validity of given resource manager enum value 66 | */ 67 | int check_valid_unifyfs_rm_enum(unifyfs_rm_e e); 68 | 69 | /** 70 | * @brief get resource manager enum value for given C-string 71 | */ 72 | unifyfs_rm_e unifyfs_rm_enum_from_str(const char *s); 73 | 74 | #ifdef __cplusplus 75 | } /* extern C */ 76 | #endif 77 | 78 | #endif /* UNIFYFS_RM_ENUMERATOR_H */ 79 | -------------------------------------------------------------------------------- /common/src/slotmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef SLOTMAP_H 16 | #define SLOTMAP_H 17 | 18 | #include // size_t, ssize_t 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* slot map, a simple structure that manages a bitmap of used/free slots */ 25 | typedef struct slot_map { 26 | size_t total_slots; 27 | size_t used_slots; 28 | ssize_t first_used_slot; 29 | ssize_t last_used_slot; 30 | } slot_map; 31 | 32 | /* The slot usage bitmap immediately follows the structure in memory. 33 | * The usage bitmap can be thought of as an uint8_t array, where 34 | * each uint8_t represents 8 slots. 35 | * uint8_t use_bitmap[total_slots/8] 36 | */ 37 | 38 | /** 39 | * Initialize a slot map within the given memory region, and return a pointer 40 | * to the slot_map structure. Returns NULL if the provided memory region is not 41 | * large enough to track the requested number of slots. 42 | * 43 | * @param num_slots number of slots to track 44 | * @param region_addr address of the memory region 45 | * @param region_sz size of the memory region 46 | * 47 | * @return valid slot_map pointer, or NULL on error 48 | */ 49 | slot_map* slotmap_init(size_t num_slots, 50 | void* region_addr, 51 | size_t region_sz); 52 | 53 | /** 54 | * Clear the given slot_map. Marks all slots free. 55 | * 56 | * @param smap valid slot_map pointer 57 | * 58 | * @return UNIFYFS_SUCCESS, or error code 59 | */ 60 | int slotmap_clear(slot_map* smap); 61 | 62 | /** 63 | * Reserve consecutive slots in the slot_map. 64 | * 65 | * @param smap valid slot_map pointer 66 | * @param num_slots number of slots to reserve 67 | * 68 | * @return starting slot index of reservation, or -1 on error 69 | */ 70 | ssize_t slotmap_reserve(slot_map* smap, 71 | size_t num_slots); 72 | 73 | /** 74 | * Release consecutive slots in the slot_map. 75 | * 76 | * @param smap valid slot_map pointer 77 | * @param start_index starting slot index 78 | * @param num_slots number of slots to release 79 | * 80 | * @return UNIFYFS_SUCCESS, or error code 81 | */ 82 | int slotmap_release(slot_map* smap, 83 | size_t start_index, 84 | size_t num_slots); 85 | 86 | /** 87 | * Print the slot_map (for debugging). 88 | * 89 | * @param smap valid slot_map pointer 90 | */ 91 | void slotmap_print(slot_map* smap); 92 | 93 | #ifdef __cplusplus 94 | } // extern "C" 95 | #endif 96 | 97 | #endif // UNIFYFS_BITMAP_H 98 | 99 | -------------------------------------------------------------------------------- /common/src/tinyexpr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TINYEXPR - Tiny recursive descent parser and evaluation engine in C 3 | * 4 | * Copyright (c) 2015-2018 Lewis Van Winkle 5 | * 6 | * http://CodePlea.com 7 | * 8 | * This software is provided 'as-is', without any express or implied 9 | * warranty. In no event will the authors be held liable for any damages 10 | * arising from the use of this software. 11 | * 12 | * Permission is granted to anyone to use this software for any purpose, 13 | * including commercial applications, and to alter it and redistribute it 14 | * freely, subject to the following restrictions: 15 | * 16 | * 1. The origin of this software must not be misrepresented; you must not 17 | * claim that you wrote the original software. If you use this software 18 | * in a product, an acknowledgement in the product documentation would be 19 | * appreciated but is not required. 20 | * 2. Altered source versions must be plainly marked as such, and must not be 21 | * misrepresented as being the original software. 22 | * 3. This notice may not be removed or altered from any source distribution. 23 | */ 24 | 25 | #ifndef __TINYEXPR_H__ 26 | #define __TINYEXPR_H__ 27 | 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | 34 | 35 | typedef struct te_expr { 36 | int type; 37 | union {double value; const double *bound; const void *function;}; 38 | void *parameters[]; 39 | } te_expr; 40 | 41 | 42 | enum { 43 | TE_VARIABLE = 0, 44 | 45 | TE_FUNCTION0 = 8, TE_FUNCTION1, TE_FUNCTION2, TE_FUNCTION3, 46 | TE_FUNCTION4, TE_FUNCTION5, TE_FUNCTION6, TE_FUNCTION7, 47 | 48 | TE_CLOSURE0 = 16, TE_CLOSURE1, TE_CLOSURE2, TE_CLOSURE3, 49 | TE_CLOSURE4, TE_CLOSURE5, TE_CLOSURE6, TE_CLOSURE7, 50 | 51 | TE_FLAG_PURE = 32 52 | }; 53 | 54 | typedef struct te_variable { 55 | const char *name; 56 | const void *address; 57 | int type; 58 | void *context; 59 | } te_variable; 60 | 61 | 62 | 63 | /* Parses the input expression, evaluates it, and frees it. */ 64 | /* Returns NaN on error. */ 65 | double te_interp(const char *expression, int *error); 66 | 67 | /* Parses the input expression and binds variables. */ 68 | /* Returns NULL on error. */ 69 | te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, int *error); 70 | 71 | /* Evaluates the expression. */ 72 | double te_eval(const te_expr *n); 73 | 74 | /* Prints debugging information on the syntax tree. */ 75 | void te_print(const te_expr *n); 76 | 77 | /* Frees the expression. */ 78 | /* This is safe to call on NULL pointers. */ 79 | void te_free(te_expr *n); 80 | 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif /*__TINYEXPR_H__*/ 87 | -------------------------------------------------------------------------------- /common/src/unifyfs-stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * Copyright (c) 2017, Lawrence Livermore National Security, LLC. 17 | * Produced at the Lawrence Livermore National Laboratory. 18 | * Copyright (c) 2017, Florida State University. Contributions from 19 | * the Computer Architecture and Systems Research Laboratory (CASTL) 20 | * at the Department of Computer Science. 21 | * 22 | * Written by: Teng Wang, Adam Moody, Weikuan Yu, Kento Sato, Kathryn Mohror 23 | * LLNL-CODE-728877. All rights reserved. 24 | * 25 | * This file is part of UnifyFS. 26 | * For details, see https://github.com/llnl/unifyfs 27 | * Please read https://github.com/llnl/unifyfs/LICENSE for full license text. 28 | */ 29 | 30 | /* 31 | * Copyright (c) 2013, Lawrence Livermore National Security, LLC. 32 | * Produced at the Lawrence Livermore National Laboratory. 33 | * code Written by 34 | * Raghunath Rajachandrasekar 35 | * Kathryn Mohror 36 | * Adam Moody 37 | * All rights reserved. 38 | * This file is part of UNIFYFS. 39 | * For details, see https://github.com/hpc/unifyfs 40 | * Please also read this file LICENSE.UNIFYFS 41 | */ 42 | 43 | #ifndef UNIFYFS_STACK_H 44 | #define UNIFYFS_STACK_H 45 | 46 | /* implements a fixed-size stack which stores integer values in range 47 | * of 0 to size-1, entire structure stored in an int array of size+2 48 | * int size 49 | * int last 50 | * int entries[size] 51 | * last records index within entries that points to item one past 52 | * the item at the top of the stack 53 | * 54 | * used to record which entries in a fixed-size array are free */ 55 | 56 | #include 57 | 58 | typedef struct { 59 | int size; 60 | int last; 61 | } unifyfs_stack; 62 | 63 | /* returns number of bytes needed to represent stack data structure */ 64 | size_t unifyfs_stack_bytes(int size); 65 | 66 | /* intializes stack to record all entries as being free */ 67 | void unifyfs_stack_init(void* start, int size); 68 | 69 | /* pops one entry from stack and returns its value */ 70 | int unifyfs_stack_pop(void* start); 71 | 72 | /* pushes item onto free stack */ 73 | void unifyfs_stack_push(void* start, int value); 74 | 75 | #endif /* UNIFYFS_STACK_H */ 76 | -------------------------------------------------------------------------------- /common/src/unifyfs_client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_CLIENT_H 16 | #define UNIFYFS_CLIENT_H 17 | 18 | #include "unifyfs_logio.h" 19 | #include "unifyfs_meta.h" 20 | #include "unifyfs_shm.h" 21 | 22 | 23 | /* client state used by both client library & server */ 24 | typedef struct client_state { 25 | /* mountpoint information */ 26 | char* mount_prefix; /* mountpoint prefix string */ 27 | size_t mount_prefixlen; /* strlen() of mount_prefix */ 28 | int app_id; /* application id (gfid for mountpoint) */ 29 | int client_id; /* client id within application */ 30 | bool is_mounted; /* is mountpoint active? */ 31 | 32 | /* application rank (for debugging) */ 33 | int app_rank; 34 | 35 | /* tracks current working directory within namespace */ 36 | char* cwd; 37 | 38 | /* has all the client's state (below) been initialized? */ 39 | bool initialized; 40 | 41 | /* log-based I/O context */ 42 | logio_context* logio_ctx; 43 | 44 | /* superblock - shared memory region for client metadata */ 45 | shm_context* shm_super_ctx; 46 | unifyfs_write_index write_index; 47 | 48 | } unifyfs_client_state; 49 | 50 | #endif /* UNIFYFS_CLIENT_H */ 51 | -------------------------------------------------------------------------------- /common/src/unifyfs_const.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * Copyright (c) 2017, Lawrence Livermore National Security, LLC. 17 | * Produced at the Lawrence Livermore National Laboratory. 18 | * Copyright (c) 2017, Florida State University. Contributions from 19 | * the Computer Architecture and Systems Research Laboratory (CASTL) 20 | * at the Department of Computer Science. 21 | * 22 | * Written by: Teng Wang, Adam Moody, Weikuan Yu, Kento Sato, Kathryn Mohror 23 | * LLNL-CODE-728877. All rights reserved. 24 | * 25 | * This file is part of burstfs. 26 | * For details, see https://github.com/llnl/burstfs 27 | * Please read https://github.com/llnl/burstfs/LICENSE for full license text. 28 | */ 29 | 30 | #ifndef UNIFYFS_CONST_H 31 | #define UNIFYFS_CONST_H 32 | 33 | /* --------------------- RETURN CODES --------------------- */ 34 | 35 | #include "unifyfs_rc.h" 36 | 37 | 38 | /* --------------------- INT CONSTANTS --------------------- */ 39 | 40 | // Byte counts 41 | #define KIB 1024 42 | #define MIB 1048576 43 | #define GIB 1073741824 44 | 45 | // General 46 | #define UNIFYFS_MAX_FILENAME KIB 47 | #define UNIFYFS_MAX_HOSTNAME 64 48 | 49 | // Client 50 | #define UNIFYFS_CLIENT_MAX_FILES 128 51 | #define UNIFYFS_CLIENT_STREAM_BUFSIZE MIB 52 | #define UNIFYFS_CLIENT_WRITE_INDEX_SIZE (20 * MIB) 53 | #define UNIFYFS_CLIENT_MAX_READ_COUNT 1000 /* max # active read requests */ 54 | #define UNIFYFS_CLIENT_READ_TIMEOUT_SECONDS 60 55 | #define UNIFYFS_CLIENT_MAX_ACTIVE_REQUESTS 256 /* max concurrent client reqs */ 56 | 57 | // Log-based I/O Default Values 58 | #define UNIFYFS_LOGIO_CHUNK_SIZE (4 * MIB) 59 | #define UNIFYFS_LOGIO_SHMEM_SIZE (256 * MIB) 60 | #define UNIFYFS_LOGIO_SPILL_SIZE (4 * GIB) 61 | 62 | // Margo Default Values 63 | #define UNIFYFS_MARGO_POOL_SZ 4 64 | #define UNIFYFS_MARGO_CLIENT_SERVER_TIMEOUT_MSEC 5000 /* 5.0 sec */ 65 | #define UNIFYFS_MARGO_SERVER_SERVER_TIMEOUT_MSEC 15000 /* 15.0 sec */ 66 | 67 | // Metadata Default Values 68 | #define UNIFYFS_META_DEFAULT_SLICE_SZ MIB /* data slice size for metadata */ 69 | 70 | // Server 71 | #define UNIFYFS_SERVER_MAX_BULK_TX_SIZE (8 * MIB) /* to-server transmit size */ 72 | #define UNIFYFS_SERVER_MAX_DATA_TX_SIZE (4 * MIB) /* to-client transmit size */ 73 | #define UNIFYFS_SERVER_MAX_NUM_APPS 64 /* max # apps/mountpoints supported */ 74 | #define UNIFYFS_SERVER_MAX_APP_CLIENTS 256 /* max # clients per application */ 75 | #define UNIFYFS_SERVER_MAX_READS 2048 /* max # server read reqs per reqmgr */ 76 | 77 | // Utilities 78 | #define UNIFYFS_DEFAULT_INIT_TIMEOUT 120 /* server init timeout (seconds) */ 79 | 80 | 81 | /* --------------------- STRING CONSTANTS --------------------- */ 82 | 83 | // Server 84 | #define UNIFYFS_SERVER_PID_FILENAME "unifyfsd.pids" 85 | 86 | // Utilities 87 | #define UNIFYFS_STAGE_STATUS_FILENAME "unifyfs-stage.status" 88 | 89 | 90 | #endif // UNIFYFS_CONST_H 91 | 92 | -------------------------------------------------------------------------------- /common/src/unifyfs_keyval.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_KEYVAL_H 16 | #define UNIFYFS_KEYVAL_H 17 | 18 | #include "unifyfs_configurator.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | extern int glb_pmi_rank; 25 | extern int glb_pmi_size; 26 | 27 | int unifyfs_pmix_init(void); 28 | int unifyfs_pmi2_init(void); 29 | 30 | // keys we use 31 | extern const char* const key_unifyfsd_socket; // server domain socket path 32 | extern const char* const key_unifyfsd_margo_shm; // client-server margo address 33 | extern const char* const key_unifyfsd_margo_svr; // server-server margo address 34 | 35 | // initialize key-value store 36 | int unifyfs_keyval_init(unifyfs_cfg_t* cfg, 37 | int* rank, 38 | int* nranks); 39 | 40 | // finalize key-value store 41 | int unifyfs_keyval_fini(void); 42 | 43 | // publish a key-value pair with local visibility 44 | int unifyfs_keyval_publish_local(const char* key, 45 | const char* val); 46 | 47 | // publish a key-value pair with remote visibility 48 | int unifyfs_keyval_publish_remote(const char* key, 49 | const char* val); 50 | 51 | // lookup a local key-value pair 52 | int unifyfs_keyval_lookup_local(const char* key, 53 | char** oval); 54 | 55 | // lookup a remote key-value pair 56 | int unifyfs_keyval_lookup_remote(int rank, 57 | const char* key, 58 | char** oval); 59 | 60 | // block until a particular key-value pair published by all servers 61 | int unifyfs_keyval_fence_remote(void); 62 | 63 | #ifdef __cplusplus 64 | } // extern "C" 65 | #endif 66 | 67 | #endif // UNIFYFS_KEYVAL_H 68 | -------------------------------------------------------------------------------- /common/src/unifyfs_meta.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "unifyfs_meta.h" 21 | 22 | /* extent slice size used for metadata */ 23 | size_t meta_slice_sz = UNIFYFS_META_DEFAULT_SLICE_SZ; 24 | 25 | /* calculate number of slices in an extent given by start offset and length */ 26 | size_t meta_num_slices(size_t offset, size_t length) 27 | { 28 | size_t start = offset / meta_slice_sz; 29 | size_t end = (offset + length - 1) / meta_slice_sz; 30 | size_t count = end - start + 1; 31 | return count; 32 | } 33 | 34 | /** 35 | * Hash a file path to a 64-bit unsigned integer using MD5 36 | * @param path absolute file path 37 | * @return hash value 38 | */ 39 | uint64_t compute_path_md5(const char* path) 40 | { 41 | unsigned long len; 42 | unsigned char digested[16] = {0}; 43 | unsigned int digestSize; 44 | /* digestSize is set by EVP_Digest(). For MD5 digests, it should always 45 | * be 16. */ 46 | 47 | len = strlen(path); 48 | EVP_Digest(path, len, digested, &digestSize, EVP_md5(), NULL); 49 | assert(digestSize == 16); 50 | 51 | /* construct uint64_t hash from first 8 digest bytes */ 52 | uint64_t* digest_value = (uint64_t*) digested; 53 | uint64_t hash = be64toh(*digest_value); 54 | return hash; 55 | } 56 | -------------------------------------------------------------------------------- /common/src/unifyfs_misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2022, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * This file contains miscellaneous common functions that don't fit into a 17 | * particular common/src/ file. 18 | */ 19 | #include 20 | #include 21 | #include 22 | 23 | #include "unifyfs_misc.h" 24 | 25 | /* 26 | * Implementation of BSD's strlcpy() function. 27 | * 28 | * This is a basically a safer version of strlncpy() since it always 29 | * NULL-terminates the buffer. Google 'strlcpy' for full documentation. 30 | */ 31 | size_t strlcpy(char* dest, const char* src, size_t size) 32 | { 33 | size_t src_len; 34 | 35 | src_len = strnlen(src, size); 36 | if (src_len == size) { 37 | /* Our string is too long, have to truncate */ 38 | src_len = size - 1; 39 | } 40 | 41 | memcpy(dest, src, src_len); 42 | dest[src_len] = '\0'; 43 | 44 | return strlen(dest); 45 | } 46 | 47 | /* 48 | * Implementation of the Linux kernel's scnprintf() function. 49 | * 50 | * It's snprintf() but returns the number of chars actually written into buf[] 51 | * not including the '\0'. It also avoids the -Wformat-truncation warnings. 52 | */ 53 | int scnprintf(char* buf, size_t size, const char* fmt, ...) 54 | { 55 | va_list args; 56 | int rc; 57 | 58 | va_start(args, fmt); 59 | rc = vsnprintf(buf, size, fmt, args); 60 | va_end(args); 61 | 62 | if (rc >= size) { 63 | /* We truncated */ 64 | return size - 1; 65 | } 66 | 67 | return rc; 68 | } 69 | 70 | 71 | /* Calculate timestamp difference in seconds */ 72 | double timediff_sec(struct timeval* before, struct timeval* after) 73 | { 74 | double diff; 75 | if (!before || !after) { 76 | return -1.0F; 77 | } 78 | diff = (double)(after->tv_sec - before->tv_sec); 79 | diff += 0.000001 * ((double)(after->tv_usec) - (double)(before->tv_usec)); 80 | return diff; 81 | } 82 | -------------------------------------------------------------------------------- /common/src/unifyfs_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2022, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_MISC_H 16 | #define UNIFYFS_MISC_H 17 | 18 | #include 19 | 20 | /* Implementation of BSD's strlcpy() function. */ 21 | size_t strlcpy(char* dest, const char* src, size_t size); 22 | 23 | /* Version of snprintf() that returns the actual number of characters 24 | * written into the buffer, not including the trailing NUL character */ 25 | int scnprintf(char* buf, size_t size, const char* fmt, ...); 26 | 27 | /* Calculate timestamp difference in seconds */ 28 | double timediff_sec(struct timeval* before, struct timeval* after); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /common/src/unifyfs_rc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* Copyright (c) 2018 - Michael J. Brim 16 | * 17 | * Enumerator is part of https://github.com/MichaelBrim/tedium 18 | * 19 | * MIT License - See LICENSE.tedium 20 | */ 21 | 22 | #ifndef _UNIFYFS_RC_ENUMERATOR_H_ 23 | #define _UNIFYFS_RC_ENUMERATOR_H_ 24 | 25 | #include 26 | 27 | /* #define __ELASTERROR if our errno.h doesn't define it for us */ 28 | #ifndef __ELASTERROR 29 | #define __ELASTERROR 1000 30 | #endif 31 | 32 | /* NOTE: If POSIX errno.h defines an error code that we can use sensibly, 33 | * don't create a duplicate one for UnifyFS */ 34 | 35 | /** 36 | * @brief enumerator list expanded many times with varied ENUMITEM() definitions 37 | * 38 | * @param item name 39 | * @param item short description 40 | */ 41 | #define UNIFYFS_ERROR_ENUMERATOR \ 42 | ENUMITEM(BADCONFIG, "Configuration has invalid setting") \ 43 | ENUMITEM(GOTCHA, "Gotcha operation error") \ 44 | ENUMITEM(KEYVAL, "Key-value store operation error") \ 45 | ENUMITEM(MARGO, "Mercury/Argobots operation error") \ 46 | ENUMITEM(NYI, "Not yet implemented") \ 47 | ENUMITEM(PMI, "PMI2/PMIx error") \ 48 | ENUMITEM(SHMEM, "Shared memory region init/access error") \ 49 | ENUMITEM(THREAD, "POSIX thread operation failed") \ 50 | ENUMITEM(TIMEOUT, "Timed out") \ 51 | 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | 58 | /** 59 | * @brief enum for UnifyFS return codes 60 | */ 61 | typedef enum { 62 | UNIFYFS_INVALID_RC = -2, 63 | UNIFYFS_FAILURE = -1, 64 | UNIFYFS_SUCCESS = 0, 65 | /* Start our error numbers after the standard errno.h ones */ 66 | UNIFYFS_BEGIN_ERRORS = __ELASTERROR, 67 | #define ENUMITEM(name, desc) \ 68 | UNIFYFS_ERROR_ ## name, 69 | UNIFYFS_ERROR_ENUMERATOR 70 | #undef ENUMITEM 71 | UNIFYFS_END_ERRORS 72 | } unifyfs_rc; 73 | 74 | /** 75 | * @brief get C-string for given error enum value 76 | */ 77 | const char* unifyfs_rc_enum_str(unifyfs_rc rc); 78 | 79 | /** 80 | * @brief get description for given error enum value 81 | */ 82 | const char* unifyfs_rc_enum_description(unifyfs_rc rc); 83 | 84 | /** 85 | * @brief check validity of given error enum value 86 | */ 87 | int check_valid_unifyfs_rc_enum(unifyfs_rc rc); 88 | 89 | /** 90 | * @brief get enum value for given error C-string 91 | */ 92 | unifyfs_rc unifyfs_rc_enum_from_str(const char* s); 93 | 94 | /** 95 | * @brief convert a UnifyFS error to an errno value 96 | */ 97 | int unifyfs_rc_errno(unifyfs_rc rc); 98 | 99 | #ifdef __cplusplus 100 | } /* extern C */ 101 | #endif 102 | 103 | #endif /* UNIFYFS_RC_ENUMERATOR_H */ 104 | -------------------------------------------------------------------------------- /common/src/unifyfs_rpc_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef __UNIFYFS_RPC_TYPES_H 16 | #define __UNIFYFS_RPC_TYPES_H 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "unifyfs_meta.h" 23 | 24 | /* rpc encode/decode for timespec structs */ 25 | typedef struct timespec sys_timespec_t; 26 | MERCURY_GEN_STRUCT_PROC(sys_timespec_t, 27 | ((uint64_t)(tv_sec)) 28 | ((uint64_t)(tv_nsec)) 29 | ) 30 | 31 | /* rpc encode/decode for unifyfs_file_attr_t */ 32 | MERCURY_GEN_STRUCT_PROC(unifyfs_file_attr_t, 33 | ((int32_t)(gfid)) 34 | ((int32_t)(is_laminated)) 35 | ((int32_t)(is_shared)) 36 | ((uint32_t)(mode)) 37 | ((uint32_t)(uid)) 38 | ((uint32_t)(gid)) 39 | ((hg_size_t)(size)) 40 | ((sys_timespec_t)(atime)) 41 | ((sys_timespec_t)(ctime)) 42 | ((sys_timespec_t)(mtime)) 43 | ((hg_const_string_t)(filename)) 44 | ) 45 | 46 | #endif /* __UNIFYFS_RPC_TYPES_H */ 47 | -------------------------------------------------------------------------------- /common/src/unifyfs_rpc_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_UTIL_H 16 | #define UNIFYFS_UTIL_H 17 | 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* publish the address of the server */ 25 | void rpc_publish_local_server_addr(const char* addr); 26 | void rpc_publish_remote_server_addr(const char* addr); 27 | 28 | /* lookup address of server */ 29 | char* rpc_lookup_local_server_addr(void); 30 | char* rpc_lookup_remote_server_addr(int srv_rank); 31 | 32 | /* remove server rpc address file */ 33 | void rpc_clean_local_server_addr(void); 34 | 35 | /* use passed bulk handle to pull data into a newly allocated buffer. 36 | * returns buffer, or NULL on failure. */ 37 | void* pull_margo_bulk_buffer(hg_handle_t rpc_hdl, 38 | hg_bulk_t bulk_in, 39 | hg_size_t bulk_sz, 40 | hg_bulk_t* local_bulk); 41 | 42 | #ifdef __cplusplus 43 | } // extern "C" 44 | #endif 45 | 46 | #endif // UNIFYFS_UTIL_H 47 | 48 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /docs/_static/theme_overrides.css: -------------------------------------------------------------------------------- 1 | /* override table width restrictions */ 2 | 3 | .wy-table-responsive table td, .wy-table-responsive table th { 4 | white-space: normal !important; 5 | } 6 | .wy-table-responsive { 7 | margin-bottom: 24px; 8 | max-width: 100%; 9 | overflow: auto !important; 10 | } 11 | 12 | /* wide table scroll-bar */ 13 | 14 | table.scrollwide { 15 | display: block; 16 | width: 700px; 17 | background-color: #E0; 18 | overflow: scroll; !important 19 | } 20 | table.scrollwide td { 21 | white-space: nowrap; 22 | } 23 | 24 | /* override navigation sidebar out-of-view on page scrolling */ 25 | 26 | .wy-nav-side { 27 | position: fixed; 28 | padding-bottom: 2em; 29 | width: 300px; 30 | overflow-x: hidden; 31 | overflow-y: scroll; 32 | min-height: 100%; 33 | background: #343131; 34 | z-index: 200; 35 | } 36 | 37 | /* changed side navigation bg colors */ 38 | .wy-side-nav-search { 39 | background: #222c32 !important; 40 | } 41 | 42 | .wy-nav-side { 43 | background: #222c32; 44 | } 45 | 46 | .rst-versions{ 47 | border-top:solid 10px #222c32; 48 | } 49 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/__init__.py: -------------------------------------------------------------------------------- 1 | """Sphinx ReadTheDocs theme. 2 | 3 | From https://github.com/ryan-roemer/sphinx-bootstrap-theme. 4 | 5 | """ 6 | import os 7 | 8 | __version__ = '0.2.5b1' 9 | __version_full__ = __version__ 10 | 11 | 12 | def get_html_theme_path(): 13 | """Return list of HTML theme paths.""" 14 | cur_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 15 | return cur_dir 16 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/__init__.pyc -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/footer.html: -------------------------------------------------------------------------------- 1 |
2 | {% if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons_location == 'both') and (next or prev) %} 3 | 11 | {% endif %} 12 | 13 |
14 | 15 |
16 |

17 | {%- if show_copyright %} 18 | {%- if hasdoc('copyright') %} 19 | {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} 20 | {%- else %} 21 | {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} 22 | {%- endif %} 23 | {%- endif %} 24 | 25 | {%- if build_id and build_url %} 26 | {% trans build_url=build_url, build_id=build_id %} 27 | 28 | Build 29 | {{ build_id }}. 30 | 31 | {% endtrans %} 32 | {%- elif commit %} 33 | {% trans commit=commit %} 34 | 35 | Revision {{ commit }}. 36 | 37 | {% endtrans %} 38 | {%- elif last_updated %} 39 | {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} 40 | {%- endif %} 41 | 42 |

43 |
44 | 45 | {%- if show_sphinx %} 46 | {% trans %}Built with Sphinx using a theme provided by Read the Docs{% endtrans %}. 47 | {%- endif %} 48 | 49 | {%- block extrafooter %} {% endblock %} 50 | 51 |
52 | 53 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/search.html: -------------------------------------------------------------------------------- 1 | {# 2 | basic/search.html 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | Template for the search page. 6 | 7 | :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | #} 10 | {%- extends "layout.html" %} 11 | {% set title = _('Search') %} 12 | {% set script_files = script_files + ['_static/searchtools.js'] %} 13 | {% block footer %} 14 | 17 | {# this is used when loading the search index using $.ajax fails, 18 | such as on Chrome for documents on localhost #} 19 | 20 | {{ super() }} 21 | {% endblock %} 22 | {% block body %} 23 | 31 | 32 | {% if search_performed %} 33 |

{{ _('Search Results') }}

34 | {% if not search_results %} 35 |

{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}

36 | {% endif %} 37 | {% endif %} 38 |
39 | {% if search_results %} 40 |
    41 | {% for href, caption, context in search_results %} 42 |
  • 43 | {{ caption }} 44 |

    {{ context|e }}

    45 |
  • 46 | {% endfor %} 47 |
48 | {% endif %} 49 |
50 | {% endblock %} 51 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/searchbox.html: -------------------------------------------------------------------------------- 1 | {%- if builder != 'singlehtml' %} 2 |
3 |
4 | 5 | 6 | 7 |
8 |
9 | {%- endif %} 10 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} 2 | /*# sourceMappingURL=badge_only.css.map */ 3 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Inconsolata-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Inconsolata-Bold.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Lato-Bold.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/RobotoSlab-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/RobotoSlab-Bold.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/RobotoSlab-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/RobotoSlab-Regular.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = css/theme.css 4 | 5 | [options] 6 | typekit_id = hiw1hhg 7 | analytics_id = 8 | sticky_navigation = False 9 | logo_only = 10 | collapse_navigation = False 11 | display_version = True 12 | navigation_depth = 4 13 | prev_next_buttons_location = bottom 14 | canonical_url = 15 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme2/sphinx_rtd_theme/versions.html: -------------------------------------------------------------------------------- 1 | {% if READTHEDOCS %} 2 | {# Add rst-badge after rst-versions for small badge style. #} 3 |
4 | 5 | Read the Docs 6 | v: {{ current_version }} 7 | 8 | 9 |
10 |
11 |
{{ _('Versions') }}
12 | {% for slug, url in versions %} 13 |
{{ slug }}
14 | {% endfor %} 15 |
16 |
17 |
{{ _('Downloads') }}
18 | {% for type, url in downloads %} 19 |
{{ type }}
20 | {% endfor %} 21 |
22 |
23 |
{{ _('On Read the Docs') }}
24 |
25 | {{ _('Project Home') }} 26 |
27 |
28 | {{ _('Builds') }} 29 |
30 |
31 |
32 | {% trans %}Free document hosting provided by Read the Docs.{% endtrans %} 33 | 34 |
35 |
36 | {% endif %} 37 | 38 | -------------------------------------------------------------------------------- /docs/definitions.rst: -------------------------------------------------------------------------------- 1 | ================ 2 | Definitions 3 | ================ 4 | 5 | This section defines some terms used throughout the document. 6 | 7 | --------------------------- 8 | Job 9 | --------------------------- 10 | 11 | A set of commands that is issued to the resource manager and is allocated a set 12 | of nodes for some duration 13 | 14 | --------------------------- 15 | Run or Job Step 16 | --------------------------- 17 | 18 | A single application launch of a group of one or more application processes 19 | issued within a job 20 | -------------------------------------------------------------------------------- /docs/dependencies.rst: -------------------------------------------------------------------------------- 1 | ==================== 2 | UnifyFS Dependencies 3 | ==================== 4 | 5 | -------- 6 | Required 7 | -------- 8 | 9 | - `Automake `_ version 1.15 (or later) 10 | 11 | - `GOTCHA `_ version 1.0.4 (or later) 12 | 13 | - `Margo `_ version 0.13.1 and its dependencies: 14 | 15 | - `Argobots `_ version 1.1 (or later) 16 | - `Mercury `_ version 2.2.0 (or later) 17 | 18 | - `libfabric `_ (avoid versions 1.13 and 1.13.1) or `bmi `_ 19 | 20 | - `JSON-C `_ 21 | 22 | - `OpenSSL `_ 23 | 24 | .. important:: 25 | 26 | Margo uses pkg-config to ensure it compiles and links correctly with all of 27 | its dependencies' libraries. When building manually, you'll need to set the 28 | ``PKG_CONFIG_PATH`` environment variable to include the paths of the 29 | directories containing the ``.pc`` files for Margo, Mercury, Argobots, and OpenSSL. 30 | 31 | -------- 32 | Optional 33 | -------- 34 | 35 | - `spath `_ for normalizing relative paths 36 | 37 | ---------- 38 | 39 | =================== 40 | UnifyFS Error Codes 41 | =================== 42 | 43 | Wherever sensible, UnifyFS uses the error codes defined in POSIX `errno.h 44 | `_. 45 | 46 | UnifyFS specific error codes are defined as follows: 47 | 48 | .. table:: 49 | :widths: auto 50 | 51 | ===== ========= ====================================== 52 | Value Error Description 53 | ===== ========= ====================================== 54 | 1001 BADCONFIG Configuration has invalid setting 55 | 1002 GOTCHA Gotcha operation error 56 | 1003 KEYVAL Key-value store operation error 57 | 1004 MARGO Mercury/Argobots operation error 58 | 1005 NYI Not yet implemented 59 | 1006 PMI PMI2/PMIx error 60 | 1007 SHMEM Shared memory region init/access error 61 | 1008 THREAD POSIX thread operation failed 62 | 1009 TIMEOUT Operation timed out 63 | ===== ========= ====================================== 64 | -------------------------------------------------------------------------------- /docs/images/UnifyFS-developers-documentation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/images/UnifyFS-developers-documentation.png -------------------------------------------------------------------------------- /docs/images/UnifyFS-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/images/UnifyFS-logo.png -------------------------------------------------------------------------------- /docs/images/UnifyFS-logo_sml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/images/UnifyFS-logo_sml.png -------------------------------------------------------------------------------- /docs/images/UnifyFS-tutorial-May2022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/images/UnifyFS-tutorial-May2022.png -------------------------------------------------------------------------------- /docs/images/design-high-lvl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/images/design-high-lvl.png -------------------------------------------------------------------------------- /docs/images/tap-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/images/tap-output.png -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. unifyfs documentation master file, created by 2 | sphinx-quickstart on Sun Nov 26 20:15:18 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | ===================================================== 7 | UnifyFS: A User-Level File System for Supercomputers 8 | ===================================================== 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | :caption: User Guide 13 | 14 | overview 15 | definitions 16 | assumptions 17 | limitations 18 | build 19 | api 20 | link 21 | configuration 22 | run 23 | 24 | .. toctree:: 25 | :maxdepth: 2 26 | :caption: Reference 27 | 28 | examples 29 | library_api 30 | dependencies 31 | verifyio 32 | 33 | .. toctree:: 34 | :maxdepth: 2 35 | :caption: Contributing 36 | 37 | contribute-ways 38 | style-guides 39 | testing 40 | wrappers 41 | add-rpcs 42 | 43 | ================== 44 | Indices and tables 45 | ================== 46 | 47 | * :ref:`genindex` 48 | * :ref:`modindex` 49 | * :ref:`search` 50 | 51 | -------------------------------------------------------------------------------- /docs/requirements.in: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx_rtd_theme 3 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This file is autogenerated by pip-compile with Python 3.12 3 | # by the following command: 4 | # 5 | # pip-compile --output-file=docs/requirements.txt --strip-extras docs/requirements.in 6 | # 7 | alabaster==0.7.13 8 | # via sphinx 9 | babel==2.14.0 10 | # via sphinx 11 | certifi==2023.11.17 12 | # via requests 13 | charset-normalizer==3.3.2 14 | # via requests 15 | docutils==0.20.1 16 | # via 17 | # sphinx 18 | # sphinx-rtd-theme 19 | idna==3.6 20 | # via requests 21 | imagesize==1.4.1 22 | # via sphinx 23 | jinja2==3.1.2 24 | # via sphinx 25 | markupsafe==2.1.3 26 | # via jinja2 27 | packaging==23.2 28 | # via sphinx 29 | pygments==2.17.2 30 | # via sphinx 31 | requests==2.31.0 32 | # via sphinx 33 | snowballstemmer==2.2.0 34 | # via sphinx 35 | sphinx==7.2.6 36 | # via 37 | # -r docs/requirements.in 38 | # sphinx-rtd-theme 39 | # sphinxcontrib-applehelp 40 | # sphinxcontrib-devhelp 41 | # sphinxcontrib-htmlhelp 42 | # sphinxcontrib-jquery 43 | # sphinxcontrib-qthelp 44 | # sphinxcontrib-serializinghtml 45 | sphinx-rtd-theme==2.0.0 46 | # via -r docs/requirements.in 47 | sphinxcontrib-applehelp==1.0.7 48 | # via sphinx 49 | sphinxcontrib-devhelp==1.0.5 50 | # via sphinx 51 | sphinxcontrib-htmlhelp==2.0.4 52 | # via sphinx 53 | sphinxcontrib-jquery==4.1 54 | # via sphinx-rtd-theme 55 | sphinxcontrib-jsmath==1.0.1 56 | # via sphinx 57 | sphinxcontrib-qthelp==1.0.6 58 | # via sphinx 59 | sphinxcontrib-serializinghtml==1.1.9 60 | # via sphinx 61 | urllib3==2.1.0 62 | # via requests 63 | 64 | # The following packages are considered to be unsafe in a requirements file: 65 | # setuptools 66 | -------------------------------------------------------------------------------- /docs/slides/UnifyFS-developers-documentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/slides/UnifyFS-developers-documentation.pdf -------------------------------------------------------------------------------- /docs/slides/UnifyFS-tutorial-May2022.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/docs/slides/UnifyFS-tutorial-May2022.pdf -------------------------------------------------------------------------------- /docs/style-guides.rst: -------------------------------------------------------------------------------- 1 | ************ 2 | Style Guides 3 | ************ 4 | 5 | Coding Conventions 6 | ================== 7 | 8 | UnifyFS follows the `Linux kernel coding style 9 | `_ except 10 | that code is indented using four spaces per level instead of tabs. Please run 11 | ``make checkstyle`` to check your patch for style problems before submitting it 12 | for review. 13 | 14 | Styling Code 15 | ------------ 16 | 17 | The astyle tool can be used to apply much of the required code styling used in 18 | the project. 19 | 20 | .. code-block:: Bash 21 | :caption: To apply style to the source file foo.c: 22 | 23 | astyle --options=scripts/unifyfs.astyle foo.c 24 | 25 | The `unifyfs.astyle file 26 | `_ specifies 27 | the options used for this project. For a full list of available astyle options, 28 | see http://astyle.sourceforge.net/astyle.html. 29 | 30 | .. _style-check-label: 31 | 32 | Verifying Style Checks 33 | ---------------------- 34 | 35 | To check that uncommitted changes meet the coding style, use the following 36 | command: 37 | 38 | .. code-block:: Bash 39 | 40 | git diff | ./scripts/checkpatch.sh 41 | 42 | .. tip:: 43 | 44 | This command will only check specific changes and additions to files that 45 | are already tracked by git. Run the command ``git add -N 46 | [...]`` first in order to style check new files as well. 47 | 48 | ------------ 49 | 50 | .. _commit-message-label: 51 | 52 | Commit Message Format 53 | ===================== 54 | 55 | Commit messages for new changes must meet the following guidelines: 56 | 57 | - In 50 characters or less, provide a summary of the change as the first line 58 | in the commit message. 59 | - A body which provides a description of the change. If necessary, please 60 | summarize important information such as why the proposed approach was chosen 61 | or a brief description of the bug you are resolving. Each line of the body 62 | must be 72 characters or less. 63 | 64 | An example commit message for new changes is provided below. 65 | 66 | .. code-block:: none 67 | 68 | Capitalized, short (50 chars or less) summary 69 | 70 | More detailed explanatory text, if necessary. Wrap it to about 72 71 | characters or so. In some contexts, the first line is treated as the 72 | subject of an email and the rest of the text as the body. The blank 73 | line separating the summary from the body is critical (unless you omit 74 | the body entirely); tools like rebase can get confused if you run the 75 | two together. 76 | 77 | Write your commit message in the imperative: "Fix bug" and not "Fixed bug" 78 | or "Fixes bug." This convention matches up with commit messages generated 79 | by commands like git merge and git revert. 80 | 81 | Further paragraphs come after blank lines. 82 | 83 | - Bullet points are okay 84 | 85 | - Typically a hyphen or asterisk is used for the bullet, followed by a 86 | single space, with blank lines in between, but conventions vary here 87 | 88 | - Use a hanging indent 89 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Our [Examples](https://unifyfs.readthedocs.io/en/dev/examples.html) 4 | documentation has information on how to run the UnifyFS example programs in 5 | `/src`. 6 | -------------------------------------------------------------------------------- /examples/src/Makefile.examples.in: -------------------------------------------------------------------------------- 1 | UNIFYFS_INSTALL = @prefix@ 2 | 3 | MPICC ?= mpicc 4 | 5 | UNIFYFS_CFG = $(UNIFYFS_INSTALL)/bin/unifyfs-config 6 | UNIFYFS_PKGCFG = PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(UNIFYFS_INSTALL)/lib/pkgconfig pkg-config 7 | 8 | GOTCHA_PROGRAMS = \ 9 | app-btio-gotcha \ 10 | app-mpiio-gotcha \ 11 | app-tileio-gotcha \ 12 | checkpoint-restart-gotcha \ 13 | multi-write-gotcha \ 14 | read-gotcha \ 15 | read-data-gotcha \ 16 | simul-gotcha \ 17 | transfer-gotcha \ 18 | write-gotcha \ 19 | writeread-gotcha \ 20 | write-transfer-gotcha 21 | 22 | STATIC_PROGRAMS += \ 23 | app-btio-static \ 24 | app-mpiio-static \ 25 | app-tileio-static \ 26 | checkpoint-restart-static \ 27 | multi-write-static \ 28 | read-static \ 29 | read-data-static \ 30 | simul-static \ 31 | transfer-static \ 32 | write-static \ 33 | writeread-static \ 34 | write-transfer-static 35 | 36 | LIBS += -lm -lrt 37 | 38 | .PHONY: default all clean gotcha static 39 | 40 | default: all 41 | 42 | all: gotcha static 43 | 44 | clean: 45 | $(RM) *.o 46 | $(RM) $(GOTCHA_PROGRAMS) 47 | $(RM) $(STATIC_PROGRAMS) 48 | 49 | gotcha: $(GOTCHA_PROGRAMS) 50 | 51 | static: $(STATIC_PROGRAMS) 52 | 53 | testutil.o: testutil.c 54 | $(MPICC) $(CPPFLAGS) $(CFLAGS) `$(UNIFYFS_PKGCFG) --cflags unifyfs-api` -c -o testutil.o testutil.c 55 | 56 | %-gotcha: %.c testutil.o 57 | $(MPICC) $(CPPFLAGS) $(CFLAGS) `$(UNIFYFS_PKGCFG) --cflags unifyfs-api` -c -o $<.o $< 58 | $(MPICC) -o $@ $<.o testutil.o $(LDFLAGS) `$(UNIFYFS_PKGCFG) --libs unifyfs` $(LIBS) 59 | 60 | %-static: %.c testutil.o 61 | $(MPICC) $(CPPFLAGS) $(CFLAGS) `$(UNIFYFS_PKGCFG) --cflags unifyfs-static` -c -o $<.o $< 62 | $(MPICC) $(LDFLAGS) `$(UNIFYFS_PKGCFG) --libs-only-L unifyfs-static` -o $@ $<.o testutil.o `$(UNIFYFS_PKGCFG) --libs-only-other --libs-only-l unifyfs-static` $(LIBS) 63 | -------------------------------------------------------------------------------- /examples/src/chmod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * Test chmod() and fchmod() 17 | * 18 | * Test description: 19 | * 1. Make an empty file. 20 | * 2. Try setting all the permission bits 21 | * 3. Verify you see the bits in stat() 22 | * 4. Use chmod() to remove the write bits to laminate it 23 | * 5. Check file is laminated after 24 | * 6. Make another empty file 25 | * 7. Laminate it using fchmod() 26 | * 8. Check file is laminated after 27 | */ 28 | 29 | #include "testutil.h" 30 | 31 | int do_test(test_cfg* cfg) 32 | { 33 | char* file; 34 | int rank = cfg->rank; 35 | int fd; 36 | 37 | file = mktemp_cmd(cfg, "/unifyfs"); 38 | if (NULL == file) { 39 | return ENOMEM; 40 | } 41 | 42 | test_print(cfg, "Create empty file %s", file); 43 | test_print(cfg, "Before lamination stat() is:"); 44 | stat_cmd(cfg, file); 45 | 46 | test_print(cfg, "Try setting all the bits. stat() is:"); 47 | chmod(file, 0777); 48 | stat_cmd(cfg, file); 49 | 50 | if (rank == cfg->n_ranks - 1) { 51 | test_print(cfg, "I'm the last rank, so I'll laminate the file"); 52 | 53 | sync_cmd(cfg, file); 54 | /* laminate by setting permissions to read-only */ 55 | chmod(file, 0444); 56 | 57 | test_print(cfg, "After lamination stat() is:"); 58 | stat_cmd(cfg, file); 59 | } 60 | free(file); 61 | 62 | /* Do the same thing as before, but use fchmod() */ 63 | file = mktemp_cmd(cfg, "/unifyfs"); 64 | test_print(cfg, "Create empty file %s", file); 65 | test_print(cfg, "Before lamination stat() is:"); 66 | stat_cmd(cfg, file); 67 | if (rank == cfg->n_ranks - 1) { 68 | test_print(cfg, "I'm the last rank, so I'll fchmod laminate the file"); 69 | 70 | fd = open(file, O_RDWR); 71 | /* laminate by removing write bits */ 72 | fchmod(fd, 0444); /* set to read-only */ 73 | close(fd); 74 | 75 | test_print(cfg, "After lamination stat() is:"); 76 | stat_cmd(cfg, file); 77 | test_print(cfg, "Verifying that writes to the laminated file fail"); 78 | dd_cmd(cfg, "/dev/zero", file, 1024, 1, 0); 79 | } 80 | free(file); 81 | } 82 | 83 | int main(int argc, char* argv[]) 84 | { 85 | test_cfg test_config; 86 | test_cfg* cfg = &test_config; 87 | int rc; 88 | 89 | rc = test_init(argc, argv, cfg); 90 | if (rc) { 91 | test_print(cfg, "ERROR - Test %s initialization failed!", argv[0]); 92 | fflush(NULL); 93 | return rc; 94 | } 95 | 96 | rc = do_test(cfg); 97 | if (rc) { 98 | test_print(cfg, "ERROR - Test %s failed! rc=%d", argv[0], rc); 99 | fflush(NULL); 100 | } 101 | 102 | test_fini(cfg); 103 | 104 | return rc; 105 | } 106 | -------------------------------------------------------------------------------- /examples/src/size.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * Test file size functions 17 | * 18 | * Test description: 19 | * 1. For each rank, write 1KB at a 1KB * rank offset. 20 | * 2. Check the file size. It should be 0 since it hasn't been laminated. 21 | * 3. Have the last rank laminate the file. 22 | * 4. Check the file size again. It should be the real, laminated, file size. 23 | */ 24 | 25 | #include "testutil.h" 26 | 27 | int do_test(test_cfg* cfg) 28 | { 29 | char* file; 30 | int rank = cfg->rank; 31 | 32 | file = mktemp_cmd(cfg, "/unifyfs"); 33 | if (NULL == file) { 34 | return ENOMEM; 35 | } 36 | 37 | test_print(cfg, "I'm writing 1 KiB to %s at my offset at %ld", 38 | file, rank * 1024); 39 | dd_cmd(cfg, "/dev/zero", file, 1024, 1, rank); 40 | 41 | test_print(cfg, "Stating the file"); 42 | stat_cmd(cfg, file); 43 | 44 | test_print(cfg, "After writing, file size is %lu, apparent-size %lu", 45 | du_cmd(cfg, file, 0), du_cmd(cfg, file, 1)); 46 | 47 | /* sync our extents */ 48 | sync_cmd(cfg, file); 49 | 50 | /* Wait for everyone to finish writing */ 51 | test_barrier(cfg); 52 | 53 | if (rank == cfg->n_ranks - 1) { 54 | test_print(cfg, "I'm the last rank, so I'll laminate the file"); 55 | 56 | /* laminate by removing write bits */ 57 | chmod(file, 0444); /* set to read-only */ 58 | test_print(cfg, "After lamination, file size is %lu", 59 | du_cmd(cfg, file, 0)); 60 | 61 | test_print(cfg, "Stating the file"); 62 | stat_cmd(cfg, file); 63 | } 64 | free(file); 65 | } 66 | 67 | int main(int argc, char* argv[]) 68 | { 69 | test_cfg test_config; 70 | test_cfg* cfg = &test_config; 71 | int rc; 72 | 73 | rc = test_init(argc, argv, cfg); 74 | if (rc) { 75 | test_print(cfg, "ERROR - Test %s initialization failed!", argv[0]); 76 | fflush(NULL); 77 | return rc; 78 | } 79 | 80 | rc = do_test(cfg); 81 | if (rc) { 82 | test_print(cfg, "ERROR - Test %s failed! rc=%d", argv[0], rc); 83 | fflush(NULL); 84 | } 85 | 86 | test_fini(cfg); 87 | 88 | return rc; 89 | } 90 | -------------------------------------------------------------------------------- /examples/src/writeread.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (c) 2020, Lawrence Livermore National Security, LLC. 2 | ! Produced at the Lawrence Livermore National Laboratory. 3 | ! 4 | ! Copyright 2020, UT-Battelle, LLC. 5 | ! 6 | ! LLNL-CODE-741539 7 | ! All rights reserved. 8 | ! 9 | ! This is the license for UnifyFS. 10 | ! For details, see https://github.com/LLNL/UnifyFS. 11 | ! Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 12 | 13 | program write_read_F 14 | 15 | implicit none 16 | 17 | include 'mpif.h' 18 | include 'unifyfsf.h' 19 | 20 | character*1024 :: basefname = "file" 21 | character*1024 :: fname, file_suffix 22 | character*1024 :: prefix = "/unifyfs" 23 | integer(kind=4) :: flag; 24 | integer(kind=4) :: outflags; 25 | integer(kind=4) :: valid; 26 | 27 | integer, parameter :: ni=20, nj=30, nk=45 28 | integer :: loop_count=5 29 | 30 | integer(kind=8), dimension(ni,nj,nk) :: W1, R1 31 | 32 | integer :: ierr, errors, all_errors, nprocs, mynod, ios 33 | integer :: i,j,k,loop 34 | 35 | integer :: writeunit, readunit 36 | integer(kind=8) :: nodeoff 37 | 38 | ! integer (kind = 8) :: total_bytes_transferred 39 | real (kind = 8) :: total_bytes_transferred 40 | real (kind = 4) overall_transfer_rate 41 | real (kind = 8) time0, time1, iter_time0, iter_time1 42 | 43 | call MPI_INIT(ierr) 44 | call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr) 45 | call MPI_COMM_RANK(MPI_COMM_WORLD, mynod, ierr) 46 | 47 | call UNIFYFS_MOUNT(prefix, mynod, nprocs, 0, ierr) 48 | 49 | nodeoff=2**21 50 | 51 | fname = trim(prefix) // "/" // trim(basefname) // ".ckpt" 52 | 53 | forall(i=1:ni,j=1:nj,k=1:nk) & 54 | W1(i,j,k) = nodeoff*mynod+i+ni*(j-1+nj*(k-1)) 55 | 56 | writeunit = mynod 57 | open(unit=writeunit,file=fname,form='unformatted',action='write') 58 | 59 | write(writeunit,iostat=ios) W1 60 | close(writeunit) 61 | 62 | ! R1 = 0 63 | ! open(unit=readunit,file=fname,form='unformatted',action='read') 64 | ! read(readunit,iostat=ios) R1 65 | ! close(readunit) 66 | 67 | call UNIFYFS_UNMOUNT(ierr) 68 | call MPI_FINALIZE(ierr) 69 | 70 | end program write_read_F 71 | -------------------------------------------------------------------------------- /extras/Makefile.am: -------------------------------------------------------------------------------- 1 | confdir = $(sysconfdir)/unifyfs 2 | 3 | conf_DATA = unifyfs.conf 4 | 5 | EXTRA_DIST = unifyfs.conf.in 6 | 7 | CLEANFILES = unifyfs.conf 8 | 9 | -------------------------------------------------------------------------------- /extras/unifyfs.conf.in: -------------------------------------------------------------------------------- 1 | # unifyfs.conf 2 | 3 | # NOTE: 4 | # - string values should not be quoted, e.g., /var/tmp is correct but 5 | # "/var/tmp" is not. 6 | # 7 | # COMMENT STYLE: 8 | # '#' start of line comment character 9 | # ';' end of line comment character, must be preceded by a space 10 | 11 | # SECTION: top-level configuration 12 | # [unifyfs] 13 | # daemonize = off ; servers will become daemons (default: on) 14 | 15 | # SECTION: log settings 16 | # [log] 17 | # dir = /tmp ; log file directory path 18 | # file = unifyfsd.log ; log file name (server rank will be appended) 19 | # verbosity = 5 ; logging verbosity level [0-5] (default: 0) 20 | 21 | # SECTION: log-based I/O configuration (NOTE: values are per-client) 22 | # [logio] 23 | # chunk_size = 65536 ; data chunk size (B) (default: 4 MiB) 24 | # shmem_size = 67108864 ; maximum size (B) of data in shared memory (default: 256 MiB) 25 | # spill_size = 5368709120 ; maximum size (B) of data in spillover file (default: 1 GiB) 26 | 27 | # SECTION: server settings 28 | # [server] 29 | # max_app_clients = 64 ; max client processes per mountpoint (default: 256) 30 | # init_timeout = 300 ; timeout (seconds) for server initialization and communication bootstrapping (default: 120) 31 | -------------------------------------------------------------------------------- /m4/gotcha.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([UNIFYFS_AC_GOTCHA], [ 2 | # preserve state of flags 3 | GOTCHA_OLD_CFLAGS=$CFLAGS 4 | GOTCHA_OLD_CXXFLAGS=$CXXFLAGS 5 | GOTCHA_OLD_LDFLAGS=$LDFLAGS 6 | 7 | AC_ARG_WITH([gotcha], [AC_HELP_STRING([--with-gotcha=PATH], 8 | [path to installed libgotcha [default=/usr/local]])], 9 | [ 10 | GOTCHA_DIR="${withval}" 11 | GOTCHA_CFLAGS="-I${GOTCHA_DIR}/include" 12 | GOTCHA_LDFLAGS="-L${GOTCHA_DIR}/lib64 -L${GOTCHA_DIR}/lib -Wl,-rpath,${GOTCHA_DIR}/lib64 -Wl,-rpath,${GOTCHA_DIR}/lib" 13 | CFLAGS="$CFLAGS ${GOTCHA_CFLAGS}" 14 | CXXFLAGS="$CXXFLAGS ${GOTCHA_CFLAGS}" 15 | LDFLAGS="$LDFLAGS ${GOTCHA_LDFLAGS}" 16 | ], 17 | [ 18 | GOTCHA_CFLAGS="" 19 | GOTCHA_LDFLAGS="" 20 | ] 21 | ) 22 | 23 | AC_CHECK_LIB([gotcha], [gotcha_wrap], 24 | [ 25 | GOTCHA_LIBS="${GOTCHA_LDFLAGS} -lgotcha" 26 | AC_SUBST(GOTCHA_CFLAGS) 27 | AC_SUBST(GOTCHA_LDFLAGS) 28 | AC_SUBST(GOTCHA_LIBS) 29 | AM_CONDITIONAL([HAVE_GOTCHA], [true]) 30 | ], 31 | [ 32 | AC_MSG_WARN([couldn't find a suitable libgotcha, use --with-gotcha=PATH]) 33 | AM_CONDITIONAL([HAVE_GOTCHA], [false]) 34 | ], 35 | [] 36 | ) 37 | 38 | # restore flags 39 | CFLAGS=$GOTCHA_OLD_CFLAGS 40 | CXXFLAGS=$GOTCHA_OLD_CXXFLAGS 41 | LDFLAGS=$GOTCHA_OLD_LDFLAGS 42 | ]) 43 | -------------------------------------------------------------------------------- /m4/inttypes-pri.m4: -------------------------------------------------------------------------------- 1 | # inttypes-pri.m4 serial 4 (gettext-0.16) 2 | dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | 9 | AC_PREREQ(2.52) 10 | 11 | # Define PRI_MACROS_BROKEN if exists and defines the PRI* 12 | # macros to non-string values. This is the case on AIX 4.3.3. 13 | 14 | AC_DEFUN([gt_INTTYPES_PRI], 15 | [ 16 | AC_CHECK_HEADERS([inttypes.h]) 17 | if test $ac_cv_header_inttypes_h = yes; then 18 | AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], 19 | gt_cv_inttypes_pri_broken, 20 | [ 21 | AC_TRY_COMPILE([#include 22 | #ifdef PRId32 23 | char *p = PRId32; 24 | #endif 25 | ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) 26 | ]) 27 | fi 28 | if test "$gt_cv_inttypes_pri_broken" = yes; then 29 | AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, 30 | [Define if exists and defines unusable PRI* macros.]) 31 | PRI_MACROS_BROKEN=1 32 | else 33 | PRI_MACROS_BROKEN=0 34 | fi 35 | AC_SUBST([PRI_MACROS_BROKEN]) 36 | ]) 37 | -------------------------------------------------------------------------------- /m4/leveldb.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([UNIFYFS_AC_LEVELDB], [ 2 | # preserve state of flags 3 | LEVELDB_OLD_CFLAGS=$CFLAGS 4 | LEVELDB_OLD_LDFLAGS=$LDFLAGS 5 | 6 | AC_ARG_VAR([LEVELDB_ROOT], [Set the path to the LevelDB installation Directory]) 7 | 8 | AS_IF([test -n "$LEVELDB_ROOT"],[ 9 | AC_MSG_NOTICE([LEVELDB_ROOT is set, checking for LevelDB in $LEVELDB_ROOT]) 10 | LEVELDB_CFLAGS="-I${LEVELDB_ROOT}/include" 11 | LEVELDB_LDFLAGS="-L${LEVELDB_ROOT}/lib -L${LEVELDB_ROOT}/lib64" 12 | CFLAGS="$CFLAGS ${LEVELDB_CFLAGS}" 13 | LDFLAGS="$LDFLAGS ${LEVELDB_LDFLAGS}" 14 | ],[]) 15 | 16 | AC_CHECK_LIB([leveldb], [leveldb_open], 17 | [LEVELDB_LIBS="-lleveldb" 18 | AC_SUBST(LEVELDB_CFLAGS) 19 | AC_SUBST(LEVELDB_LDFLAGS) 20 | AC_SUBST(LEVELDB_LIBS) 21 | ], 22 | [AC_MSG_ERROR([couldn't find a suitable libleveldb, use LEVELDB_ROOT to set the path to the installation directory.])], 23 | [] 24 | ) 25 | 26 | # restore flags 27 | CFLAGS=$LEVELDB_OLD_CFLAGS 28 | LDFLAGS=$LEVELDB_OLD_LDFLAGS 29 | ]) 30 | -------------------------------------------------------------------------------- /m4/margo.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([UNIFYFS_AC_MARGO], [ 2 | # preserve state of flags 3 | MARGO_OLD_CFLAGS=$CFLAGS 4 | MARGO_OLD_CXXFLAGS=$CXXFLAGS 5 | MARGO_OLD_LDFLAGS=$LDFLAGS 6 | 7 | PKG_CHECK_MODULES([MARGO],[margo], 8 | [ 9 | AC_SUBST(MARGO_CFLAGS) 10 | AC_SUBST(MARGO_LIBS) 11 | ], 12 | [AC_MSG_ERROR(m4_normalize([ 13 | couldn't find a suitable libmargo, set environment variable 14 | PKG_CONFIG_PATH=paths/for/{mercury,argobots,margo}/lib/pkgconfig 15 | ]))]) 16 | 17 | # restore flags 18 | CFLAGS=$MARGO_OLD_CFLAGS 19 | CXXFLAGS=$MARGO_OLD_CXXFLAGS 20 | LDFLAGS=$MARGO_OLD_LDFLAGS 21 | ]) 22 | -------------------------------------------------------------------------------- /m4/openssl.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([UNIFYFS_AC_OPENSSL], [ 2 | # preserve state of flags 3 | OPENSSL_OLD_CFLAGS=$CFLAGS 4 | OPENSSL_OLD_CXXFLAGS=$CXXFLAGS 5 | OPENSSL_OLD_LDFLAGS=$LDFLAGS 6 | 7 | PKG_CHECK_MODULES([OPENSSL],[openssl], 8 | [ 9 | AC_SUBST(OPENSSL_CFLAGS) 10 | AC_SUBST(OPENSSL_LIBS) 11 | ], 12 | [AC_MSG_ERROR(m4_normalize([ 13 | couldn't find a suitable openssl-devel 14 | ]))]) 15 | 16 | 17 | 18 | 19 | AC_CHECK_LIB([crypto], [EVP_Digest], 20 | [ 21 | AM_CONDITIONAL([HAVE_OPENSSL_EVP], [true]) 22 | ], 23 | [ 24 | AC_MSG_ERROR([couldn't find a sufficiently new OpenSSL installation]) 25 | ], 26 | [] 27 | ) 28 | 29 | 30 | # restore flags 31 | CFLAGS=$OPENSSL_OLD_CFLAGS 32 | CXXFLAGS=$OPENSSL_OLD_CXXFLAGS 33 | LDFLAGS=$OPENSSL_OLD_LDFLAGS 34 | ]) 35 | -------------------------------------------------------------------------------- /m4/spath.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([UNIFYFS_AC_SPATH], [ 2 | # preserve state of flags 3 | SPATH_OLD_CFLAGS=$CFLAGS 4 | SPATH_OLD_CXXFLAGS=$CXXFLAGS 5 | SPATH_OLD_LDFLAGS=$LDFLAGS 6 | 7 | AC_ARG_WITH([spath], [AC_HELP_STRING([--with-spath=PATH], 8 | [path to installed libspath [default=/usr/local]])], 9 | [ 10 | SPATH_DIR="${withval}" 11 | SPATH_CFLAGS="-I${SPATH_DIR}/include" 12 | SPATH_LDFLAGS="-L${SPATH_DIR}/lib64 -L${SPATH_DIR}/lib -Wl,-rpath,${SPATH_DIR}/lib64 -Wl,-rpath,${SPATH_DIR}/lib" 13 | CFLAGS="$CFLAGS ${SPATH_CFLAGS}" 14 | CXXFLAGS="$CXXFLAGS ${SPATH_CFLAGS}" 15 | LDFLAGS="$LDFLAGS ${SPATH_LDFLAGS}" 16 | ], 17 | [ 18 | SPATH_CFLAGS="" 19 | SPATH_LDFLAGS="" 20 | ] 21 | ) 22 | 23 | AC_CHECK_LIB([spath], [spath_strdup_reduce_str], 24 | [ 25 | SPATH_LIBS="${SPATH_LDFLAGS} -lspath" 26 | AC_SUBST(SPATH_CFLAGS) 27 | AC_SUBST(SPATH_LDFLAGS) 28 | AC_SUBST(SPATH_LIBS) 29 | AM_CONDITIONAL([HAVE_SPATH], [true]) 30 | AC_DEFINE([USE_SPATH], [1], [Defined if you have libspath]) 31 | ], 32 | [ 33 | AC_MSG_WARN([couldn't find a suitable libspath, use --with-spath=PATH]) 34 | AM_CONDITIONAL([HAVE_SPATH], [false]) 35 | ], 36 | [] 37 | ) 38 | 39 | # restore flags 40 | CFLAGS=$SPATH_OLD_CFLAGS 41 | CXXFLAGS=$SPATH_OLD_CXXFLAGS 42 | LDFLAGS=$SPATH_OLD_LDFLAGS 43 | ]) 44 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | ## Styling code and verifying style checks 2 | 3 | The asytle tool can be used to apply much of the required code styling used in 4 | the project and `checkpatch.sh` can be used to check that uncommitted changes 5 | meet the coding style 6 | 7 | Our [Style Guides](https://unifyfs.readthedocs.io/en/dev/style-guides.html) 8 | have our complete documentation coding conventions. 9 | -------------------------------------------------------------------------------- /scripts/checkpatch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This is a wrapper around checkpatch.pl which is a code style-checking 4 | # script borrowed from the Linux kernel. The wrapper calls checkpatch.pl 5 | # with arguments to make it UnifyFS style-friendly. 6 | # 7 | 8 | basedir=$(dirname "$0") 9 | checkpatch_cmd=$basedir/linux_kernel_checkpatch/checkpatch.pl 10 | 11 | # 12 | # These are checkpatch.pl message types to ignore for cases where 13 | # UnifyFS deviates from the Linux kernel coding standards. 14 | # 15 | # See 'scripts/linux_kernel_checkpatch/checkpatch.pl --list-types' 16 | # for all message types 17 | # 18 | checkpatch_ignore="LEADING_SPACE" # Allow spaces for indentation 19 | checkpatch_ignore+=",CODE_INDENT" # Don't require tabs for indentation 20 | checkpatch_ignore+=",MISSING_SIGN_OFF" # Signed-off-by: line is optional 21 | checkpatch_ignore+=",FILE_PATH_CHANGES" # Don't nag about updating MAINTAINERS 22 | checkpatch_ignore+=",CONST_STRUCT" # Don't nag about const structs 23 | checkpatch_ignore+=",SPLIT_STRING" # Allow long strings to be split 24 | checkpatch_ignore+=",ARRAY_SIZE" # Don't require use of ARRAY_SIZE macro 25 | checkpatch_ignore+=",USE_NEGATIVE_ERRNO" # We don't return negative errnos 26 | checkpatch_ignore+=",NEW_TYPEDEFS" 27 | checkpatch_ignore+=",ENOSYS" 28 | checkpatch_ignore+=",CONSTANT_COMPARISON" # Allow consts on left: if(CONST==val) 29 | checkpatch_ignore+=",VOLATILE" # Allow use of volatile keyword 30 | checkpatch_ignore+=",SYMBOLIC_PERMS" # Allow symbolic perms (S_IRUSR) 31 | 32 | checkpatch_cmd+=" --ignore $checkpatch_ignore" 33 | 34 | # 35 | # Allow checked-in files to be exempted from style checking if the 36 | # TEST_CHECKPATCH_SKIP_FILES is set. It should be a comma separated list 37 | # of paths relative to the project root, e.g. scripts/checkpath.sh. 38 | # 39 | if test -n "$TEST_CHECKPATCH_SKIP_FILES"; then 40 | checkpatch_cmd+=" --skip-files $TEST_CHECKPATCH_SKIP_FILES" 41 | fi 42 | 43 | # Suppress summary warning about white space errors. 44 | checkpatch_cmd+=" -q" 45 | 46 | # Let checkpatch.pl run outside of kernel tree. 47 | checkpatch_cmd+=" --no-tree" 48 | 49 | # 50 | # Check the tip of the current branch by if no argument is given. 51 | # Otherwise check the given git revision, e.g. to check the all 52 | # patches ahead of origin/dev: 53 | # 54 | # ./checkpatch.sh origin/dev..HEAD 55 | # 56 | revisions=${1:-"HEAD^..HEAD"} 57 | 58 | # 59 | # If we're reading from a pipe then pass input directly into 60 | # checkpatch.pl. Otherwise get the patch from git. 61 | # 62 | if [ ! -t 0 ] ; then 63 | show_patch_cmd="cat" 64 | else 65 | show_patch_cmd="git format-patch -p -k --stdout $revisions" 66 | fi 67 | 68 | $show_patch_cmd | $checkpatch_cmd 69 | -------------------------------------------------------------------------------- /scripts/git_log_test_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script helps configure a test environment using git commit 4 | # messages. Extract variable assignment statements beginning with TEST_ 5 | # from the git commit message and print them so the variables can be 6 | # imported into the caller's environment. For example, 7 | # 8 | # eval $(git_log_test_env.sh) 9 | # 10 | 11 | git log HEAD^..HEAD | sed "s/^ *//g" | grep '^TEST_.*=' 12 | -------------------------------------------------------------------------------- /scripts/linux_kernel_checkpatch/const_structs.checkpatch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLNL/UnifyFS/c44d052df5d838721171ea0208534ad5d084798f/scripts/linux_kernel_checkpatch/const_structs.checkpatch -------------------------------------------------------------------------------- /scripts/unifyfs.astyle: -------------------------------------------------------------------------------- 1 | # don't bother creating .orig file 2 | --suffix=none 3 | 4 | # Linux Kernel Style 5 | --style=linux 6 | 7 | # use 4 spaces instead of 8 8 | --indent=spaces=4 9 | 10 | # no tabs 11 | --convert-tabs 12 | 13 | # avoid CTRL-M characters 14 | --lineend=linux 15 | 16 | # avoid single line if() code; 17 | --break-one-line-headers 18 | 19 | # always use braces 20 | --add-braces 21 | 22 | # limit lines to 80 chars 23 | --max-code-length=80 24 | 25 | # void* foo 26 | --align-pointer=type 27 | 28 | # add spaces in operations 29 | --pad-oper 30 | 31 | # add space between control and its conditional 32 | --pad-header 33 | 34 | # get rid of other whitespace in parens 35 | --unpad-paren 36 | -------------------------------------------------------------------------------- /server/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /server/src/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/common/src/Makefile.mk 2 | 3 | bin_PROGRAMS = unifyfsd 4 | 5 | AM_CPPFLAGS = \ 6 | -I$(top_srcdir)/common/src \ 7 | -I$(top_srcdir)/client/src 8 | 9 | AM_CFLAGS = -Wall -Werror 10 | 11 | unifyfsd_SOURCES = \ 12 | $(UNIFYFS_COMMON_SRCS) \ 13 | extent_tree.c \ 14 | extent_tree.h \ 15 | margo_server.c \ 16 | margo_server.h \ 17 | unifyfs_client_rpc.c \ 18 | unifyfs_fops.h \ 19 | unifyfs_fops_rpc.c \ 20 | unifyfs_global.h \ 21 | unifyfs_group_rpc.h \ 22 | unifyfs_group_rpc.c \ 23 | unifyfs_inode.h \ 24 | unifyfs_inode.c \ 25 | unifyfs_inode_tree.h \ 26 | unifyfs_inode_tree.c \ 27 | unifyfs_p2p_rpc.h \ 28 | unifyfs_p2p_rpc.c \ 29 | unifyfs_request_manager.c \ 30 | unifyfs_request_manager.h \ 31 | unifyfs_server.c \ 32 | unifyfs_service_manager.c \ 33 | unifyfs_service_manager.h \ 34 | unifyfs_server_pid.c \ 35 | unifyfs_transfer.c \ 36 | unifyfs_transfer.h \ 37 | unifyfs_tree.c \ 38 | unifyfs_tree.h 39 | 40 | OPT_CPP_FLAGS = 41 | OPT_C_FLAGS = 42 | OPT_LD_FLAGS = 43 | OPT_LIBS = 44 | 45 | if USE_PMIX 46 | OPT_C_FLAGS += -DUSE_PMIX 47 | OPT_LIBS += -lpmix 48 | endif 49 | 50 | if USE_PMI2 51 | OPT_C_FLAGS += -DUSE_PMI2 52 | OPT_LIBS += -lpmi2 53 | endif 54 | 55 | unifyfsd_CFLAGS = $(AM_CFLAGS) $(UNIFYFS_COMMON_FLAGS) $(OPT_C_FLAGS) 56 | unifyfsd_LDFLAGS = $(OPT_LD_FLAGS) 57 | unifyfsd_LDADD = $(UNIFYFS_COMMON_LIBS) $(OPT_LIBS) 58 | 59 | CLEANFILES = $(bin_PROGRAMS) 60 | -------------------------------------------------------------------------------- /server/src/unifyfs_transfer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_TRANSFER_H 16 | #define UNIFYFS_TRANSFER_H 17 | 18 | #include "unifyfs_global.h" 19 | #include "unifyfs_group_rpc.h" 20 | 21 | 22 | /* transfer helper thread arguments structure */ 23 | typedef struct transfer_thread_args { 24 | const char* dst_file; /* destination file */ 25 | int gfid; /* source file */ 26 | 27 | /* requesting client and transfer info */ 28 | int client_server; /* rank of server where request originated */ 29 | int client_app; /* app of originating client */ 30 | int client_id; /* id of originating client */ 31 | int transfer_id; /* transfer request id at originating client */ 32 | 33 | /* local extents to transfer to destination file */ 34 | extent_metadata* local_extents; 35 | size_t n_extents; 36 | 37 | size_t local_data_sz; /* total size of local data in bytes */ 38 | size_t file_sz; /* source file size in bytes */ 39 | 40 | struct timeval transfer_time; /* elapsed transfer time */ 41 | 42 | coll_request* bcast_coll; /* bcast rpc collective req state */ 43 | 44 | int status; /* status for entire set of transfers */ 45 | pthread_t thrd; /* pthread id for transfer helper thread */ 46 | } transfer_thread_args; 47 | 48 | void release_transfer_thread_args(transfer_thread_args* tta); 49 | 50 | /* find local extents for the given gfid and initialize transfer helper 51 | * thread state */ 52 | int create_local_transfers(int gfid, 53 | transfer_thread_args* tta); 54 | 55 | /** 56 | * transfer helper thread main 57 | * @param arg pointer to transfer_thread_args struct 58 | * 59 | * @return pointer to transfer_thread_args struct 60 | */ 61 | void* transfer_helper_thread(void* arg); 62 | 63 | #endif /* UNIFYFS_TRANSFER_H */ 64 | -------------------------------------------------------------------------------- /server/src/unifyfs_tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2020, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #ifndef UNIFYFS_TREE_H 16 | #define UNIFYFS_TREE_H 17 | 18 | #include 19 | #include "unifyfs_meta.h" 20 | 21 | /* define tree structure */ 22 | typedef struct { 23 | int rank; /* global rank of calling process */ 24 | int ranks; /* number of ranks in tree */ 25 | int parent_rank; /* parent rank, -1 if root */ 26 | int child_count; /* number of children */ 27 | int* child_ranks; /* list of child ranks */ 28 | } unifyfs_tree_t; 29 | 30 | /* given the process's rank and the number of ranks, this computes a k-ary 31 | * tree rooted at rank 0, the structure records the number of children 32 | * of the local rank and the list of their ranks */ 33 | int unifyfs_tree_init( 34 | int rank, /* rank of calling process */ 35 | int ranks, /* number of ranks in tree */ 36 | int root, /* rank of root process */ 37 | int k, /* degree of k-ary tree */ 38 | unifyfs_tree_t* t /* output tree structure */ 39 | ); 40 | 41 | /* free resources allocated in unifyfs_tree_init */ 42 | void unifyfs_tree_free(unifyfs_tree_t* t); 43 | 44 | #endif /* UNIFYFS_TREE_H */ 45 | -------------------------------------------------------------------------------- /t/0001-setup.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Perform some initial setup for the test suite. This is not 4 | # implemented as a sharness test because leaving a process running 5 | # behind (i.e. unifyfsd) causes tap-driver.sh to hang waiting for 6 | # the process to exit. 7 | # 8 | 9 | # Print TAP plan 10 | echo 1..1 11 | 12 | # 13 | # Create temporary directories to be used as a common mount point and a 14 | # common metadata directory across multiple tests. Save the value to a 15 | # script in known location that later test scripts can source. 16 | # 17 | export UNIFYFS_TEST_TMPDIR=$(mktemp -d) 18 | mkdir -p $UNIFYFS_TEST_TMPDIR/{meta,mount,share,spill,state} 19 | export UNIFYFS_TEST_META=$UNIFYFS_TEST_TMPDIR/meta 20 | export UNIFYFS_TEST_MOUNT=$UNIFYFS_TEST_TMPDIR/mount 21 | export UNIFYFS_TEST_SHARE=$UNIFYFS_TEST_TMPDIR/share 22 | export UNIFYFS_TEST_SPILL=$UNIFYFS_TEST_TMPDIR/spill 23 | export UNIFYFS_TEST_STATE=$UNIFYFS_TEST_TMPDIR/state 24 | 25 | # 26 | # Source test environment first to pick up UNIFYFS_TEST_RUN_SCRIPT 27 | # 28 | . $(dirname $0)/sharness.d/00-test-env.sh 29 | 30 | cat >"$UNIFYFS_TEST_RUN_SCRIPT" <<-EOF 31 | export UNIFYFS_TEST_TMPDIR=$UNIFYFS_TEST_TMPDIR 32 | export UNIFYFS_TEST_META=$UNIFYFS_TEST_META 33 | export UNIFYFS_TEST_MOUNT=$UNIFYFS_TEST_MOUNT 34 | export UNIFYFS_TEST_SHARE=$UNIFYFS_TEST_SHARE 35 | export UNIFYFS_TEST_SPILL=$UNIFYFS_TEST_SPILL 36 | export UNIFYFS_TEST_STATE=$UNIFYFS_TEST_STATE 37 | EOF 38 | 39 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 40 | . $(dirname $0)/sharness.d/02-functions.sh 41 | 42 | # 43 | # Start the UnifyFS daemon after killing any previously 44 | # running instance. 45 | # 46 | unifyfsd_stop_daemon 47 | unifyfsd_start_daemon 48 | 49 | # 50 | # Make sure the unifyfsd process starts. 51 | # 52 | if ! process_is_running unifyfsd 5 ; then 53 | cat $UNIFYFS_LOG_DIR/${UNIFYFS_LOG_FILE}* >&3 54 | echo not ok 1 - unifyfsd started 55 | exit 1 56 | fi 57 | 58 | # 59 | # Make sure unifyfsd stays running for 5 more seconds to catch cases where 60 | # it dies during initialization. 61 | # 62 | if process_is_not_running unifyfsd 5; then 63 | cat $UNIFYFS_LOG_DIR/${UNIFYFS_LOG_FILE}* >&3 64 | echo not ok 1 - unifyfsd running 65 | exit 1 66 | fi 67 | 68 | echo ok 1 - unifyfsd running 69 | exit 0 70 | -------------------------------------------------------------------------------- /t/0100-sysio-gotcha.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/sys/sysio-gotcha.t 9 | -------------------------------------------------------------------------------- /t/0110-statfs-gotcha.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | 9 | # disable statfs from returning UnifyFS! super magic value, 10 | # return tmpfs magic instead 11 | export UNIFYFS_CLIENT_SUPER_MAGIC=0 12 | 13 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/sys/statfs-gotcha.t 14 | -------------------------------------------------------------------------------- /t/0200-stdio-gotcha.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/std/stdio-gotcha.t 9 | -------------------------------------------------------------------------------- /t/0500-sysio-static.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/sys/sysio-static.t 9 | -------------------------------------------------------------------------------- /t/0510-statfs-static.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | 9 | # disable statfs from returning UnifyFS! super magic value, 10 | # return tmpfs magic instead 11 | export UNIFYFS_CLIENT_SUPER_MAGIC=0 12 | 13 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/sys/statfs-static.t 14 | -------------------------------------------------------------------------------- /t/0600-stdio-static.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/std/stdio-static.t 9 | -------------------------------------------------------------------------------- /t/0700-unifyfs-stage-full.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Test unifyfs-stage executable for basic functionality 4 | # 5 | 6 | test_description="Test basic functionality of unifyfs-stage executable" 7 | 8 | . $(dirname $0)/sharness.sh 9 | 10 | test_expect_success "unifyfs-stage exists" ' 11 | test_path_is_file ${UNIFYFS_BUILD_DIR}/util/unifyfs-stage/src/unifyfs-stage 12 | ' 13 | test_expect_success "testing temp dir exists" ' 14 | test_path_is_dir ${UNIFYFS_TEST_TMPDIR} 15 | ' 16 | 17 | stage_cfg_dir=${UNIFYFS_TEST_TMPDIR}/stage/config_0700 18 | stage_src_dir=${UNIFYFS_TEST_TMPDIR}/stage/source 19 | stage_dst_dir=${UNIFYFS_TEST_TMPDIR}/stage/destination_0700 20 | mkdir -p $stage_cfg_dir $stage_src_dir $stage_dst_dir 21 | 22 | test_expect_success "stage testing dirs exist" ' 23 | test_path_is_dir $stage_cfg_dir && 24 | test_path_is_dir $stage_src_dir && 25 | test_path_is_dir $stage_dst_dir 26 | ' 27 | 28 | stage_src_file=$stage_src_dir/source_0700.file 29 | stage_im_file=$UNIFYFS_TEST_MOUNT/intermediate_0700.file 30 | stage_dst_file=$stage_dst_dir/destination_0700.file 31 | 32 | dd if=/dev/urandom bs=4M count=1 of=$stage_src_file &>/dev/null 33 | 34 | test_expect_success "source.file exists" ' 35 | test_path_is_file $stage_src_file 36 | ' 37 | 38 | rm -f $stage_cfg_dir/* $stage_dst_dir/* 39 | 40 | test_expect_success "config_0700 directory is empty" ' 41 | test_dir_is_empty $stage_cfg_dir 42 | ' 43 | 44 | stage_in_manifest=$stage_cfg_dir/stage_IN.manifest 45 | stage_out_manifest=$stage_cfg_dir/stage_OUT.manifest 46 | 47 | echo "\"$stage_src_file\" \"$stage_im_file\"" > $stage_in_manifest 48 | echo "\"$stage_im_file\" \"$stage_dst_file\"" > $stage_out_manifest 49 | 50 | test_expect_success "config_0700 directory now has manifest files" ' 51 | test_path_is_file $stage_in_manifest && 52 | test_path_is_file $stage_out_manifest 53 | ' 54 | 55 | test_expect_success "target directory is empty" ' 56 | test_dir_is_empty $stage_dst_dir 57 | ' 58 | 59 | stage_in_log=$stage_cfg_dir/stage_IN.log 60 | stage_out_log=$stage_cfg_dir/stage_OUT.log 61 | stage_exe=${UNIFYFS_BUILD_DIR}/util/unifyfs-stage/src/unifyfs-stage 62 | 63 | $JOB_RUN_COMMAND $stage_exe -v -m ${UNIFYFS_TEST_MOUNT} -S $stage_cfg_dir $stage_in_manifest &> $stage_in_log 64 | 65 | $JOB_RUN_COMMAND $stage_exe -v -m ${UNIFYFS_TEST_MOUNT} -S $stage_cfg_dir $stage_out_manifest &> $stage_out_log 66 | 67 | test_expect_success "input file has been staged to output" ' 68 | test_path_is_file $stage_dst_file 69 | ' 70 | 71 | export TEST_CMP='cmp --quiet' 72 | 73 | test_expect_success "final output is identical to initial input" ' 74 | test_might_fail test_cmp $stage_src_file $stage_dst_file 75 | ' 76 | 77 | test_done 78 | -------------------------------------------------------------------------------- /t/8000-library-api.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/api/api_test.t 9 | -------------------------------------------------------------------------------- /t/9005-unifyfs-unmount.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/unifyfs_unmount.t 9 | -------------------------------------------------------------------------------- /t/9010-stop-unifyfsd.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test_description="Shut down unifyfsd" 4 | 5 | . $(dirname $0)/sharness.sh 6 | 7 | test_expect_success "Stop unifyfsd" ' 8 | unifyfsd_stop_daemon 9 | process_is_not_running unifyfsd 5 10 | ' 11 | 12 | test_done 13 | -------------------------------------------------------------------------------- /t/9020-mountpoint-empty.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This test checks that I/O to the UnifyFS mount point was properly 4 | # intercepted and redirected to the UnifyFS daemon. 5 | # 6 | 7 | # If this test fails, then at least one file made it to the UnifyFS mountpoint. 8 | # This most likely means the corresponding wrapped function is failing in some 9 | # way and the call is falling through to the operating system. 10 | test_description="Verify UnifyFS intercepted mount point is empty" 11 | 12 | . $(dirname $0)/sharness.sh -v 13 | 14 | test_expect_success "Intercepted mount point $UNIFYFS_MOUNTPOINT is empty" ' 15 | test_dir_is_empty $UNIFYFS_MOUNTPOINT 16 | ' 17 | 18 | test_done 19 | -------------------------------------------------------------------------------- /t/9200-seg-tree-test.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $UNIFYFS_BUILD_DIR/t/common/seg_tree_test.t 9 | -------------------------------------------------------------------------------- /t/9201-slotmap-test.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Source sharness environment scripts to pick up test environment 4 | # and UnifyFS runtime settings. 5 | # 6 | . $(dirname $0)/sharness.d/00-test-env.sh 7 | . $(dirname $0)/sharness.d/01-unifyfs-settings.sh 8 | $UNIFYFS_BUILD_DIR/t/common/slotmap_test.t 9 | -------------------------------------------------------------------------------- /t/9999-cleanup.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test_description="Cleanup test environment" 4 | 5 | . $(dirname $0)/sharness.sh -v 6 | 7 | test_expect_success "Cleanup" ' 8 | unifyfsd_cleanup 9 | ' 10 | 11 | test_done 12 | -------------------------------------------------------------------------------- /t/README.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | UnifyFS's unit testing and continuous integration testing suites. 4 | 5 | Our [Testing Guide](https://unifyfs.readthedocs.io/en/dev/testing.html) has our 6 | complete testing documentation. 7 | 8 | ## Unit Tests 9 | 10 | The UnifyFS Unit Test Suite uses the Test Anything Protocol (TAP) and the 11 | Automake test harness. By convention, test scripts and programs that output TAP 12 | are named with a “.t” extension. 13 | 14 | Test cases in shell scripts are implemented with 15 | [sharness](https://github.com/chriscool/sharness), which is included in 16 | the UnifyFS source distribution. See the file `sharness.sh` for all available 17 | test interfaces. UnifyFS-specific sharness code is implemented in scripts in the 18 | directory `sharness.d/`. Scripts in `sharness.d/` are primarily used to set 19 | environment variables and define convenience functions. All scripts in 20 | `sharness.d/` are automatically included when your script sources `sharness.sh`. 21 | 22 | C programs use the [libtap library](https://github.com/zorgnax/libtap) 23 | to implement test cases. Convenience functions common to test cases written in 24 | C are implemmented in the library `lib/testutil.c`. 25 | 26 | ## Continuous Integration Tests 27 | 28 | The UnifyFS Continuous Integration (CI) Test Suite is found in `ci/` and also uses [sharness](https://github.com/chriscool/sharness). 29 | Additional sharness convenience functions and variables needed for the CI tests 30 | are also found in `ci/` and are sourced when running `ci/001-setup.sh`. 31 | -------------------------------------------------------------------------------- /t/api/api_suite.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include "api_suite.h" 16 | #include 17 | 18 | /* This is the collection of library API tests. 19 | * 20 | * To add new subtests to existing API functionality tests: 21 | * 1. Simply add the tests (order matters) to the appropriate 22 | * t/api/.c file. 23 | * 24 | * When new API functionality needs to be tested: 25 | * 1. Create a t/api/.c source file with a function called: 26 | * api__test(char *unifyfs_root) 27 | * to contain all the TAP tests for that API functionality. 28 | * 2. Add the function name to t/api/api_suite.h, with comments. 29 | * 3. In t/Makefile.am, add the new file to the source file list for 30 | * the api test suite (api_client_api_test_t_SOURCES). 31 | * 4. The api__test function can now be used in this suite. */ 32 | 33 | int main(int argc, char* argv[]) 34 | { 35 | int rc; 36 | char* unifyfs_root = testutil_get_mount_point(); 37 | char* tmp_dir = testutil_get_tmp_dir(); 38 | 39 | unifyfs_handle fshdl; 40 | 41 | //MPI_Init(&argc, &argv); 42 | 43 | plan(NO_PLAN); 44 | 45 | /* Add tests for new functionality below in the order desired for testing. 46 | * 47 | * *** NOTE *** 48 | * The order of the tests does matter as some subsequent tests use 49 | * functionality or files that were already tested. 50 | */ 51 | 52 | size_t spill_sz = (size_t)512 * MIB; 53 | char* spill_size_env = getenv("UNIFYFS_LOGIO_SPILL_SIZE"); 54 | if (NULL != spill_size_env) { 55 | spill_sz = (size_t) strtoul(spill_size_env, NULL, 0); 56 | } 57 | 58 | rc = api_initialize_test(unifyfs_root, &fshdl); 59 | if (rc == UNIFYFS_SUCCESS) { 60 | api_config_test(unifyfs_root, &fshdl); 61 | 62 | api_create_open_remove_test(unifyfs_root, &fshdl); 63 | 64 | api_write_read_sync_stat_test(unifyfs_root, &fshdl, 65 | (size_t)64 * KIB, (size_t)4 * KIB); 66 | api_write_read_sync_stat_test(unifyfs_root, &fshdl, 67 | (size_t)1 * MIB, (size_t)32 * KIB); 68 | api_write_read_sync_stat_test(unifyfs_root, &fshdl, 69 | (size_t)4 * MIB, (size_t)128 * KIB); 70 | 71 | api_get_gfids_and_metadata_test(unifyfs_root, &fshdl, 72 | (size_t)64 * KIB); 73 | 74 | api_laminate_test(unifyfs_root, &fshdl); 75 | 76 | api_storage_test(unifyfs_root, &fshdl, 77 | spill_sz, (spill_sz / 8)); 78 | 79 | api_transfer_test(unifyfs_root, tmp_dir, &fshdl, 80 | (size_t)64 * MIB, (size_t)4 * MIB); 81 | 82 | api_finalize_test(unifyfs_root, &fshdl); 83 | } 84 | 85 | //MPI_Finalize(); 86 | 87 | done_testing(); 88 | 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /t/api/api_suite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* This is the collection of library API tests. 16 | * 17 | * When new API functionality needs to be tested: 18 | * 1. Create a t/api/.c file with a function called: 19 | * api__test(char *unifyfs_root) 20 | * to contain all the TAP tests for that API functionality. 21 | * 2. Add the function name to this file, with comments. 22 | * 3. In t/Makefile.am, add the new file to the source file list for 23 | * the api test suite (api_client_api_test_t_SOURCES). 24 | * 4. The api__test function can now be called from the suite's 25 | * implementation in t/api/api_suite.c */ 26 | 27 | #ifndef T_LIBRARY_API_SUITE_H 28 | #define T_LIBRARY_API_SUITE_H 29 | 30 | #include "t/lib/tap.h" 31 | #include "t/lib/testutil.h" 32 | #include "unifyfs_api.h" 33 | 34 | /* Tests API initialization */ 35 | int api_initialize_test(char* unifyfs_root, 36 | unifyfs_handle* fshdl); 37 | 38 | /* Tests API get-configuration */ 39 | int api_config_test(char* unifyfs_root, 40 | unifyfs_handle* fshdl); 41 | 42 | /* Tests API finalization */ 43 | int api_finalize_test(char* unifyfs_root, 44 | unifyfs_handle* fshdl); 45 | 46 | /* Tests file creation, open, and removal */ 47 | int api_create_open_remove_test(char* unifyfs_root, 48 | unifyfs_handle* fshdl); 49 | 50 | /* Tests file write, read, sync, and stat */ 51 | int api_write_read_sync_stat_test(char* unifyfs_root, 52 | unifyfs_handle* fshdl, 53 | size_t filesize, 54 | size_t chksize); 55 | 56 | /* Tests the get_gfid_list and get_server_file_metadata APIs */ 57 | int api_get_gfids_and_metadata_test(char* unifyfs_root, 58 | unifyfs_handle* fshdl, 59 | size_t filesize); 60 | 61 | /* Tests file laminate, with subsequent write/read/stat */ 62 | int api_laminate_test(char* unifyfs_root, 63 | unifyfs_handle* fshdl); 64 | 65 | 66 | /* Tests file storage space reuse */ 67 | int api_storage_test(char* unifyfs_root, 68 | unifyfs_handle* fshdl, 69 | size_t filesize, 70 | size_t chksize); 71 | 72 | 73 | /* Tests file transfers, both serial and parallel */ 74 | int api_transfer_test(char* unifyfs_root, 75 | char* tmpdir, 76 | unifyfs_handle* fshdl, 77 | size_t filesize, 78 | size_t chksize); 79 | 80 | #endif /* T_LIBRARY_API_SUITE_H */ 81 | -------------------------------------------------------------------------------- /t/api/init-fini.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include "api_suite.h" 16 | 17 | int api_initialize_test(char* unifyfs_root, 18 | unifyfs_handle* fshdl) 19 | { 20 | diag("Starting API initialization test"); 21 | 22 | int n_configs = 1; 23 | unifyfs_cfg_option chk_size = { .opt_name = "logio.chunk_size", 24 | .opt_value = "32768" }; 25 | 26 | int rc = unifyfs_initialize(unifyfs_root, &chk_size, n_configs, fshdl); 27 | ok(rc == UNIFYFS_SUCCESS, 28 | "%s:%d unifyfs_initialize() is successful: rc=%d (%s)", 29 | __FILE__, __LINE__, rc, unifyfs_rc_enum_description(rc)); 30 | 31 | diag("Finished API initialization test"); 32 | return rc; 33 | } 34 | 35 | int api_config_test(char* unifyfs_root, 36 | unifyfs_handle* fshdl) 37 | { 38 | diag("Starting API get-configuration test"); 39 | 40 | int n_opt; 41 | unifyfs_cfg_option* options; 42 | int rc = unifyfs_get_config(*fshdl, &n_opt, &options); 43 | ok(rc == UNIFYFS_SUCCESS && NULL != options, 44 | "%s:%d unifyfs_get_config() is successful: rc=%d (%s)", 45 | __FILE__, __LINE__, rc, unifyfs_rc_enum_description(rc)); 46 | 47 | if (NULL != options) { 48 | for (int i = 0; i < n_opt; i++) { 49 | unifyfs_cfg_option* opt = options + i; 50 | diag("UNIFYFS CONFIG: %s = %s", opt->opt_name, opt->opt_value); 51 | free((void*)opt->opt_name); 52 | free((void*)opt->opt_value); 53 | } 54 | free(options); 55 | } 56 | 57 | diag("Finished API get-configuration test"); 58 | return rc; 59 | } 60 | 61 | int api_finalize_test(char* unifyfs_root, 62 | unifyfs_handle* fshdl) 63 | { 64 | diag("Starting API finalization test"); 65 | 66 | int rc = unifyfs_finalize(*fshdl); 67 | ok(rc == UNIFYFS_SUCCESS, 68 | "%s:%d unifyfs_finalize() is successful: rc=%d (%s)", 69 | __FILE__, __LINE__, rc, unifyfs_rc_enum_description(rc)); 70 | 71 | diag("Finished API finalization test"); 72 | return rc; 73 | } 74 | -------------------------------------------------------------------------------- /t/ci/990-stop-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This test checks that the server terminated successfully, checks the 4 | # mountpoints, and then cleans up the hosts (if desired). 5 | 6 | test_description="Stopping the UnifyFS server" 7 | 8 | DONE_TESTING="1" 9 | 10 | for arg in "$@" 11 | do 12 | case $arg in 13 | -h|--help) 14 | ci_dir=$(dirname "$(readlink -fm $BASH_SOURCE)") 15 | $ci_dir/001-setup.sh -h 16 | exit 17 | ;; 18 | --allow-restart) 19 | DONE_TESTING="0" 20 | echo "Stop servers but allow restart and additional testing" 21 | ;; 22 | *) 23 | echo "usage ./990-stop-server.sh -h|--help|--allow-restart" 24 | exit 1 25 | ;; 26 | esac 27 | done 28 | 29 | test_expect_success "unifyfsd is still running" ' 30 | process_is_running unifyfsd 10 31 | ' 32 | 33 | $UNIFYFS_CLU terminate -d &> ${UNIFYFS_LOG_DIR}/unifyfs.terminate.out 34 | 35 | test_expect_success "unifyfsd has stopped" ' 36 | process_is_not_running unifyfsd 10 37 | ' 38 | 39 | test_expect_success "verify unifyfsd has stopped" ' 40 | test_must_fail process_is_running unifyfsd 10 41 | ' 42 | 43 | 44 | if [ "$DONE_TESTING" -eq "1" ]; then 45 | 46 | 47 | # If UNIFYFS_MOUNTPOINT is an existing dir, verify that is it empty 48 | test_expect_success REAL_MP \ 49 | "Verify UNIFYFS_MOUNTPOINT ($UNIFYFS_MP) is empty" ' 50 | test_dir_is_empty $UNIFYFS_MP 51 | ' 52 | 53 | # Cleanup posix mountpoint 54 | test_expect_success POSIX \ 55 | "Cleanup UNIFYFS_CI_POSIX_MP: $UNIFYFS_CI_POSIX_MP" ' 56 | rm -rf $UNIFYFS_CI_POSIX_MP/*posix* 57 | ' 58 | 59 | # cleanup_hosts 60 | test_expect_success PDSH,CLEAN "Cleanup hosts" ' 61 | cleanup_hosts 62 | ' 63 | 64 | # Remove trap 65 | # If any tests failed, the suite will exit with 1 which 66 | # will trigger the trap. Since the hosts were already 67 | # cleaned at this point, can remove trap to prevent 68 | # cleanup_hosts from being called again. 69 | trap - EXIT 70 | 71 | # end here if running tests individually 72 | if [[ -z $UNIFYFS_CI_TESTS_FULL_RUN ]]; then 73 | ( test_done; ) 74 | test_exit_code=$? 75 | 76 | cd "$(dirname "$SHARNESS_TRASH_DIRECTORY")" 77 | 78 | return $test_exit_code 79 | fi 80 | 81 | fi # if [ $DONE_TESTING -eq "1" ]]; then 82 | -------------------------------------------------------------------------------- /t/ci/README.md: -------------------------------------------------------------------------------- 1 | # Integration Testing 2 | 3 | The UnifyFS [examples](https://github.com/LLNL/UnifyFS/tree/dev/examples) are 4 | being used as integration tests with continuous integration tools. These scripts 5 | depend on [sharness](https://github.com/chriscool/sharness) which is set up in 6 | the containing directory (`UnifyFS/t/`) and may not function properly if moved. 7 | 8 | The numbered scripts are the setup and tests being run by `RUN_CI_TESTS.sh`. 9 | 10 | `001-setup.sh` 11 | : Checks for an installation of UnifyFS and sets up variables needed for 12 | testing. 13 | 14 | `002-start-server.sh` 15 | : Starts unifyfsd and tests to ensure it is running. 16 | 17 | `100-900` 18 | : Scripts for testing the examples. 19 | 20 | `990-stop-server.sh` 21 | : Stops unifyfsd and cleans up. 22 | 23 | The other scripts (`ci-functions.sh`, `setup-lsf.sh`, and `setup-slurm.sh`) 24 | contain helper functions and variables used by the tests. Full details can be 25 | found in [UnifyFS testing documentation](https://unifyfs.readthedocs.io/en/dev/testing.html#integration-tests). 26 | 27 | ## Quickstart 28 | 29 | In order to run these scripts, make sure you are either submitting a batch job 30 | to run them, or are first in an interactive allocation. 31 | 32 | > **Note:** `mpirun` is currently not supported but coming soon. 33 | 34 | To run all of the tests, simply run `./RUN_CI_TESTS.sh`. 35 | 36 | E.g.: 37 | 38 | ```shell 39 | $ ./RUN_CI_TESTS.sh 40 | ``` 41 | 42 | or 43 | 44 | ```shell 45 | $ prove -v RUN_CI_TESTS.sh 46 | ``` 47 | 48 | In order to run individual tests, source the `001-setup.sh` script first, 49 | followed by `002-start-server.sh`. Then source each desired script after that 50 | preceded by `$UNIFYFS_CI_DIR`. When finished, source the `990-stop-server.sh` 51 | script last. 52 | 53 | E.g.: 54 | 55 | ```shell 56 | $ . ./001-setup.sh 57 | $ . $UNIFYFS_CI_DIR/002-start-server.sh 58 | $ . $UNIFYFS_CI_DIR/100-writeread-tests.sh 59 | $ . $UNIFYFS_CI_DIR/990-stop-server.sh 60 | ``` 61 | 62 | If additional tests are desired, create a script after the fashion of 63 | `100-writeread-tests.sh` where the prefixed number indicates the desired order 64 | for running the tests. Then source that script in `RUN_CI_TESTS.sh` in the 65 | desired order. 66 | 67 | ### Environment Variables 68 | 69 | There are environment variables that can be set to change the default behavior 70 | of this testing suite. See our [testing 71 | guide](https://unifyfs.readthedocs.io/en/dev/testing.html#configuration-variables) 72 | for a full list. 73 | 74 | ## Developers 75 | 76 | See our [Testing Guide](https://unifyfs.readthedocs.io/en/dev/testing.html#integration-tests) 77 | for full documentation on writing and adding additional tests. 78 | -------------------------------------------------------------------------------- /t/ci/setup-slurm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [[ -z $SLURM_NNODES ]] && \ 4 | { echo >&2 "$errmsg Found srun; no allocated nodes detected"; exit 1; } 5 | 6 | # Functions specific to SLURM 7 | 8 | # Get the compute hosts being used in the current allocation. Used with pdsh 9 | # during cleanup after tests are done. 10 | # 11 | # Returns the unique hosts being used on SLURM. 12 | get_hostlist() 13 | { 14 | # In slurm, can do `pdsh -j $JOBID` to target all nodes in allocation, 15 | # however using nodelist for consistency of cleanup_hosts function when 16 | # using pdsh 17 | echo $SLURM_NODELIST 18 | } 19 | 20 | # Variables specific to SLURM 21 | nnodes=$SLURM_NNODES 22 | 23 | nres_sets=$SLURM_NNODES 24 | nprocs=${UNIFYFS_CI_NPROCS:-1} 25 | 26 | app_out="-o" 27 | app_err="-e" 28 | JOB_RUN_COMMAND="srun -N ${nnodes} --ntasks-per-node=${nprocs}" 29 | JOB_RUN_ONCE_PER_NODE="srun -n ${nnodes}" 30 | JOB_ID=${JOB_ID:-$SLURM_JOBID} 31 | 32 | # Set up producer-consumer variables and functions when using two or more hosts 33 | if [[ $nnodes -ge 2 ]]; then 34 | # Prereq for running 300-producer-consumer-tests.sh 35 | test_set_prereq MULTIPLE_HOSTS 36 | 37 | # Get list of unique host names 38 | # Only want to run once as order can change each time 39 | # One alternative is to parse SLURM_NODELIST, which can get ugly 40 | SLURM_HOSTS=$($JOB_RUN_ONCE_PER_NODE hostname) 41 | 42 | # Get the initial half of the hosts in the current allocation 43 | get_initial_hosts() 44 | { 45 | local l_initial_hosts=$(echo "$SLURM_HOSTS" | head -n $(($nnodes / 2))) 46 | # Replace spaces with commas 47 | local l_initial_hostlist=$(echo $l_initial_hosts | tr ' ' ',') 48 | echo $l_initial_hostlist 49 | } 50 | 51 | # Get the latter half of the hosts in the current allocation 52 | get_latter_hosts() 53 | { 54 | local l_latter_hosts=$(echo "$SLURM_HOSTS" | tail -n $(($nnodes / 2))) 55 | # Replace spaces with commas 56 | local l_latter_hostlist=$(echo $l_latter_hosts | tr ' ' ',') 57 | echo $l_latter_hostlist 58 | } 59 | 60 | exclude_option="-x" 61 | JOB_RUN_HALF_NODES="srun -N $(($nnodes/2)) --ntasks-per-node=${nprocs}" 62 | fi 63 | 64 | echo "$infomsg ====================== SLURM Job Info ======================" 65 | echo "$infomsg ------------------------ Job Status ------------------------" 66 | scontrol show job $JOB_ID 67 | echo "$infomsg ------------------------------------------------------------" 68 | -------------------------------------------------------------------------------- /t/lib/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -Wall -Werror 2 | 3 | AM_CPPFLAGS = 4 | 5 | lib_LTLIBRARIES = libtap.la libtestutil.la 6 | 7 | libtap_la_SOURCES = tap.c tap.h 8 | libtestutil_la_SOURCES = testutil.c testutil.h 9 | -------------------------------------------------------------------------------- /t/lib/testutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | 17 | /* 18 | * Store a random string of length @len into buffer @buf. 19 | */ 20 | void testutil_rand_string(char* buf, size_t len); 21 | 22 | /* 23 | * Generate a path of length @len and store it into buffer @buf. The 24 | * path will begin with the NUL-terminated string pointed to by @pfx, 25 | * followed by a slash (/), followed by a random sequence of characters. 26 | */ 27 | void testutil_rand_path(char* buf, size_t len, const char* pfx); 28 | 29 | /* 30 | * Return a pointer to the path name of the test temp directory. Use the 31 | * value of the environment variable UNIFYFS_TEST_TMPDIR if it exists, 32 | * otherwise use P_tmpdir (defined in stdio.h, typically '/tmp'). 33 | */ 34 | char* testutil_get_tmp_dir(void); 35 | 36 | /* 37 | * Return a pointer to the path name of the UnifyFS mount point. Use the 38 | * value of the environment variable UNIFYFS_MOUNTPOINT if it exists, 39 | * otherwise use 'tmpdir/unifyfs'. 40 | */ 41 | char* testutil_get_mount_point(void); 42 | 43 | /* Stat the file associated to by path and store the global size of the 44 | * file at path in the address of the global pointer passed in. */ 45 | void testutil_get_size(char* path, size_t* global); 46 | 47 | /* Sequentially number every 8 bytes (uint64_t) in given buffer */ 48 | void testutil_lipsum_generate(char* buf, uint64_t len, uint64_t offset); 49 | 50 | /* 51 | * Check buffer contains lipsum generated data. 52 | * returns 0 on success, -1 otherwise with @error_offset set. 53 | */ 54 | int testutil_lipsum_check(const char* buf, uint64_t len, uint64_t offset, 55 | uint64_t* error_offset); 56 | 57 | 58 | /* 59 | * Check buffer contains all zero bytes. 60 | * returns 0 on success, -1 otherwise. 61 | */ 62 | int testutil_zero_check(const char* buf, size_t len); 63 | -------------------------------------------------------------------------------- /t/sharness.d/00-test-env.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Export some variables used by the test suite. 3 | # 4 | # UNIFYFS_BUILD_DIR is set to build path (based on current directory) 5 | # 6 | if test -z "$UNIFYFS_BUILD_DIR"; then 7 | if test -z "${builddir}"; then 8 | UNIFYFS_BUILD_DIR="$(cd .. && pwd)" 9 | else 10 | UNIFYFS_BUILD_DIR="$(cd ${builddir}/.. && pwd))" 11 | fi 12 | export UNIFYFS_BUILD_DIR 13 | fi 14 | 15 | # 16 | # Name of script created during test run initialization 17 | # to store dynamically generated paths for mountpoints and 18 | # metadata directories. 19 | # 20 | export UNIFYFS_TEST_RUN_SCRIPT=$UNIFYFS_BUILD_DIR/t/test_run_env.sh 21 | 22 | # 23 | # Find MPI job launcher. 24 | # 25 | if test -n "$(which jsrun 2>/dev/null)"; then 26 | JOB_RUN_COMMAND="jsrun -r1 -n1" 27 | elif test -n "$(which srun 2>/dev/null)"; then 28 | JOB_RUN_COMMAND="srun -n1 -N1 --overlap" 29 | elif test -n "$(which mpirun 2>/dev/null)"; then 30 | JOB_RUN_COMMAND="mpirun -np 1" 31 | if [ $UID -eq 0 ]; then 32 | mpirun --version |& fgrep 'Open MPI' >/dev/null 2>&1 33 | if [ $? -eq 0 ]; then 34 | JOB_RUN_COMMAND="mpirun -np 1 --allow-run-as-root" 35 | fi 36 | fi 37 | fi 38 | if test -z "$JOB_RUN_COMMAND"; then 39 | echo >&2 "Failed to find a suitable parallel job launcher" 40 | echo >&2 "Do you need to install OpenMPI or SLURM?" 41 | return 1 42 | fi 43 | #echo >&2 "Using JOB_RUN_COMMAND: $JOB_RUN_COMMAND" 44 | export JOB_RUN_COMMAND 45 | 46 | # 47 | # Set paths to executables 48 | # 49 | export UNIFYFSD=$UNIFYFS_BUILD_DIR/server/src/unifyfsd 50 | 51 | 52 | # On systems with YAMA kernel support, Mercury's shared memory NA 53 | # requires cross-memory attach to be enabled: 54 | # sysctl -w kernel.yama.ptrace_scope=0 55 | if [ -f /proc/sys/kernel/yama/ptrace_scope ]; then 56 | scope_val=`cat /proc/sys/kernel/yama/ptrace_scope` 57 | if [ $scope_val -ne 0 ]; then 58 | if [ $UID -eq 0 ]; then 59 | echo 0 > /proc/sys/kernel/yama/ptrace_scope 2>/dev/null || 60 | echo >&2 "Failed to enable cross-memory attach for Mercury shmem" 61 | else 62 | echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 2>/dev/null || 63 | echo >&2 "Failed to enable cross-memory attach for Mercury shmem" 64 | fi 65 | fi 66 | fi 67 | 68 | # Want core dumps? uncomment following line 69 | #ulimit -c unlimited 70 | -------------------------------------------------------------------------------- /t/sharness.d/01-unifyfs-settings.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Export variables to control UNIFYFS runtime settings. 3 | # 4 | 5 | # 6 | # Source a script that is dynamically generated by 0001-setup.t. 7 | # 8 | source $UNIFYFS_TEST_RUN_SCRIPT 9 | 10 | # Common settings 11 | export UNIFYFS_LOG_VERBOSITY=${UNIFYFS_LOG_VERBOSITY:-5} 12 | export UNIFYFS_MOUNTPOINT=${UNIFYFS_TEST_MOUNT:-"/unifyfs"} 13 | 14 | # Server settings 15 | export UNIFYFS_LOG_DIR=${UNIFYFS_LOG_DIR:-$UNIFYFS_TEST_STATE} 16 | export UNIFYFS_LOG_FILE="unifyfsd.log" 17 | export UNIFYFS_META_DB_PATH=${UNIFYFS_TEST_META} 18 | export UNIFYFS_RUNSTATE_DIR=${UNIFYFS_TEST_STATE} 19 | export UNIFYFS_SHAREDFS_DIR=${UNIFYFS_TEST_SHARE} 20 | 21 | # Client settings 22 | export UNIFYFS_LOGIO_CHUNK_SIZE=$((32 * 1024)) 23 | export UNIFYFS_LOGIO_SHMEM_SIZE=$((64 * 1048576)) 24 | export UNIFYFS_LOGIO_SPILL_SIZE=$((512 * 1048576)) 25 | export UNIFYFS_LOGIO_SPILL_DIR=${UNIFYFS_TEST_SPILL} 26 | 27 | # In mercury 2.0.0, daemonize breaks our use of na+sm. More info 28 | # available at https://github.com/mercury-hpc/mercury/issues/428. 29 | # Once https://github.com/mercury-hpc/mercury/pull/430 is merged, 30 | # and we are using a version of mercury that includes the fix, 31 | # we can remove this setting. 32 | export UNIFYFS_DAEMONIZE=off 33 | -------------------------------------------------------------------------------- /t/std/fflush.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | /* 16 | * Test fflush(). Currently this test is skipped until #374 is addressed. 17 | */ 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "t/lib/tap.h" 25 | #include "t/lib/testutil.h" 26 | 27 | int fflush_test(char* unifyfs_root) 28 | { 29 | char path[64]; 30 | char buf[64] = {0}; 31 | FILE* fp = NULL; 32 | int err, rc; 33 | 34 | /* Generate a random file name in the mountpoint path to test on */ 35 | testutil_rand_path(path, sizeof(path), unifyfs_root); 36 | 37 | /* Write "hello world" to a file */ 38 | errno = 0; 39 | fp = fopen(path, "w"); 40 | err = errno; 41 | ok(fp != NULL, "%s: fopen(%s): %s", __FILE__, path, strerror(err)); 42 | 43 | errno = 0; 44 | rc = fwrite("hello world", 12, 1, fp); 45 | err = errno; 46 | ok(rc == 1, "%s: fwrite(\"hello world\"): %s", __FILE__, strerror(err)); 47 | 48 | /* Flush the extents */ 49 | errno = 0; 50 | rc = fflush(fp); 51 | err = errno; 52 | ok(rc == 0, "%s: fflush() (rc=%d): %s", __FILE__, rc, strerror(err)); 53 | 54 | errno = 0; 55 | rc = fclose(fp); 56 | err = errno; 57 | ok(rc == 0, "%s: fclose() (rc=%d): %s", __FILE__, rc, strerror(err)); 58 | 59 | /* Laminate */ 60 | errno = 0; 61 | rc = chmod(path, 0444); 62 | err = errno; 63 | ok(rc == 0, "%s: chmod(0444) (rc=%d): %s", __FILE__, strerror(err)); 64 | 65 | /* Read it back */ 66 | errno = 0; 67 | fp = fopen(path, "r"); 68 | err = errno; 69 | ok(fp != NULL, "%s: fopen(%s): %s", __FILE__, path, strerror(err)); 70 | 71 | errno = 0; 72 | rc = fread(buf, 12, 1, fp); 73 | err = errno; 74 | ok(rc == 1, "%s: fread() buf[]=\"%s\", (rc %d): %s", __FILE__, buf, rc, 75 | strerror(err)); 76 | is(buf, "hello world", "%s: saw \"hello world\"", __FILE__); 77 | 78 | errno = 0; 79 | rc = fclose(fp); 80 | err = errno; 81 | ok(rc == 0, "%s: fclose() (rc=%d): %s", __FILE__, rc, strerror(err)); 82 | 83 | //end_skip; 84 | 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /t/std/stdio_suite.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include "t/lib/tap.h" 19 | #include "t/lib/testutil.h" 20 | 21 | #include "stdio_suite.h" 22 | 23 | /* The test suite for stdio wrappers found in client/src/unifyfs-stdio.c. 24 | * 25 | * 26 | * To add new tests to existing stdio tests: 27 | * 1. Simply add the tests (order matters) to the appropriate 28 | * .c file. 29 | * 30 | * 31 | * When a new wrapper in unifyfs-stdio.c needs to be tested: 32 | * 1. Create a .c file with a function called 33 | * _test(char* unifyfs_root) that contains all the TAP 34 | * tests specific to that wrapper. 35 | * 2. Add the _test to stdio_suite.h. 36 | * 3. Add the .c file to the /t/Makefile.am under the 37 | * appropriate test suite at the bottom. 38 | * 4. The _test function can now be called from this test 39 | * suite. */ 40 | int main(int argc, char* argv[]) 41 | { 42 | int rank_num; 43 | int rank; 44 | char* unifyfs_root; 45 | int rc; 46 | 47 | MPI_Init(&argc, &argv); 48 | MPI_Comm_size(MPI_COMM_WORLD, &rank_num); 49 | MPI_Comm_rank(MPI_COMM_WORLD, &rank); 50 | 51 | plan(NO_PLAN); 52 | 53 | unifyfs_root = testutil_get_mount_point(); 54 | 55 | /* Verify unifyfs_mount succeeds. */ 56 | rc = unifyfs_mount(unifyfs_root, rank, rank_num); 57 | ok(rc == 0, "unifyfs_mount(%s) (rc=%d)", unifyfs_root, rc); 58 | 59 | if (rc != 0) { 60 | BAIL_OUT("unifyfs_mount in stdio_suite failed"); 61 | } 62 | 63 | /* Add tests for new functions below in the order desired for testing. 64 | * 65 | * *** NOTE *** 66 | * The order of tests does matter as some subsequent tests use functions 67 | * that were already tested. Thus if an earlier test fails, it could cause 68 | * later tests to fail as well. If this occurs, fix the bugs causing the 69 | * tests that ran first to break as that is likely to cause subsequent 70 | * failures to start passing. */ 71 | 72 | fopen_fclose_test(unifyfs_root); 73 | 74 | fseek_ftell_test(unifyfs_root); 75 | 76 | fwrite_fread_test(unifyfs_root); 77 | 78 | fflush_test(unifyfs_root); 79 | 80 | size_test(unifyfs_root); 81 | truncate_on_open(unifyfs_root); 82 | 83 | rc = unifyfs_unmount(); 84 | ok(rc == 0, "unifyfs_unmount(%s) (rc=%d)", unifyfs_root, rc); 85 | 86 | MPI_Finalize(); 87 | 88 | done_testing(); 89 | 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /t/std/stdio_suite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | 16 | /* This is the collection of stdio wrapper tests to be run inside of 17 | * stdio_suite.c. These tests are testing the wrapper functions found in 18 | * client/src/unifyfs-stdio.c. 19 | * 20 | * 21 | * When a new wrapper in unifyfs-stdio.c needs to be tested: 22 | * 1. Create a .c file with a function called 23 | * _test(char* unifyfs_root) that contains all the TAP 24 | * tests for that wrapper. 25 | * 2. Add the function name to this file, with comments. 26 | * 3. Add the .c file to the /t/Makefile.am under the 27 | * appropriate test suite at the bottom. 28 | * 4. The _test function can now be called from 29 | * stdio_suite.c. */ 30 | #ifndef STDIO_SUITE_H 31 | #define STDIO_SUITE_H 32 | 33 | /* Tests for UNIFYFS_WRAP(fopen) and UNIFYFS_WRAP(fclose) */ 34 | int fopen_fclose_test(char* unifyfs_root); 35 | 36 | /* Tests for UNIFYFS_WRAP(fseek/ftell/rewind) */ 37 | int fseek_ftell_test(char* unifyfs_root); 38 | 39 | /* Tests for UNIFYFS_WRAP(fwrite) and UNIFYFS_WRAP(fread) */ 40 | int fwrite_fread_test(char* unifyfs_root); 41 | 42 | /* Tests for UNIFYFS_WRAP(fflush) */ 43 | int fflush_test(char* unifyfs_root); 44 | 45 | /* Tests for UNIFYFS_WRAP(size) */ 46 | int size_test(char* unifyfs_root); 47 | 48 | /* Tests for UNIFYFS_WRAP(fopen) truncate */ 49 | int truncate_on_open(char* unifyfs_root); 50 | 51 | #endif /* STDIO_SUITE_H */ 52 | -------------------------------------------------------------------------------- /t/sys/creat-close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "t/lib/tap.h" 21 | #include "t/lib/testutil.h" 22 | 23 | /* This function contains the tests for UNIFYFS_WRAP(creat) and 24 | * UNIFYFS_WRAP(close) found in client/src/unifyfs-sysio.c. 25 | * 26 | * Notice the tests are ordered in a logical testing order. Changing the order 27 | * or adding new tests in between two others could negatively affect the 28 | * desired results. */ 29 | int creat_close_test(char* unifyfs_root) 30 | { 31 | /* Diagnostic message for reading and debugging output */ 32 | diag("Starting UNIFYFS_WRAP(creat/close) tests"); 33 | 34 | char path[64]; 35 | int mode = 0600; 36 | int fd = -1; 37 | int err, rc; 38 | 39 | /* Create a random file name at the mountpoint path to test on */ 40 | testutil_rand_path(path, sizeof(path), unifyfs_root); 41 | 42 | /* Verify closing a non-existent file fails with errno=EBADF */ 43 | errno = 0; 44 | rc = close(fd); 45 | err = errno; 46 | ok(rc == -1 && err == EBADF, 47 | "%s:%d close non-existing file %s should fail (errno=%d): %s", 48 | __FILE__, __LINE__, path, err, strerror(err)); 49 | 50 | /* Verify we can create a non-existent file. */ 51 | errno = 0; 52 | fd = creat(path, mode); 53 | err = errno; 54 | ok(fd >= 0 && err == 0, 55 | "%s:%d creat non-existing file %s (fd=%d): %s", 56 | __FILE__, __LINE__, path, fd, strerror(err)); 57 | 58 | /* Verify close succeeds. */ 59 | errno = 0; 60 | rc = close(fd); 61 | err = errno; 62 | ok(rc == 0 && err == 0, "%s:%d close new file: %s", 63 | __FILE__, __LINE__, strerror(err)); 64 | 65 | /* Verify creating an already created file succeeds. */ 66 | errno = 0; 67 | fd = creat(path, mode); 68 | err = errno; 69 | ok(fd >= 0 && err == 0, 70 | "%s:%d creat existing file %s (fd=%d): %s", 71 | __FILE__, __LINE__, path, fd, strerror(err)); 72 | 73 | /* Verify close succeeds. */ 74 | errno = 0; 75 | rc = close(fd); 76 | err = errno; 77 | ok(rc == 0 && err == 0, "%s:%d close %s: %s", 78 | __FILE__, __LINE__, path, strerror(err)); 79 | 80 | /* Verify closing already closed file fails with errno=EBADF */ 81 | errno = 0; 82 | rc = close(fd); 83 | err = errno; 84 | ok(rc == -1 && err == EBADF, 85 | "%s:%d close already closed file %s should fail (errno=%d): %s", 86 | __FILE__, __LINE__, path, err, strerror(err)); 87 | 88 | /* CLEANUP 89 | * 90 | * Don't delete the file at path as the final test (9020-mountpoint-empty) 91 | * checks if anything files are found in the mountpoint, meaning creat 92 | * wasn't wrapped properly. */ 93 | 94 | diag("Finished UNIFYFS_WRAP(creat/close) tests"); 95 | 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /t/sys/creat64.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include "t/lib/tap.h" 22 | #include "t/lib/testutil.h" 23 | 24 | /* This function contains the tests for UNIFYFS_WRAP(creat64) found in 25 | * client/src/unifyfs-sysio.c. 26 | * 27 | * Notice the tests are ordered in a logical testing order. Changing the order 28 | * or adding new tests in between two others could negatively affect the 29 | * desired results. */ 30 | int creat64_test(char* unifyfs_root) 31 | { 32 | /* Diagnostic message for reading and debugging output */ 33 | diag("Starting UNIFYFS_WRAP(creat64) tests"); 34 | 35 | char path[64]; 36 | int mode = 0600; 37 | int err, fd; 38 | 39 | /* Create a random file name at the mountpoint path to test on */ 40 | testutil_rand_path(path, sizeof(path), unifyfs_root); 41 | 42 | /* Verify we can create a non-existent file. */ 43 | errno = 0; 44 | fd = creat64(path, mode); 45 | err = errno; 46 | ok(fd >= 0 && err == 0, 47 | "creat64 non-existing file %s (fd=%d): %s", 48 | path, fd, strerror(err)); 49 | 50 | ok(close(fd) != -1, "close() worked"); 51 | 52 | /* Verify creating an already created file succeeds. */ 53 | errno = 0; 54 | fd = creat64(path, mode); 55 | err = errno; 56 | ok(fd >= 0 && err == 0, 57 | "creat64 existing file %s (fd=%d): %s", 58 | path, fd, strerror(err)); 59 | 60 | ok(close(fd) != -1, "close() worked"); 61 | 62 | diag("Finished UNIFYFS_WRAP(creat64) tests"); 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /t/sys/open64.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "t/lib/tap.h" 24 | #include "t/lib/testutil.h" 25 | 26 | /* This function contains the tests for UNIFYFS_WRAP(open64) found in 27 | * client/src/unifyfs-sysio.c. 28 | * 29 | * Notice the tests are ordered in a logical testing order. Changing the order 30 | * or adding new tests in between two others could negatively affect the 31 | * desired results. */ 32 | int open64_test(char* unifyfs_root) 33 | { 34 | /* Diagnostic message for reading and debugging output */ 35 | diag("Starting UNIFYFS_WRAP(open64) tests"); 36 | 37 | char path[64]; 38 | int mode = 0600; 39 | int err, fd; 40 | 41 | /* Create a random file name at the mountpoint path to test on */ 42 | testutil_rand_path(path, sizeof(path), unifyfs_root); 43 | 44 | /* Verify opening a non-existent file without O_CREAT fails with 45 | * errno=ENOENT */ 46 | errno = 0; 47 | fd = open64(path, O_RDWR, mode); 48 | err = errno; 49 | ok(fd < 0 && err == ENOENT, 50 | "open64 non-existing file %s w/out O_CREATE fails (fd=%d, errno=%d): %s", 51 | path, fd, err, strerror(err)); 52 | 53 | /* Verify we can create a new file. */ 54 | errno = 0; 55 | fd = open64(path, O_CREAT|O_EXCL, mode); 56 | err = errno; 57 | ok(fd >= 0 && err == 0, 58 | "open64 non-existing file %s flags O_CREAT|O_EXCL (fd=%d): %s", 59 | path, fd, strerror(err)); 60 | 61 | ok(close(fd) != -1, "close() worked"); 62 | 63 | /* Verify opening an existing file with O_CREAT|O_EXCL fails with 64 | * errno=EEXIST. */ 65 | errno = 0; 66 | fd = open64(path, O_CREAT|O_EXCL, mode); 67 | err = errno; 68 | ok(fd < 0 && err == EEXIST, 69 | "open64 existing file %s O_CREAT|O_EXCL fails (fd=%d, errno=%d): %s", 70 | path, fd, err, strerror(err)); 71 | 72 | /* Verify opening an existing file with O_RDWR succeeds. */ 73 | errno = 0; 74 | fd = open64(path, O_RDWR, mode); 75 | err = errno; 76 | ok(fd >= 0 && err == 0, 77 | "open64 existing file %s O_RDWR (fd=%d): %s", 78 | path, fd, strerror(err)); 79 | 80 | ok(close(fd) != -1, "close() worked"); 81 | 82 | diag("Finished UNIFYFS_WRAP(open64) tests"); 83 | 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /t/sys/statfs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include "t/lib/tap.h" 22 | #include "t/lib/testutil.h" 23 | 24 | /* for statfs */ 25 | #include 26 | 27 | #include "unifyfs.h" 28 | 29 | /* This function contains the tests for UNIFYFS_WRAP(statfs) found in 30 | * client/src/unifyfs-sysio.c. */ 31 | int statfs_test(char* unifyfs_root, int expect_unifyfs_magic) 32 | { 33 | /* Diagnostic message for reading and debugging output */ 34 | diag("Starting UNIFYFS_WRAP(statfs) tests"); 35 | 36 | /* We call statfs on the mountpoint. */ 37 | const char* path = unifyfs_root; 38 | 39 | /* Call statfs and check that we get a 0 return code indicating success. */ 40 | struct statfs fs; 41 | errno = 0; 42 | int rc = statfs(path, &fs); 43 | int err = errno; 44 | ok(rc == 0, 45 | "statfs %s (rc=%d, errno=%d): %s", 46 | path, rc, err, strerror(err)); 47 | 48 | /* If statfs succeeded, check that we get the proper magic value back. */ 49 | if (rc == 0) { 50 | long int fs_magic = fs.f_type; 51 | if (expect_unifyfs_magic) { 52 | /* In this case, we expect to get UNIFYFS_SUPER_MAGIC. */ 53 | long int unifyfs_magic = UNIFYFS_SUPER_MAGIC; 54 | ok(fs_magic == unifyfs_magic, 55 | "checking statfs.f_type %lx against UNIFYFS expected value %lx", 56 | fs_magic, unifyfs_magic); 57 | } else { 58 | /* In this case, we expect to get TMPFS_MAGIC, see "man statfs". */ 59 | long int tmpfs_magic = 0x01021994; 60 | ok(fs_magic == tmpfs_magic, 61 | "checking statfs.f_type %lx against TMPFS expected value %lx", 62 | fs_magic, tmpfs_magic); 63 | } 64 | } 65 | 66 | diag("Finished UNIFYFS_WRAP(statfs) tests"); 67 | 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /t/sys/statfs_suite.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include "t/lib/tap.h" 19 | #include "t/lib/testutil.h" 20 | 21 | #include "statfs_suite.h" 22 | 23 | /* The test suite for statfs wrappers found in client/src/unifyfs-sysio.c. 24 | * 25 | * This is specifically designed to test stafs when client super magic has 26 | * been disabled, so that statfs returns TMPFS_MAGIC. */ 27 | int main(int argc, char* argv[]) 28 | { 29 | int rank_num; 30 | int rank; 31 | char* unifyfs_root; 32 | int rc; 33 | 34 | MPI_Init(&argc, &argv); 35 | MPI_Comm_size(MPI_COMM_WORLD, &rank_num); 36 | MPI_Comm_rank(MPI_COMM_WORLD, &rank); 37 | 38 | plan(NO_PLAN); 39 | 40 | unifyfs_root = testutil_get_mount_point(); 41 | 42 | /* Verify unifyfs_mount succeeds. */ 43 | rc = unifyfs_mount(unifyfs_root, rank, rank_num); 44 | ok(rc == 0, "unifyfs_mount(%s) (rc=%d)", unifyfs_root, rc); 45 | 46 | /* If the mount fails, bailout, as there is no point in running the tests */ 47 | if (rc != 0) { 48 | BAIL_OUT("unifyfs_mount in statfs_suite failed"); 49 | } 50 | 51 | /* check that statfs returns TMPFS_MAGIC 52 | * when UNIFYFS_CLIENT_SUPER_MAGIC=0 */ 53 | statfs_test(unifyfs_root, 0); 54 | 55 | rc = unifyfs_unmount(); 56 | ok(rc == 0, "unifyfs_unmount(%s) (rc=%d)", unifyfs_root, rc); 57 | 58 | MPI_Finalize(); 59 | 60 | done_testing(); 61 | 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /t/sys/statfs_suite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | 16 | /* This test checks that statfs returns the correct value when one 17 | * has set UNIFYFS_CLIENT_SUPER_MAGIC=0. It runs as a separate 18 | * test suite because it requires a different environmental 19 | * configuration than the other tests. */ 20 | #ifndef STATFS_SUITE_H 21 | #define STATFS_SUITE_H 22 | 23 | /* Tests for UNIFYFS_WRAP(statfs) */ 24 | int statfs_test(char* unifyfs_root, int expect_unifyfs_magic); 25 | 26 | #endif /* STATFS_SUITE_H */ 27 | -------------------------------------------------------------------------------- /t/sys/sysio_suite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2018, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | 16 | /* This is the collection of sysio wrapper tests to be run inside of 17 | * sysio_suite.c. These tests are testing the wrapper functions found in 18 | * client/src/unifyfs-sysio.c. 19 | * 20 | * 21 | * When a new wrapper in unifyfs-sysio.c needs to be tested: 22 | * 1. Create a .c file with a function called 23 | * _test(char *unifyfs_root) that contains all the TAP 24 | * tests for that wrapper. 25 | * 2. Add the function name to this file, with comments. 26 | * 3. Add the .c file to the /t/Makefile.am under the 27 | * appropriate test suite at the bottom. 28 | * 4. The _test function can now be called from 29 | * sysio_suite.c. */ 30 | #ifndef SYSIO_SUITE_H 31 | #define SYSIO_SUITE_H 32 | 33 | /* Tests for UNIFYFS_WRAP(statfs) */ 34 | int statfs_test(char* unifyfs_root, int expect_unifyfs_magic); 35 | 36 | /* Tests for UNIFYFS_WRAP(creat) and UNIFYFS_WRAP(close) */ 37 | int creat_close_test(char* unifyfs_root); 38 | 39 | /* Tests for UNIFYFS_WRAP(creat64) */ 40 | int creat64_test(char* unifyfs_root); 41 | 42 | /* Tests for UNIFYFS_WRAP(mkdir) and UNIFYFS_WRAP(rmdir) */ 43 | int mkdir_rmdir_test(char* unifyfs_root); 44 | 45 | /* Tests for UNIFYFS_WRAP(open) */ 46 | int open_test(char* unifyfs_root); 47 | 48 | /* Tests for UNIFYFS_WRAP(open64) */ 49 | int open64_test(char* unifyfs_root); 50 | 51 | /* Tests for UNIFYFS_WRAP(lseek) */ 52 | int lseek_test(char* unifyfs_root); 53 | 54 | int write_read_test(char* unifyfs_root); 55 | int write_max_read_test(char* unifyfs_root); 56 | int write_pre_existing_file_test(char* unifyfs_root); 57 | 58 | /* test reading from file with holes */ 59 | int write_read_hole_test(char* unifyfs_root); 60 | 61 | /* Tests for UNIFYFS_WRAP(ftruncate) and UNIFYFS_WRAP(truncate) */ 62 | int truncate_test(char* unifyfs_root); 63 | int truncate_bigempty(char* unifyfs_root); 64 | int truncate_eof(char* unifyfs_root); 65 | int truncate_truncsync(char* unifyfs_root); 66 | int truncate_pattern_size(char* unifyfs_root, int pos); 67 | int truncate_empty_read(char* unifyfs_root, int pos); 68 | int truncate_ftrunc_before_sync(char* unifyfs_root); 69 | int truncate_trunc_before_sync(char* unifyfs_root); 70 | int truncate_twice(char* unifyfs_root); 71 | 72 | /* Test for UNIFYFS_WRAP(unlink) */ 73 | int unlink_test(char* unifyfs_root); 74 | 75 | int chdir_test(char* unifyfs_root); 76 | 77 | /* Test for UNIFYFS_WRAP(stat, lstat, fstat) */ 78 | int stat_test(char* unifyfs_root); 79 | 80 | #endif /* SYSIO_SUITE_H */ 81 | -------------------------------------------------------------------------------- /t/unifyfs_unmount.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "t/lib/tap.h" 5 | #include "t/lib/testutil.h" 6 | 7 | int main(int argc, char* argv[]) 8 | { 9 | char* unifyfs_root; 10 | int rank_num; 11 | int rank; 12 | int rc; 13 | 14 | MPI_Init(&argc, &argv); 15 | MPI_Comm_size(MPI_COMM_WORLD, &rank_num); 16 | MPI_Comm_rank(MPI_COMM_WORLD, &rank); 17 | 18 | plan(NO_PLAN); 19 | 20 | unifyfs_root = testutil_get_mount_point(); 21 | 22 | /* 23 | * Verify unifyfs_mount succeeds. 24 | */ 25 | rc = unifyfs_mount(unifyfs_root, rank, rank_num); 26 | ok(rc == 0, "unifyfs_mount at %s (rc=%d)", unifyfs_root, rc); 27 | 28 | rc = unifyfs_unmount(); 29 | ok(rc == 0, "unifyfs_unmount succeeds (rc=%d)", rc); 30 | 31 | MPI_Finalize(); 32 | 33 | done_testing(); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /util/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = scripts unifyfs unifyfs-api-client unifyfs-stage 2 | -------------------------------------------------------------------------------- /util/scripts/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = lsfcsm 2 | -------------------------------------------------------------------------------- /util/scripts/lsfcsm/Makefile.am: -------------------------------------------------------------------------------- 1 | sbin_SCRIPTS = unifyfs_lsfcsm_prolog unifyfs_lsfcsm_epilog 2 | 3 | CLEANFILES = $(sbin_SCRIPTS) 4 | -------------------------------------------------------------------------------- /util/scripts/lsfcsm/README.md: -------------------------------------------------------------------------------- 1 | ### Integration with IBM Platform LSF with Cluster System Manager (CSM) 2 | 3 | To enable job-level integration of UnifyFS, where the UnifyFS daemon 4 | is automatically launched on each node during job startup and 5 | terminate once the job completes, additions must be made 6 | to the CSM prologue and epilogue Python scripts. Typically, 7 | these CSM scripts are found somewhere within the `/opt/ibm/csm` 8 | directory and named `privileged_prolog` and `privileged_epilog`. 9 | Consult with your LSF system administrator for more precise location 10 | information, and to make the changes described below. 11 | 12 | We provide helper scripts that launch and terminate a UnifyFS daemon 13 | (i.e., `unifyfsd`) on a node. The scripts are: 14 | * launch: `/sbin/unifyfs_lsfcsm_prolog` 15 | * terminate: `/sbin/unifyfs_lsfcsm_epilog` 16 | 17 | Integration of the helper scripts requires editing the CSM prologue and 18 | epilogue scripts to support a new "unifyfs" job allocation flag. 19 | Users may specify the allocation flag as an option to the `bsub` 20 | command: 21 | ```shell 22 | [prompt]$ bsub -alloc_flags unifyfs jobscript.lsf 23 | ``` 24 | Alternatively, the job script may contain the flag as a `#BSUB` 25 | directive: 26 | ```shell 27 | #! /bin/bash -l 28 | #BSUB -alloc_flags UNIFYFS 29 | ``` 30 | 31 | Supporting the new flag is as simple as adding a new `elif` block to 32 | the flag parsing loop, as shown below for an excerpt from 33 | `privileged_prolog`. Note that the CSM scripts use uppercase strings 34 | for flag comparison. 35 | 36 | ```python 37 | flags = args.user_flags.split(" ") 38 | regex = re.compile ("(\D+)(\d*)$") 39 | for feature in flags: 40 | fparse = regex.match (feature.upper()) 41 | if hasattr(fparse, 'group'): 42 | if fparse.group(0) == "HUGEPAGES": 43 | os.chmod("/dev/hugepages", 1777) 44 | elif fparse.group(0) == "UNIFYFS": 45 | cmd = ['%s/unifyfs_lsfcsm_prolog' % JOB_SCRIPT_DIR] 46 | runcmd (cmd) 47 | ``` 48 | 49 | The provided helper scripts should be installed as root to the 50 | `JOB_SCRIPT_DIR` used by the CSM scripts (e.g., `/opt/ibm/csm/prologs`). 51 | 52 | 53 | -------------------------------------------------------------------------------- /util/scripts/lsfcsm/unifyfs_lsfcsm_epilog.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bindir=@unifyfs_bin_path@ 4 | unifyfsd=$bindir/unifyfsd 5 | 6 | exec &>> /var/log/unifyfs-lsfcsm.$CSM_PRIMARY_JOB_ID 7 | 8 | echo "Stopping UnifyFS daemon" 9 | 10 | if [[ -x $(type -p pkill) ]]; then 11 | echo "running: pkill unifyfsd" 12 | pkill unifyfsd 13 | elif [[ -x $(type -p pidof) ]]; then 14 | pid=$(pidof -s $unifyfsd) 15 | if [[ -n $pid ]]; then 16 | echo "running: kill $pid" 17 | kill $pid 18 | fi 19 | fi 20 | 21 | -------------------------------------------------------------------------------- /util/scripts/lsfcsm/unifyfs_lsfcsm_prolog.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bindir=@unifyfs_bin_path@ 4 | unifyfsd=$bindir/unifyfsd 5 | 6 | exec &>> /var/log/unifyfs-lsfcsm.$CSM_PRIMARY_JOB_ID 7 | 8 | echo "Starting UnifyFS daemon" 9 | 10 | if [[ -f /etc/rc.d/init.d/functions ]]; then 11 | source /etc/rc.d/init.d/functions 12 | echo "running: daemon --user=$CSM_USER_NAME $unifyfsd" 13 | daemon --user=$CSM_USER_NAME $unifyfsd & 14 | elif [[ -x $(type -p runuser) ]]; then 15 | echo "running: runuser -s /bin/bash $CSM_USER_NAME -c $unifyfsd" 16 | runuser -s /bin/bash $CSM_USER_NAME -c $unifyfsd & 17 | elif [[ -x $(type -p su) ]]; then 18 | echo "running: su -s /bin/bash $CSM_USER_NAME -c $unifyfsd" 19 | su -s /bin/bash $CSM_USER_NAME -c $unifyfsd & 20 | else 21 | # WHAT KIND OF SYSTEM IS THIS? 22 | echo "ERROR: $0 - unable to run unifyfsd as user $CSM_USER_NAME" 23 | exit 1 24 | fi 25 | 26 | -------------------------------------------------------------------------------- /util/unifyfs-api-client/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /util/unifyfs-api-client/src/Makefile.am: -------------------------------------------------------------------------------- 1 | libexec_PROGRAMS = \ 2 | unifyfs-laminate \ 3 | unifyfs-remove 4 | 5 | bin_PROGRAMS = \ 6 | unifyfs-ls 7 | 8 | CLEANFILES = $(libexec_PROGRAMS) $(bin_PROGRAMS) 9 | 10 | # Compiler/linker flags 11 | 12 | AM_CFLAGS = -Wall -Werror 13 | 14 | api_client_cppflags = \ 15 | $(AM_CPPFLAGS) \ 16 | -I$(top_srcdir)/client/src \ 17 | -I$(top_srcdir)/common/src 18 | 19 | api_client_cxxflags = \ 20 | $(AM_CXXFLAGS) \ 21 | -std=c++11 22 | 23 | api_client_ldadd = $(top_builddir)/client/src/libunifyfs_api.la 24 | api_client_ldflags = $(AM_LDFLAGS) -static 25 | 26 | # Per-target flags begin here 27 | 28 | unifyfs_laminate_CPPFLAGS = $(api_client_cppflags) 29 | unifyfs_laminate_LDADD = $(api_client_ldadd) 30 | unifyfs_laminate_LDFLAGS = $(api_client_ldflags) 31 | unifyfs_laminate_SOURCES = unifyfs-laminate.c 32 | 33 | unifyfs_ls_CPPFLAGS = $(api_client_cppflags) 34 | unifyfs_ls_CXXFLAGS = $(api_client_cxxflags) 35 | unifyfs_ls_LDADD = $(api_client_ldadd) 36 | unifyfs_ls_LDFLAGS = $(api_client_ldflags) 37 | unifyfs_ls_SOURCES = unifyfs-ls.cpp 38 | 39 | unifyfs_remove_CPPFLAGS = $(api_client_cppflags) 40 | unifyfs_remove_LDADD = $(api_client_ldadd) 41 | unifyfs_remove_LDFLAGS = $(api_client_ldflags) 42 | unifyfs_remove_SOURCES = unifyfs-remove.c 43 | -------------------------------------------------------------------------------- /util/unifyfs-api-client/src/unifyfs-laminate.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include "unifyfs_api.h" 17 | 18 | static void usage(char* arg0) 19 | { 20 | fprintf(stderr, "USAGE: %s [ ...]\n", 21 | arg0); 22 | fflush(stderr); 23 | } 24 | 25 | int main(int argc, char** argv) 26 | { 27 | if (argc < 3) { 28 | fprintf(stderr, "USAGE ERROR: expected two or more arguments!\n"); 29 | usage(argv[0]); 30 | return -1; 31 | } 32 | 33 | char* mountpt = argv[1]; 34 | 35 | unifyfs_handle fshdl; 36 | unifyfs_rc urc = unifyfs_initialize(mountpt, NULL, 0, &fshdl); 37 | if (UNIFYFS_SUCCESS != urc) { 38 | fprintf(stderr, "UNIFYFS ERROR: init failed at mountpoint %s - %s\n", 39 | mountpt, unifyfs_rc_enum_description(urc)); 40 | return 1; 41 | } 42 | 43 | for (int i = 2; i < argc; i++) { 44 | char* filepath = argv[i]; 45 | urc = unifyfs_laminate(fshdl, filepath); 46 | if (UNIFYFS_SUCCESS != urc) { 47 | fprintf(stderr, "UNIFYFS ERROR: failed to laminate file %s - %s\n", 48 | filepath, unifyfs_rc_enum_description(urc)); 49 | return 2; 50 | } 51 | } 52 | 53 | urc = unifyfs_finalize(fshdl); 54 | if (UNIFYFS_SUCCESS != urc) { 55 | fprintf(stderr, "UNIFYFS ERROR: failed to finalize - %s\n", 56 | unifyfs_rc_enum_description(urc)); 57 | return 3; 58 | } 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /util/unifyfs-api-client/src/unifyfs-remove.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Lawrence Livermore National Security, LLC. 3 | * Produced at the Lawrence Livermore National Laboratory. 4 | * 5 | * Copyright 2021, UT-Battelle, LLC. 6 | * 7 | * LLNL-CODE-741539 8 | * All rights reserved. 9 | * 10 | * This is the license for UnifyFS. 11 | * For details, see https://github.com/LLNL/UnifyFS. 12 | * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. 13 | */ 14 | 15 | #include 16 | #include "unifyfs_api.h" 17 | 18 | static void usage(char* arg0) 19 | { 20 | fprintf(stderr, "USAGE: %s [ ...]\n", 21 | arg0); 22 | fflush(stderr); 23 | } 24 | 25 | int main(int argc, char** argv) 26 | { 27 | if (argc < 3) { 28 | fprintf(stderr, "USAGE ERROR: expected two arguments!\n"); 29 | usage(argv[0]); 30 | return -1; 31 | } 32 | 33 | char* mountpt = argv[1]; 34 | 35 | unifyfs_handle fshdl; 36 | unifyfs_rc urc = unifyfs_initialize(mountpt, NULL, 0, &fshdl); 37 | if (UNIFYFS_SUCCESS != urc) { 38 | fprintf(stderr, "UNIFYFS ERROR: init failed at mountpoint %s - %s\n", 39 | mountpt, unifyfs_rc_enum_description(urc)); 40 | return 1; 41 | } 42 | 43 | for (int i = 2; i < argc; i++) { 44 | char* filepath = argv[i]; 45 | urc = unifyfs_remove(fshdl, filepath); 46 | if (UNIFYFS_SUCCESS != urc) { 47 | fprintf(stderr, "UNIFYFS ERROR: failed to remove file %s - %s\n", 48 | filepath, unifyfs_rc_enum_description(urc)); 49 | return 2; 50 | } 51 | } 52 | 53 | urc = unifyfs_finalize(fshdl); 54 | if (UNIFYFS_SUCCESS != urc) { 55 | fprintf(stderr, "UNIFYFS ERROR: failed to finalize - %s\n", 56 | unifyfs_rc_enum_description(urc)); 57 | return 3; 58 | } 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /util/unifyfs-stage/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /util/unifyfs-stage/src/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = unifyfs-stage 2 | 3 | noinst_HEADERS = unifyfs-stage.h 4 | 5 | CLEANFILES = $(libexec_PROGRAMS) 6 | 7 | # Compiler/linker flags 8 | 9 | AM_CFLAGS = -Wall -Werror 10 | 11 | stage_cppflags = $(AM_CPPFLAGS) $(MPI_CFLAGS) \ 12 | $(OPENSSL_CFLAGS) \ 13 | -I$(top_srcdir)/client/src \ 14 | -I$(top_srcdir)/common/src 15 | 16 | stage_unify_lib = $(top_builddir)/client/src/libunifyfs_api.la 17 | 18 | stage_ldadd = \ 19 | $(stage_unify_lib) \ 20 | -lrt -lm \ 21 | $(OPENSSL_LIBS) \ 22 | $(MPI_CLDFLAGS) 23 | 24 | stage_ldflags = \ 25 | $(AM_LDFLAGS) \ 26 | -static 27 | 28 | # Per-target flags begin here 29 | 30 | stage_sources = \ 31 | unifyfs-stage.c \ 32 | unifyfs-stage-transfer.c 33 | 34 | unifyfs_stage_CPPFLAGS = $(stage_cppflags) 35 | unifyfs_stage_LDADD = $(stage_ldadd) 36 | unifyfs_stage_LDFLAGS = $(stage_ldflags) 37 | unifyfs_stage_SOURCES = $(stage_sources) 38 | 39 | 40 | -------------------------------------------------------------------------------- /util/unifyfs-stage/src/unifyfs-stage.h: -------------------------------------------------------------------------------- 1 | #ifndef UNIFYFS_STAGE_H 2 | #define UNIFYFS_STAGE_H 3 | 4 | #include "unifyfs_api.h" 5 | #include "unifyfs_misc.h" 6 | 7 | #ifndef UNIFYFS_STAGE_MD5_BLOCKSIZE 8 | #define UNIFYFS_STAGE_MD5_BLOCKSIZE (1048576) 9 | #endif 10 | 11 | #ifndef UNIFYFS_STAGE_TRANSFER_BLOCKSIZE 12 | #define UNIFYFS_STAGE_TRANSFER_BLOCKSIZE (16 * 1048576) 13 | #endif 14 | 15 | extern int verbose; 16 | 17 | enum { 18 | UNIFYFS_STAGE_MODE_SERIAL = 0, /* sequential file transfers */ 19 | UNIFYFS_STAGE_MODE_PARALLEL = 1, /* concurrent file transfers */ 20 | UNIFYFS_STAGE_DATA_BALANCED = 2, /* balanced data placement */ 21 | UNIFYFS_STAGE_DATA_SKEWED = 3 /* skewed data placement */ 22 | }; 23 | 24 | struct _unifyfs_stage { 25 | int checksum; /* perform checksum? 0:no, 1:yes */ 26 | int data_dist; /* data distribution? UNIFYFS_STAGE_DATA_xxxx */ 27 | int mode; /* transfer mode? UNIFYFS_STAGE_MODE_xxxx */ 28 | 29 | int rank; /* my rank */ 30 | int total_ranks; /* mpi world size */ 31 | 32 | char* mountpoint; /* unifyfs mountpoint */ 33 | char* manifest_file; /* manifest file containing the transfer list */ 34 | 35 | unifyfs_handle fshdl; /* UnifyFS API client handle */ 36 | }; 37 | typedef struct _unifyfs_stage unifyfs_stage; 38 | 39 | void print_unifyfs_stage_context(unifyfs_stage* ctx); 40 | 41 | /** 42 | * @brief parses manifest file line, passes back src and dst strings 43 | * 44 | * @param line_number manifest file line number 45 | * @param line manifest file line 46 | * @param[out] src_file source file path 47 | * @param[out] dst_file destination file path 48 | * 49 | * @return 0 if all was well, or there was nothing; non-zero on error 50 | */ 51 | int unifyfs_parse_manifest_line(int line_number, 52 | char* line, 53 | char** src_file, 54 | char** dst_file); 55 | 56 | /** 57 | * @brief transfer source file to destination according to stage context 58 | * 59 | * @param ctx stage context 60 | * @param file_index file index within manifest 61 | * @param src_file_path source file path 62 | * @param dst_file_path destination file path 63 | * 64 | * @return 0 on success, errno otherwise 65 | */ 66 | int unifyfs_stage_transfer(unifyfs_stage* ctx, 67 | int file_index, 68 | const char* src_file_path, 69 | const char* dst_file_path); 70 | 71 | #endif /* UNIFYFS_STAGE_H */ 72 | -------------------------------------------------------------------------------- /util/unifyfs/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /util/unifyfs/src/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/common/src/Makefile.mk 2 | 3 | bin_PROGRAMS = unifyfs 4 | 5 | unifyfs_SOURCES = \ 6 | $(UNIFYFS_COMMON_SRCS) \ 7 | unifyfs.c \ 8 | unifyfs-rm.c 9 | 10 | noinst_HEADERS = unifyfs.h 11 | 12 | unifyfs_LDADD = $(UNIFYFS_COMMON_LIBS) 13 | 14 | AM_CPPFLAGS = -I$(top_srcdir)/common/src \ 15 | -DBINDIR=\"$(bindir)\" \ 16 | -DSBINDIR=\"$(sbindir)\" \ 17 | -DLIBEXECDIR=\"$(libexecdir)\" 18 | 19 | AM_CFLAGS = -Wall -Werror $(UNIFYFS_COMMON_FLAGS) 20 | 21 | CLEANFILES = $(bin_PROGRAMS) 22 | 23 | --------------------------------------------------------------------------------