diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbcfc66c3..9976bebca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,173 +33,32 @@ jobs: - name: Check shell scripts run: | ./scripts/check.sh - dependencies: - name: Dependencies - runs-on: ${{ matrix.os.dist }} - timeout-minutes: 180 - strategy: - fail-fast: false - matrix: - os: - - dist: ubuntu-24.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 13.3.0 - - dist: ubuntu-24.04 - compiler: clang - compiler_spack: llvm - compiler_version: 18.1.3 - - dist: ubuntu-22.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 11.4.0 - - dist: ubuntu-22.04 - compiler: clang - compiler_spack: llvm - compiler_version: 14.0.0 - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - persist-credentials: false - show-progress: false - - name: Cache dependencies - id: cache - uses: actions/cache@v4 - with: - path: dependencies - key: ${{ matrix.os.dist }}-${{ matrix.os.compiler }}-${{ matrix.os.compiler_version }}-${{ hashFiles('scripts/spack', 'scripts/install-dependencies.sh') }} - - name: Install dependencies - if: ${{ steps.cache.outputs.cache-hit != 'true' }} - env: - JULEA_SPACK_COMPILER: ${{ matrix.os.compiler_spack }}@${{ matrix.os.compiler_version }} - run: | - ./scripts/install-dependencies.sh - dependencies-containers: - name: Dependencies (Containers) - runs-on: ubuntu-24.04 - container: ${{ matrix.os.registry }}/${{ matrix.os.image }} - timeout-minutes: 180 - strategy: - fail-fast: false - matrix: - os: - - image: ubuntu:24.04 - registry: docker.io/library - compiler: gcc - compiler_spack: gcc - compiler_version: 13.3.0 - - image: ubuntu:24.04 - registry: docker.io/library - compiler: clang - compiler_spack: llvm - compiler_version: 18.1.3 - - image: ubuntu:22.04 - registry: docker.io/library - compiler: gcc - compiler_spack: gcc - compiler_version: 11.4.0 - - image: ubuntu:22.04 - registry: docker.io/library - compiler: clang - compiler_spack: llvm - compiler_version: 14.0.0 - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - persist-credentials: false - show-progress: false - - name: Install packages - if: ${{ matrix.os.image == 'ubuntu:24.04' || matrix.os.image == 'ubuntu:22.04' }} - run: | - apt update - apt --yes --no-install-recommends install build-essential zstd - apt --yes --no-install-recommends install ca-certificates git gnupg patchelf python3 unzip - if test "${{ matrix.os.compiler }}" = 'clang' - then - apt --yes --no-install-recommends install clang - - if test "${{ matrix.os.image }}" = 'ubuntu:24.04' - then - apt --yes --no-install-recommends install libclang-rt-dev - fi - fi - - name: Cache dependencies - id: cache - uses: actions/cache@v4 - with: - path: /dependencies - key: ${{ matrix.os.image }}-${{ matrix.os.compiler }}-${{ matrix.os.compiler_version }}-${{ hashFiles('scripts/spack', 'scripts/install-dependencies.sh') }} - - name: Install dependencies - if: ${{ steps.cache.outputs.cache-hit != 'true' }} - env: - JULEA_SPACK_COMPILER: ${{ matrix.os.compiler_spack }}@${{ matrix.os.compiler_version }} - JULEA_SPACK_DIR: /dependencies - run: | - ./scripts/install-dependencies.sh build: name: Build - needs: dependencies - runs-on: ${{ matrix.os.dist }} + # Todo: Remove matrix entirely? + runs-on: ${{ matrix.dist }} timeout-minutes: 60 strategy: fail-fast: false matrix: - os: - - dist: ubuntu-24.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 13.3.0 - - dist: ubuntu-24.04 - compiler: clang - compiler_spack: llvm - compiler_version: 18.1.3 - - dist: ubuntu-22.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 11.4.0 - - dist: ubuntu-22.04 - compiler: clang - compiler_spack: llvm - compiler_version: 14.0.0 - dependencies: [system, spack] + dist: + - ubuntu-24.04 + - ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v5 with: persist-credentials: false show-progress: false - - name: Clean up system packages - # We need to remove glib-network, otherwise libproxy might cause crashes. - run: | - sudo apt --yes purge glib-networking - sudo apt --yes --purge autoremove - sudo aa-remove-unknown || true - - name: Install dependencies - if: ${{ matrix.dependencies == 'system' }} - run: | - sudo apt update || true - sudo apt --yes --no-install-recommends install meson ninja-build pkgconf libglib2.0-dev libbson-dev libfabric-dev libgdbm-dev liblmdb-dev libsqlite3-dev libleveldb-dev libmongoc-dev libmariadb-dev librocksdb-dev libfuse3-dev libopen-trace-format-dev librados-dev - - name: Cache dependencies - id: cache - if: ${{ matrix.dependencies == 'spack' }} - uses: actions/cache/restore@v4 + - name: Install nix + uses: cachix/install-nix-action@v31 with: - path: dependencies - key: ${{ matrix.os.dist }}-${{ matrix.os.compiler }}-${{ matrix.os.compiler_version }}-${{ hashFiles('scripts/spack', 'scripts/install-dependencies.sh') }} - - name: Check dependencies - if: ${{ matrix.dependencies == 'spack' && steps.cache.outputs.cache-hit != 'true' }} + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Build run: | - exit 1 - - name: Configure, build and install - env: - CC: ${{ matrix.os.compiler }} - run: | - ./scripts/ci/build.sh release "${{ matrix.dependencies }}" + nix build tests: name: Tests - needs: dependencies runs-on: ${{ matrix.os.dist }} timeout-minutes: 60 strategy: @@ -207,22 +66,8 @@ jobs: matrix: os: - dist: ubuntu-24.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 13.3.0 - - dist: ubuntu-24.04 - compiler: clang - compiler_spack: llvm - compiler_version: 18.1.3 - - dist: ubuntu-22.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 11.4.0 - dist: ubuntu-22.04 - compiler: clang - compiler_spack: llvm - compiler_version: 14.0.0 - dependencies: [system, spack] + julea: # Default - object: posix @@ -261,7 +106,6 @@ jobs: # FIXME Ubuntu 24.04's RocksDB triggers asan - os: dist: ubuntu-24.04 - dependencies: system julea: kv: rocksdb services: @@ -293,78 +137,50 @@ jobs: with: persist-credentials: false show-progress: false - - name: Clean up system packages - # We need to remove glib-network, otherwise libproxy might cause crashes. - # FIXME https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263 - # Ubuntu 22.04 and 24.04 have MySQL 8.0 - run: | - sudo apt --yes purge glib-networking mysql-client mysql-client-8.0 mysql-server mysql-server-8.0 - sudo apt --yes --purge autoremove - sudo aa-remove-unknown || true - sudo rm --recursive --force /var/lib/mysql - - name: Install dependencies - if: ${{ matrix.dependencies == 'system' }} - run: | - sudo apt update || true - sudo apt --yes --no-install-recommends install meson ninja-build pkgconf libglib2.0-dev libbson-dev libfabric-dev libgdbm-dev liblmdb-dev libsqlite3-dev libleveldb-dev libmongoc-dev libmariadb-dev librocksdb-dev libfuse3-dev libopen-trace-format-dev librados-dev - - name: Cache dependencies - id: cache - if: ${{ matrix.dependencies == 'spack' }} - uses: actions/cache/restore@v4 + - name: Install nix + uses: cachix/install-nix-action@v31 with: - path: dependencies - key: ${{ matrix.os.dist }}-${{ matrix.os.compiler }}-${{ matrix.os.compiler_version }}-${{ hashFiles('scripts/spack', 'scripts/install-dependencies.sh') }} - - name: Check dependencies - if: ${{ matrix.dependencies == 'spack' && steps.cache.outputs.cache-hit != 'true' }} - run: | - exit 1 + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Configure and build - env: - CC: ${{ matrix.os.compiler }} run: | - ./scripts/ci/build.sh debug "${{ matrix.dependencies }}" + nix develop --command meson setup -Db_sanitize=address,undefined bld + nix develop --command ninja -C bld - name: Create configuration # FIXME We need to use 127.0.0.1 because localhost tries to use the socket (/tmp/mysql.sock), which does not exist. run: | - . scripts/environment.sh JULEA_KV_PATH="/tmp/julea/kv/${{ matrix.julea.kv }}" if test "${{ matrix.julea.kv }}" = 'mongodb'; then JULEA_KV_PATH='127.0.0.1:juleadb'; fi JULEA_DB_PATH="/tmp/julea/db/${{ matrix.julea.db }}" if test "${{ matrix.julea.db }}" = 'mysql'; then JULEA_DB_PATH='127.0.0.1:juleadb:julea:aeluj'; fi - julea-config --user --object-servers="$(hostname)" --kv-servers="$(hostname)" --db-servers="$(hostname)" --object-backend="${{ matrix.julea.object }}" --object-path="/tmp/julea/object/${{ matrix.julea.object }}" --kv-backend="${{ matrix.julea.kv }}" --kv-path="${JULEA_KV_PATH}" --db-backend="${{ matrix.julea.db }}" --db-path="${JULEA_DB_PATH}" + nix develop --command julea-config --user --object-servers="$(hostname)" --kv-servers="$(hostname)" --db-servers="$(hostname)" --object-backend="${{ matrix.julea.object }}" --object-path="/tmp/julea/object/${{ matrix.julea.object }}" --kv-backend="${{ matrix.julea.kv }}" --kv-path="${JULEA_KV_PATH}" --db-backend="${{ matrix.julea.db }}" --db-path="${JULEA_DB_PATH}" - name: Tests run: | - . scripts/environment.sh - ./scripts/setup.sh start - ./scripts/test.sh + nix develop --command ./scripts/setup.sh start + nix develop --command ./scripts/test.sh sleep 10 - ./scripts/test.sh - ./scripts/setup.sh stop + nix develop --command ./scripts/test.sh + nix develop --command ./scripts/setup.sh stop - name: HDF5 Tests env: LSAN_OPTIONS: exitcode=0 run: | - . scripts/environment.sh - ./scripts/setup.sh start - export HDF5_VOL_CONNECTOR=julea-kv - ./scripts/test.sh -r /hdf5 - sleep 10 - ./scripts/test.sh -r /hdf5 + nix develop --command ./scripts/setup.sh start + HDF5_VOL_CONNECTOR=julea-kv nix develop --command ./scripts/test.sh -r /hdf5 sleep 10 - export HDF5_VOL_CONNECTOR=julea-db - ./scripts/test.sh -r /hdf5 + HDF5_VOL_CONNECTOR=julea-kv nix develop --command ./scripts/test.sh -r /hdf5 + + HDF5_VOL_CONNECTOR=julea-db nix develop --command ./scripts/test.sh -r /hdf5 sleep 10 - ./scripts/test.sh -r /hdf5 - ./scripts/setup.sh stop + HDF5_VOL_CONNECTOR=julea-db nix develop --command ./scripts/test.sh -r /hdf5 + nix develop --command ./scripts/setup.sh stop - name: Benchmarks if: ${{ matrix.julea.object == 'posix' && matrix.julea.kv == 'lmdb' && matrix.julea.db == 'sqlite' }} run: | - . scripts/environment.sh - ./scripts/setup.sh start - ./scripts/benchmark.sh --duration=0 + nix develop --command ./scripts/setup.sh start + nix develop --command ./scripts/benchmark.sh --duration=0 sleep 10 - ./scripts/benchmark.sh --duration=0 - ./scripts/setup.sh stop + nix develop --command ./scripts/benchmark.sh --duration=0 + nix develop --command ./scripts/setup.sh stop doxygen: name: Doxygen runs-on: ubuntu-24.04 @@ -391,7 +207,6 @@ jobs: # FIXME Reduce redundancies # FIXME Increase coverage (currently, only one configuration runs) name: Coverage - needs: dependencies runs-on: ubuntu-24.04 timeout-minutes: 60 steps: @@ -400,38 +215,28 @@ jobs: with: persist-credentials: false show-progress: false - - name: Cache dependencies - id: cache - uses: actions/cache/restore@v4 + - name: Install nix + uses: cachix/install-nix-action@v31 with: - path: dependencies - key: ubuntu-24.04-gcc-13.3.0-${{ hashFiles('scripts/spack', 'scripts/install-dependencies.sh') }} - - name: Check dependencies - if: ${{ steps.cache.outputs.cache-hit != 'true' }} - run: | - exit 1 + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Configure and build - env: - CC: gcc run: | - ./scripts/ci/build.sh coverage spack + nix develop --command meson setup -Db_coverage=true -Db_sanitize=address,undefined bld + nix develop --command ninja -C bld - name: Create configuration run: | - . scripts/environment.sh - julea-config --user --object-servers="$(hostname)" --kv-servers="$(hostname)" --db-servers="$(hostname)" --object-backend=posix --object-path=/tmp/julea/object/posix --kv-backend=lmdb --kv-path=/tmp/julea/kv/lmdb --db-backend=sqlite --db-path=/tmp/julea/db/sqlite + nix develop --command julea-config --user --object-servers="$(hostname)" --kv-servers="$(hostname)" --db-servers="$(hostname)" --object-backend=posix --object-path=/tmp/julea/object/posix --kv-backend=lmdb --kv-path=/tmp/julea/kv/lmdb --db-backend=sqlite --db-path=/tmp/julea/db/sqlite - name: Tests env: HDF5_VOL_CONNECTOR: julea-db LSAN_OPTIONS: exitcode=0 run: | - . scripts/environment.sh - ./scripts/setup.sh start - ./scripts/test.sh - ./scripts/setup.sh stop + nix develop --command ./scripts/setup.sh start + nix develop --command ./scripts/test.sh + nix develop --command ./scripts/setup.sh stop - name: Generate coverage run: | - . scripts/environment.sh - ninja -C bld coverage + nix develop --command ninja -C bld coverage - name: Upload coverage uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml deleted file mode 100644 index 6228e434b..000000000 --- a/.github/workflows/dependencies.yml +++ /dev/null @@ -1,62 +0,0 @@ -# JULEA - Flexible storage framework -# Copyright (C) 2021-2024 Michael Kuhn -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -name: Dependencies -on: - schedule: - - cron: '0 0 * * 0' -jobs: - dependencies: - name: Dependencies - runs-on: ${{ matrix.os.dist }} - timeout-minutes: 180 - strategy: - fail-fast: false - matrix: - os: - - dist: ubuntu-24.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 13.3.0 - - dist: ubuntu-24.04 - compiler: clang - compiler_spack: llvm - compiler_version: 18.1.3 - - dist: ubuntu-22.04 - compiler: gcc - compiler_spack: gcc - compiler_version: 11.4.0 - - dist: ubuntu-22.04 - compiler: clang - compiler_spack: llvm - compiler_version: 14.0.0 - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - persist-credentials: false - show-progress: false - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: dependencies - key: ${{ matrix.os.dist }}-${{ matrix.os.compiler }}-${{ matrix.os.compiler_version }}-${{ hashFiles('scripts/spack', 'scripts/install-dependencies.sh') }} - - name: Install dependencies - env: - JULEA_SPACK_COMPILER: ${{ matrix.os.compiler_spack }}@${{ matrix.os.compiler_version }} - run: | - rm --recursive --force dependencies - ./scripts/install-dependencies.sh diff --git a/.gitignore b/.gitignore index 3a3f02351..c010f1d26 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Dependencies dependencies/ +# Nix outputs +result + # Example example/hello-world @@ -22,3 +25,6 @@ bld*/ # Visual Studio Code .vscode/ + +# Clion +.idea/ \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..c1655e4ba --- /dev/null +++ b/flake.lock @@ -0,0 +1,59 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1762233356, + "narHash": "sha256-cGS3lLTYusbEP/IJIWGgnkzIl+FA5xDvtiHyjalGr4k=", + "rev": "ca534a76c4afb2bdc07b681dbc11b453bab21af8", + "revCount": 812378, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2505.812378%2Brev-ca534a76c4afb2bdc07b681dbc11b453bab21af8/019a53af-7da6-765a-ae7b-594fa3a7097b/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..fcaf5626d --- /dev/null +++ b/flake.nix @@ -0,0 +1,114 @@ +{ + description = "A Flexible Storage Framework for HPC"; + + # Flake inputs + inputs = { + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + # Flake outputs + # Useful documentation: https://saylesss88.github.io/flakes/flake_outputs_4.2.html + outputs = { + self, + nixpkgs, + flake-utils, + }: let + # This is a function the returns all the needed dependencies given the system pkgs. + dependencies = pkgs: + with pkgs; [ + # Build basics + # TODO: Currently the ci/cd pipelines tests for clang and gcc. Is gcc only ok? + gcc + ninja + meson + pkg-config + + # Other packages + glib + libbson + # This uses the libfabric-overlay! + libfabric + + hdf5 + fuse3 + lmdb + sqlite + + gdbm + leveldb + # TODO: This is not the correct dependency. + # We need a connector from here: https://downloads.mariadb.com/Connectors/c + # As far as i can tell no nixpkgs exists as of now. + # mariadb + + # TODO: Is this the correct way to include rados? + ceph + + # TODO: I think we need otf1 instead - but no nixpkgs exists + # otf2 + rocksdb + ]; + + # Function that gets pkgs and results in julea being build + mkJulea = pkgs: + pkgs.stdenv.mkDerivation { + pname = "julea"; + # TODO: Do we have a versioning scheme? + version = "1.0.0"; + src = self; + + mesonBuildType = "release"; + + buildInputs = dependencies pkgs; + }; + in + flake-utils.lib.eachDefaultSystem ( + system: let + # Import nixpkgs for the specific system with our config + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [(import ./libfabric_overlay.nix)]; + }; + in { + # Development environments output by this flake + devShells.default = pkgs.mkShell { + # The Nix packages provided in the environment + # Consists of the usual build dependencies and some dev dependencies. + packages = (dependencies pkgs) ++ [ + # Needed to run coverage tests. + pkgs.gcovr + ]; + + + + # Most hardening flags are enabled by default in nix. + # The only one usually disabled is pie. + # For more details check here: + # https://ryantm.github.io/nixpkgs/stdenv/stdenv/#sec-hardening-in-nixpkgs + hardeningEnable = ["pie"]; + + # Set any environment variables for your development environment + env = { + }; + + # Add any shell logic you want executed when the environment is activated + # TODO: Is LD_LIBRARY_PATH ok like this? The spack version had a lot more stuff in it. + shellHook = '' + echo "Welcome to the JULEA nix shell:" + + export BUILD_DIR="$PWD/bld" + export PATH="$PATH:$BUILD_DIR" + export LD_LIBRARY_PATH="$BUILD_DIR" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BUILD_DIR/meson-uninstalled/" + export JULEA_BACKEND_PATH="$BUILD_DIR" + export HDF5_PLUGIN_PATH="$BUILD_DIR" + ''; + }; + + # Can be called with `nix build`. + packages.default = mkJulea pkgs; + } + ); +} diff --git a/libfabric_overlay.nix b/libfabric_overlay.nix new file mode 100644 index 000000000..ffd6e8fc1 --- /dev/null +++ b/libfabric_overlay.nix @@ -0,0 +1,28 @@ +# We currently install libfabric like this: dependencies="${dependencies} libfabric#fabrics=sockets,tcp,udp,verbs,rxd,rxm" +# All these fabric flags gets parsed in the libfabric python file linked below. +# They define a list of fabrics and, if it was passed as an argument, append the --enable-{fabric} flag in line 249. +# https://github.com/spack/spack-packages/blob/develop/repos/spack_repo/builtin/packages/libfabric/package.py +# Sadly the current libfabric nix file: +# https://github.com/NixOS/nixpkgs/blob/nixpkgs-25.05-darwin/pkgs/by-name/li/libfabric/package.nix +# does not support these flags. It only exposes flags for psm2 and opx. +# In the future it would probably be best to submit a merge request to nixpkgs. +# For now i will attempt to add them myself here. + +final : prev : { + libfabric = prev.libfabric.overrideAttrs (old: { + # We append our own flags to the existing ones. These should then get passed to the ./configure script. + configureFlags = old.configureFlags + ++ [ + "-enable-sockets" + "-enable-tcp" + "-enable-udp" + "-enable-verbs" + "-enable-rxd" + "-enable-rxm" + ]; + + # verbs also requires rdma so we add that dependency + buildInputs = old.buildInputs + ++ [ prev.rdma-core ]; + }); +} diff --git a/meson.build b/meson.build index fc03b1a2d..db34f0a57 100644 --- a/meson.build +++ b/meson.build @@ -30,7 +30,6 @@ pkg_config = import('pkgconfig') cc_args = cc.get_supported_arguments([ '-fno-omit-frame-pointer', - '-fhardened', ]) if get_option('debug') diff --git a/scripts/benchmark.sh b/scripts/benchmark.sh index c35de58ae..662438ad6 100755 --- a/scripts/benchmark.sh +++ b/scripts/benchmark.sh @@ -24,8 +24,6 @@ SELF_BASE="${SELF_PATH##*/}" # shellcheck source=scripts/common . "${SELF_DIR}/common" -# shellcheck source=scripts/spack -. "${SELF_DIR}/spack" usage () { @@ -33,11 +31,6 @@ usage () exit 1 } -set_path -set_library_path -set_backend_path -set_hdf_path - run_benchmark () { local ret @@ -49,11 +42,4 @@ run_benchmark () return ${ret} } -if test -z "${JULEA_SPACK_DIR}" -then - JULEA_SPACK_DIR="$(get_directory "${SELF_DIR}/..")/dependencies" -fi - -spack_load_dependencies - run_benchmark "$@" diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh deleted file mode 100755 index 0639f2b1a..000000000 --- a/scripts/ci/build.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -# JULEA - Flexible storage framework -# Copyright (C) 2024 Michael Kuhn -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -set -e - -MODE="$1" -DEPS="$2" - -GDBM_PREFIX='' - -. scripts/environment.sh - -if test "${DEPS}" = 'spack' -then - GDBM_PREFIX="-Dgdbm_prefix=$(spack location --install-dir gdbm)" -fi - -case "${MODE}" in - release) - # shellcheck disable=SC2086 - meson setup --prefix="${GITHUB_WORKSPACE}/julea-install" --buildtype=release --werror ${GDBM_PREFIX} bld - ninja -C bld - ninja -C bld install - ;; - debug) - CLANG_LUNDEF='' - if test "${CC}" = 'clang' - then - CLANG_LUNDEF='-Db_lundef=false' - fi - # shellcheck disable=SC2086 - meson setup -Db_sanitize=address,undefined ${CLANG_LUNDEF} ${GDBM_PREFIX} bld - ninja -C bld - ;; - coverage) - # shellcheck disable=SC2086 - meson setup -Db_coverage=true -Db_sanitize=address,undefined ${GDBM_PREFIX} bld - ninja -C bld - ;; - *) - exit 1 - ;; -esac diff --git a/scripts/environment.sh b/scripts/environment.sh deleted file mode 100755 index 10e3b75ce..000000000 --- a/scripts/environment.sh +++ /dev/null @@ -1,78 +0,0 @@ -# JULEA - Flexible storage framework -# Copyright (C) 2017-2024 Michael Kuhn -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -SELF_ZERO="$0" -# shellcheck disable=SC2169,SC3028,SC3054 -test -n "${BASH_VERSION}" && SELF_ZERO="${BASH_SOURCE[0]}" - -SELF_PATH="$(readlink --canonicalize-existing -- "${SELF_ZERO}")" -SELF_DIR="${SELF_PATH%/*}" -# shellcheck disable=SC2034 -SELF_BASE="${SELF_PATH##*/}" - -# shellcheck source=scripts/common -. "${SELF_DIR}/common" -# shellcheck source=scripts/spack -. "${SELF_DIR}/spack" - -JULEA_ENVIRONMENT_SOURCED=1 - -# See https://stackoverflow.com/a/28776166 -if test -n "${BASH_VERSION}" -then - (return 0 2>/dev/null) || JULEA_ENVIRONMENT_SOURCED=0 -elif test -n "${ZSH_EVAL_CONTEXT}" -then - case "${ZSH_EVAL_CONTEXT}" in - *:file) - ;; - *) - JULEA_ENVIRONMENT_SOURCED=0 - ;; - esac -fi - -if test "${JULEA_ENVIRONMENT_SOURCED}" -eq 0 -then - printf 'Warning: This script should be sourced using ". %s", otherwise changes to the environment will not persist.\n' "${SELF_PATH}" >&2 -fi - -JULEA_ENVIRONMENT=1 - -set_path -set_library_path -set_pkg_config_path -set_backend_path -set_hdf_path - -if test -z "${JULEA_SPACK_DIR}" -then - JULEA_SPACK_DIR="$(get_directory "${SELF_DIR}/..")/dependencies" -fi - -spack_load_dependencies - -# Do not filter out paths contained in CPATH and LIBRARY_PATH. -PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 -PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 - -export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS -export PKG_CONFIG_ALLOW_SYSTEM_LIBS - -# FIXME The Spack pkg-config does not search in global directories and Meson does not provide a way to override this -PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig" - -export PKG_CONFIG_PATH diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh deleted file mode 100755 index 46a4ef24a..000000000 --- a/scripts/install-dependencies.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# JULEA - Flexible storage framework -# Copyright (C) 2017-2024 Michael Kuhn -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -set -e - -SELF_PATH="$(readlink --canonicalize-existing -- "$0")" -SELF_DIR="${SELF_PATH%/*}" -SELF_BASE="${SELF_PATH##*/}" - -# shellcheck source=scripts/common -. "${SELF_DIR}/common" -# shellcheck source=scripts/spack -. "${SELF_DIR}/spack" - -usage () -{ - echo "Usage: ${SELF_BASE}" - exit 1 -} - -if test -z "${JULEA_SPACK_DIR}" -then - JULEA_SPACK_DIR="$(get_directory "${SELF_DIR}/..")/dependencies" -fi - -spack_install_dependencies diff --git a/scripts/setup.sh b/scripts/setup.sh index a041a458a..1d2617c82 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -27,8 +27,6 @@ SELF_BASE="${SELF_PATH##*/}" . "${SELF_DIR}/common" # shellcheck source=scripts/setup . "${SELF_DIR}/setup" -# shellcheck source=scripts/spack -. "${SELF_DIR}/spack" usage () { @@ -67,17 +65,11 @@ MODE="$1" #export G_MESSAGES_DEBUG=JULEA -set_path -set_library_path -set_backend_path - if test -z "${JULEA_SPACK_DIR}" then JULEA_SPACK_DIR="$(get_directory "${SELF_DIR}/..")/dependencies" fi -spack_load_dependencies - setup_init case "${MODE}" in diff --git a/scripts/spack b/scripts/spack deleted file mode 100644 index 56e375b79..000000000 --- a/scripts/spack +++ /dev/null @@ -1,240 +0,0 @@ -# JULEA - Flexible storage framework -# Copyright (C) 2017-2024 Michael Kuhn -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -spack_set_env () -{ - test -n "${JULEA_SPACK_DIR}" || return 1 - - export SPACK_DISABLE_LOCAL_CONFIG=true - # FIXME maybe put into /tmp in CI - export SPACK_USER_CACHE_PATH="${JULEA_SPACK_DIR}/cache" -} - -spack_clone () -{ - local spack_packages_commit - - spack_packages_commit='9ca712a716ef98dcc39e3a76b5e5b6b1aa89746e' - - test -n "${JULEA_SPACK_DIR}" || return 1 - - if test ! -d "${JULEA_SPACK_DIR}" - then - git clone --config feature.manyFiles=true https://github.com/spack/spack.git "${JULEA_SPACK_DIR}" - fi - - test -d "${JULEA_SPACK_DIR}" || return 1 - - if test ! -d "${JULEA_SPACK_DIR}/packages" - then - git clone --config feature.manyFiles=true https://github.com/spack/spack-packages.git "${JULEA_SPACK_DIR}/packages" - fi - - test -d "${JULEA_SPACK_DIR}/packages" || return 1 - - spack_set_env - - ( - cd "${JULEA_SPACK_DIR}" || return 1 - - git fetch - git checkout releases/v1.0 - git reset --hard origin/releases/v1.0 - ) - - ( - cd "${JULEA_SPACK_DIR}/packages" || return 1 - - git fetch - git checkout develop - git reset --hard "${spack_packages_commit}" - ) - - spack_cmd repo set --destination "${JULEA_SPACK_DIR}/packages" builtin - - return 0 -} - -spack_init () -{ - local spack_env - - test -n "${JULEA_SPACK_DIR}" || return 1 - test -d "${JULEA_SPACK_DIR}" || return 1 - - spack_set_env - - spack_env="${JULEA_SPACK_DIR}/share/spack/setup-env.sh" - - test -f "${spack_env}" || return 1 - - # shellcheck source=/dev/null - . "${spack_env}" - - return 0 -} - -spack_cmd () -{ - test -n "${JULEA_SPACK_DIR}" || return 1 - test -d "${JULEA_SPACK_DIR}" || return 1 - - ( - cd "${JULEA_SPACK_DIR}" || return 1 - - ./bin/spack "$@" - ) -} - -spack_load () -{ - local pkg_loaded - local spack_pkg - - pkg_loaded='YES' - spack_pkg="$1" - - test -n "${spack_pkg}" || return 1 - - spack_pkg="$(printf '%s' "${spack_pkg}" | sed 's/#/ /g')" - - spack load "${spack_pkg}" || pkg_loaded='NO' - - printf 'Dependency "%s" loaded: %s\n' "${spack_pkg}" "${pkg_loaded}" -} - -spack_install () -{ - local spack_pkg - - spack_pkg="$1" - - test -n "${spack_pkg}" || return 1 - - spack_pkg="$(printf '%s' "${spack_pkg}" | sed 's/#/ /g')" - - printf 'Installing "%s"\n' "${spack_pkg}" - # FIXME ignore errors? - spack_cmd install "${spack_pkg}" -} - -spack_get_dependencies () -{ - local dependencies - - dependencies='' - - # Required for building JULEA - dependencies="${dependencies} meson" - dependencies="${dependencies} pkgconf" - - # Mandatory dependencies - dependencies="${dependencies} glib" - dependencies="${dependencies} libbson" - dependencies="${dependencies} libfabric#fabrics=sockets,tcp,udp,verbs,rxd,rxm" - - # Recommended dependencies - dependencies="${dependencies} hdf5~mpi@1.14" - dependencies="${dependencies} libfuse~utils" - dependencies="${dependencies} lmdb" - dependencies="${dependencies} sqlite" - - # Optional dependencies - # FIXME https://github.com/spack/spack-packages/pull/1109 - dependencies="${dependencies} gdbm@1.23" - dependencies="${dependencies} leveldb" - dependencies="${dependencies} mariadb-c-client" - dependencies="${dependencies} mongo-c-driver" - dependencies="${dependencies} otf" - dependencies="${dependencies} rocksdb~static" - - if test -n "${CI}" - then - dependencies="${dependencies} py-gcovr" - fi - - #dependencies="${dependencies} enzo@main" - #dependencies="${dependencies} mpi" - - printf '%s' "${dependencies}" -} - -spack_load_dependencies () -{ - if test -z "${JULEA_SPACK_DEPENDENCIES_LOADED}" - then - if spack_init - then - for dependency in $(spack_get_dependencies) - do - spack_load "${dependency}" - done - - # FIXME this could be more clever by storing the actual dependencies loaded - JULEA_SPACK_DEPENDENCIES_LOADED=1 - - export JULEA_SPACK_DEPENDENCIES_LOADED - fi - else - printf 'Dependencies have already been loaded, skipping.\n' >&2 - fi -} - -spack_install_dependencies () -{ - # FIXME does not fail if Git is not installed - if spack_clone - then - spack_cmd config --scope site add 'concretizer:reuse:false' - spack_cmd config --scope site add 'config:connect_timeout:60' - # FIXME We currently need this for JULEA to find all dependencies - spack_cmd config --scope site add 'modules:prefix_inspections:lib:[LD_LIBRARY_PATH]' - spack_cmd config --scope site add 'modules:prefix_inspections:lib64:[LD_LIBRARY_PATH]' - - if test -n "${CI}" - then - spack_cmd config --scope site add 'packages:all:target:[x86_64]' - spack_cmd compiler find - spack_cmd compiler list - - if test -n "${JULEA_SPACK_COMPILER}" - then - # This should fail if Spack does not recognize the compiler - spack_cmd compiler info "${JULEA_SPACK_COMPILER}" - fi - fi - - if test -n "${JULEA_SPACK_COMPILER}" - then - spack_cmd config --scope site add "packages:all:require:\"%${JULEA_SPACK_COMPILER}\"" - fi - - spack_cmd mark --implicit --all - - for dependency in $(spack_get_dependencies) - do - spack_install "${dependency}" - done - - spack_cmd gc --yes-to-all - - if test -n "${CI}" - then - spack_cmd clean --downloads - spack_cmd find - fi - fi -} diff --git a/scripts/test.sh b/scripts/test.sh index d300dac68..b3ad09eac 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -24,8 +24,6 @@ SELF_BASE="${SELF_PATH##*/}" # shellcheck source=scripts/common . "${SELF_DIR}/common" -# shellcheck source=scripts/spack -. "${SELF_DIR}/spack" usage () { @@ -33,11 +31,6 @@ usage () exit 1 } -set_path -set_library_path -set_backend_path -set_hdf_path - run_test () { local build_dir @@ -58,11 +51,5 @@ run_test () return ${ret} } -if test -z "${JULEA_SPACK_DIR}" -then - JULEA_SPACK_DIR="$(get_directory "${SELF_DIR}/..")/dependencies" -fi - -spack_load_dependencies run_test "$@"