From 999862e530cf83c3606152cc99c83dd6d8b6f45a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 12 Sep 2022 17:35:17 +0200 Subject: [PATCH] Enable CI runtime tests for Nanos6 These require a runner with nix available. --- .gitlab-ci.yml | 27 ++--- nix/0001-Emit-a-fill-event-at-shutdown.patch | 29 ------ nix/nanos6.nix | 102 ------------------- nix/rt.nix | 92 +++++++++++++++++ 4 files changed, 100 insertions(+), 150 deletions(-) delete mode 100644 nix/0001-Emit-a-fill-event-at-shutdown.patch delete mode 100644 nix/nanos6.nix create mode 100644 nix/rt.nix diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 86f169c..3db1a6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,7 @@ -build:debian-latest: - image: debian:latest +build:debian-testing: + image: debian:testing + tags: + - docker stage: build before_script: - apt update && apt -y install make autoconf gfortran libopenmpi-dev cmake @@ -12,22 +14,9 @@ build:debian-latest: paths: - install/ -build:old-glibc: - image: nixos/nix:2.9.2 +build:rt-tests: stage: build + tags: + - nix script: - - nix-build nix/old-glibc.nix - -build:nosv-tests: - image: - name: nixos/nix:2.9.2 - stage: build - before_script: - - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - - eval $(ssh-agent -s) - - echo "$SSH_PRIVATE_KEY" | ssh-add /dev/fd/0 - - mkdir -p ~/.ssh - - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config - - cat /proc/sys/user/max_user_namespaces || true - script: - - nix --extra-experimental-features "nix-command impure-derivations ca-derivations" --option sandbox false build -L --impure --file nix/nosv.nix + - nix build -L --file nix/rt.nix diff --git a/nix/0001-Emit-a-fill-event-at-shutdown.patch b/nix/0001-Emit-a-fill-event-at-shutdown.patch deleted file mode 100644 index a5e40d1..0000000 --- a/nix/0001-Emit-a-fill-event-at-shutdown.patch +++ /dev/null @@ -1,29 +0,0 @@ -From abeed615777690ba748f64bdb72a35fe5311259b Mon Sep 17 00:00:00 2001 -From: Rodrigo Arias -Date: Thu, 25 Aug 2022 16:36:38 +0200 -Subject: [PATCH] Emit a fill event at shutdown - ---- - src/instrument/ovni/InstrumentThreadManagement.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/instrument/ovni/InstrumentThreadManagement.cpp b/src/instrument/ovni/InstrumentThreadManagement.cpp -index c79a9750..4872b2d9 100644 ---- a/src/instrument/ovni/InstrumentThreadManagement.cpp -+++ b/src/instrument/ovni/InstrumentThreadManagement.cpp -@@ -92,6 +92,12 @@ void Instrument::threadHasResumed(__attribute__((unused)) external_thread_id_t t - - void Instrument::threadWillShutdown() - { -+ ThreadLocalData &tld = getThreadLocalData(); -+ if (tld._hungry) { -+ tld._hungry = false; -+ Ovni::schedFill(); -+ } -+ - Ovni::threadEnd(); - } - --- -2.36.1 - diff --git a/nix/nanos6.nix b/nix/nanos6.nix deleted file mode 100644 index c00cfff..0000000 --- a/nix/nanos6.nix +++ /dev/null @@ -1,102 +0,0 @@ -let - pkgs = import (builtins.fetchTarball - "https://pm.bsc.es/gitlab/rarias/bscpkgs/-/archive/master/bscpkgs-master.tar.gz"); - - rWrapper = pkgs.rWrapper.override { - packages = with pkgs.rPackages; [ tidyverse rjson jsonlite egg viridis ]; - }; - - # Recursively set MPI - bsc = pkgs.bsc.extend (last: prev: { - mpi = last.impi; - #mpi = last.openmpi; - - #nanos6 = (prev.nanos6Git.override { - # gitUrl = "ssh://git@bscpm03.bsc.es/nanos6/forks/nanos6-extern-001.git"; - # gitBranch = "ovni_instr"; - # extrae = null; - #}).overrideAttrs (old: { - # buildInputs = old.buildInputs ++ [ last.ovni ]; - # patches = [ ./0001-Emit-a-fill-event-at-shutdown.patch ]; - # configureFlags = old.configureFlags ++ [ - # "--with-ovni=${last.ovni}" - # ]; - #}); - - nanos6 = prev.nanos6Git.overrideAttrs (old: { - src = ~/bsc/nanos6; - version = "local"; - buildInputs = old.buildInputs ++ [ last.ovni ]; - configureFlags = old.configureFlags ++ [ - "--with-ovni=${last.ovni}" - ]; - }); - - # Quick hack, as we only need the libovni runtime to match ours - nanos6' = /nix/store/zg989jl3mgdps7amdskna43hipb6snsq-nanos6-60fc5f2; - - ompss2 = { - clangUnwrapped = prev.clangOmpss2Unwrapped.overrideAttrs ( - old: - rec { - src = ../../ovni-misc/kk2/llvm-mono-d3d4f2bf231b9461a5881c5bf56659516d45e670.tar.bz2; - #src = fetchTarball { - # url = ../kk/llvm-mono-d3d4f2bf231b9461a5881c5bf56659516d45e670.tar.bz2; - #}; - #builtins.fetchTree { - # type = "git"; - # url = "ssh://git@bscpm03.bsc.es/llvm-ompss/llvm-mono.git"; - # ref = "master"; - # # Master at 2022-07-26 - # rev = "d3d4f2bf231b9461a5881c5bf56659516d45e670"; - # shallow = true; - #}; - version = "d3d4f2bf"; - } - ); - - #clangUnwrapped = /nix/store/fg621rqj50x85gnsbh1pj304049yqlaq-clang-ompss2-d3d4f2b; - - clang = prev.clangOmpss2.override { - clangOmpss2Unwrapped = last.ompss2.clangUnwrapped; - }; - - #clang = /nix/store/qva7b665inxgg8wrfl2jf9dwzdp69sxq-clang-ompss2-wrapper-d3d4f2b; - - stdenv = pkgs.overrideCC pkgs.llvmPackages_11.stdenv bsc.ompss2.clang; - }; - - nosv = pkgs.stdenv.mkDerivation rec { - pname = "nosv"; - version = src.shortRev; - buildInputs = with pkgs; [ autoreconfHook pkg-config numactl last.ovni ]; - configureFlags = [ "--with-ovni=${last.ovni}" ]; - dontStrip = true; - src = builtins.fetchGit { - url = "ssh://git@gitlab-internal.bsc.es/nos-v/nos-v.git"; - ref = "master"; - }; - }; - - # Quick fix to avoid rebuilding every time the ovni source changes. - # Use this nosv' version below as dependency of ovni-rt - nosv' = /nix/store/rvnrbc7ibpw06jdilz6mha7szzxcr2mi-nosv-8936f3e; - - ovni = last.callPackage ./ovni.nix { }; - - ovni-rt = (last.ovni.override { - stdenv = last.ompss2.stdenv; - }).overrideAttrs (old: { - __impure = true; - __noChroot = true; - buildInputs = old.buildInputs ++ [ - last.nosv' - pkgs.strace - ]; - cmakeFlags = old.cmakeFlags ++ [ "-DBUILD_RT_TESTING=ON" ]; - }); - }); - -in - #bsc.ovni-rt - bsc.ompss2.clang diff --git a/nix/rt.nix b/nix/rt.nix new file mode 100644 index 0000000..c14240a --- /dev/null +++ b/nix/rt.nix @@ -0,0 +1,92 @@ +let + pkgs = import (builtins.fetchTarball + "https://pm.bsc.es/gitlab/rarias/bscpkgs/-/archive/update-bscpkgs/bscpkgs-master.tar.gz"); + + rWrapper = pkgs.rWrapper.override { + packages = with pkgs.rPackages; [ tidyverse rjson jsonlite egg viridis ]; + }; + + # Recursively set MPI + bsc = pkgs.bsc.extend (last: prev: { + mpi = last.impi; + #mpi = last.openmpi; + + ovni = last.callPackage ./ovni.nix { }; + + # Use a fixed version to compile Nanos6 and nOS-V, so we don't need to + # rebuild them when ovni changes. We only need to maintain the + # compatibility in the versions of ovni traces, which will be + # checked by the emulator anyway. + ovniFixed = last.ovni.overrideAttrs (old: { + src = builtins.fetchGit { + url = "ssh://git@bscpm03.bsc.es/rarias/ovni.git"; + ref = "nanos6-emu-with-tests"; + rev = "3d39b8cc544140727c83a066a8fca785aff21965"; + }; + }); + + nanos6 = (prev.nanos6Git.override { + gitUrl = "ssh://git@bscpm03.bsc.es/nanos6/forks/nanos6-extern-001.git"; + gitBranch = "ovni_instr"; + extrae = null; + }).overrideAttrs (old: { + buildInputs = old.buildInputs ++ [ last.ovniFixed ]; + configureFlags = old.configureFlags ++ [ + "--with-ovni=${last.ovniFixed}" + ]; + }); + + ompss2 = { + # We need a recent clang to avoid silent ABI incompatible changes... + clangUnwrapped = prev.clangOmpss2Unwrapped.overrideAttrs ( + old: + rec { + src = builtins.fetchTree { + type = "git"; + url = "ssh://git@bscpm03.bsc.es/llvm-ompss/llvm-mono.git"; + ref = "master"; + # Master at 2022-07-26 + rev = "d3d4f2bf231b9461a5881c5bf56659516d45e670"; + shallow = true; + }; + version = "d3d4f2bf"; + } + ); + + clang = prev.clangOmpss2.override { + clangOmpss2Unwrapped = last.ompss2.clangUnwrapped; + }; + + stdenv = pkgs.overrideCC pkgs.llvmPackages_11.stdenv bsc.ompss2.clang; + }; + + nosv = pkgs.stdenv.mkDerivation rec { + pname = "nosv"; + version = src.shortRev; + buildInputs = with pkgs; [ autoreconfHook pkg-config numactl last.ovniFixed ]; + configureFlags = [ "--with-ovni=${last.ovniFixed}" ]; + dontStrip = true; + src = builtins.fetchGit { + url = "ssh://git@gitlab-internal.bsc.es/nos-v/nos-v.git"; + ref = "master"; + }; + }; + + # Now we rebuild ovni with the Nanos6 and nOS-V versions, which were + # linked to the previous ovni. We need to be able to exit the chroot + # to run Nanos6 tests, as they require access to /sys for hwloc + ovni-rt = (last.ovni.override { + stdenv = last.ompss2.stdenv; + }).overrideAttrs (old: { + __noChroot = true; + buildInputs = old.buildInputs ++ [ + pkgs.gdb + last.nosv + pkgs.strace + ]; + cmakeFlags = old.cmakeFlags ++ [ "-DENABLE_TEST_RT=ON" ]; + }); + }); + +in + bsc.ovni-rt