From cfeeefbd9c1c60421f3deb7d8b52192d87798e99 Mon Sep 17 00:00:00 2001 From: Luca Terracciano Date: Tue, 16 Sep 2025 15:44:15 +0200 Subject: [PATCH 1/4] ci: give write to PR permission --- .github/workflows/pr-development.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-development.yml b/.github/workflows/pr-development.yml index ea068d3..8c1961d 100644 --- a/.github/workflows/pr-development.yml +++ b/.github/workflows/pr-development.yml @@ -17,12 +17,16 @@ permissions: jobs: ci-arm64: uses: Algebraic-Programming/CloudR/.github/workflows/pr-development-workflow.yml@master + permissions: + pull-requests: write with: os: ubuntu-24.04-arm arch: arm64 ci-amd64: uses: Algebraic-Programming/CloudR/.github/workflows/pr-development-workflow.yml@master + permissions: + pull-requests: write with: os: ubuntu-24.04 arch: amd64 \ No newline at end of file From ee7643a379c681595684b54260eb43824950c632 Mon Sep 17 00:00:00 2001 From: Luca Terracciano Date: Thu, 11 Sep 2025 11:22:50 +0200 Subject: [PATCH 2/4] refactor: update RPC Engine --- .../hicr/backends/cloudr/instanceManager.hpp | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/include/hicr/backends/cloudr/instanceManager.hpp b/include/hicr/backends/cloudr/instanceManager.hpp index e3e1ed9..75efeea 100644 --- a/include/hicr/backends/cloudr/instanceManager.hpp +++ b/include/hicr/backends/cloudr/instanceManager.hpp @@ -124,19 +124,13 @@ class InstanceManager final : public HiCR::InstanceManager // Increasing cloudr instance Id instanceIdCounter++; } - // printf("[CloudR] Worker %lu finished.\n", _rpcEngine->getInstanceManager()->getCurrentInstance()->getId()); ///// Now deploying // If I'm worker, all I need to do is listen for incoming RPCs if (_rpcEngine->getInstanceManager()->getCurrentInstance()->isRootInstance() == false) { - while (_continueListening) - { - // printf("[CloudR] Worker %lu listening...\n", _rpcEngine->getInstanceManager()->getCurrentInstance()->getId()); - _rpcEngine->listen(); - // printf("[CloudR] Worker %lu back from listening...\n", _rpcEngine->getInstanceManager()->getCurrentInstance()->getId()); - } + while (_continueListening) { _rpcEngine->listen(); } } else // If I am root, do the following instead { @@ -144,10 +138,10 @@ class InstanceManager final : public HiCR::InstanceManager for (auto &instance : _freeInstances) { // Requesting the root - _rpcEngine->requestRPC(*instance, __CLOUDR_GATHER_TOPOLOGIES_RPC_NAME); + _rpcEngine->requestRPC(instance->getId(), __CLOUDR_GATHER_TOPOLOGIES_RPC_NAME); // Getting return value (topology) - auto returnValue = _rpcEngine->getReturnValue(*instance); + auto returnValue = _rpcEngine->getReturnValue(); // Receiving raw serialized topology information from the worker std::string serializedTopology = (char *)returnValue->getPointer(); @@ -164,8 +158,6 @@ class InstanceManager final : public HiCR::InstanceManager // Then go straight to the entry point _entryPoint(); - - // printf("[Root %lu] Exited entry point...\n", _rpcEngine->getInstanceManager()->getCurrentInstance()->getId()); } } @@ -183,30 +175,28 @@ class InstanceManager final : public HiCR::InstanceManager _rpcEngine->submitReturnValue((void *)&returnOkMessage, sizeof(returnOkMessage)); } - __INLINE__ void terminateInstanceImpl(const std::shared_ptr instance) override - { + __INLINE__ void terminateInstanceImpl(const std::shared_ptr instance) override + { // Requesting relinquish RPC execution on the requested instance - _rpcEngine->requestRPC(*instance, __CLOUDR_RELINQUISH_INSTANCE_RPC_NAME); + _rpcEngine->requestRPC(instance->getId(), __CLOUDR_RELINQUISH_INSTANCE_RPC_NAME); // Getting return value. It's enough to know a value was returned to know it is idling - const auto returnValue = _rpcEngine->getReturnValue(*instance); + const auto returnValue = _rpcEngine->getReturnValue(); // Adding instance back to free instances _freeInstances.insert(_baseIdsToCloudrInstanceMap[instance->getId()]); - } + } /** * Finalization procedure. Send rpc termination to all the non root instances */ __INLINE__ void finalize() override { - // printf("[Instance %lu] Finalizing CloudR...\n", _rpcEngine->getInstanceManager()->getCurrentInstance()->getId()); - // The following only be ran by the root rank, send an RPC to all others to finalize them if (_rpcEngine->getInstanceManager()->getCurrentInstance()->isRootInstance()) { for (auto &instance : _cloudrInstances) - if (instance->isRootInstance() == false) _rpcEngine->requestRPC(*instance, __CLOUDR_FINALIZE_WORKER_RPC_NAME); + if (instance->isRootInstance() == false) _rpcEngine->requestRPC(instance->getId(), __CLOUDR_FINALIZE_WORKER_RPC_NAME); } } @@ -257,10 +247,6 @@ class InstanceManager final : public HiCR::InstanceManager __INLINE__ std::shared_ptr createInstanceImpl(const HiCR::InstanceTemplate instanceTemplate) override { - // If no more free instances available, fail now - // Commented out because we don't want to fail, simply return a nullptr - // if (_freeInstances.empty()) HICR_THROW_LOGIC("Requested the creation of a new instances, but CloudR has ran out of free instances"); - // Creating instance object to return std::shared_ptr newInstance = nullptr; @@ -281,14 +267,11 @@ class InstanceManager final : public HiCR::InstanceManager break; } - // Commented out because we don't want to fail, simply return a nullptr - // if (newInstance == nullptr) HICR_THROW_LOGIC("Tried to create new instance but did not find any free instances that meet the required topology"); - // If successful, initialize the new instance if (newInstance != nullptr) { // Request the execution of the main driver function - _rpcEngine->requestRPC(*newInstance->getBaseInstance(), __CLOUDR_LAUNCH_ENTRY_POINT_RPC_NAME); + _rpcEngine->requestRPC(newInstance->getBaseInstance()->getId(), __CLOUDR_LAUNCH_ENTRY_POINT_RPC_NAME); } // Returning result. Nullptr, if no instance was created @@ -308,7 +291,7 @@ class InstanceManager final : public HiCR::InstanceManager __INLINE__ void requestExchangeGlobalMemorySlots(HiCR::GlobalMemorySlot::tag_t tag) { // Asking free instances to run the exchange RPC - for (const auto &instance : _freeInstances) _rpcEngine->requestRPC(*instance, __CLOUDR_EXCHANGE_GLOBAL_MEMORY_SLOTS_RPC_NAME, tag); + for (const auto &instance : _freeInstances) _rpcEngine->requestRPC(instance->getId(), __CLOUDR_EXCHANGE_GLOBAL_MEMORY_SLOTS_RPC_NAME, tag); } /** @@ -319,7 +302,7 @@ class InstanceManager final : public HiCR::InstanceManager __INLINE__ void requestFence(HiCR::GlobalMemorySlot::tag_t tag) { // Asking free instances to run the exchange RPC - for (const auto &instance : _freeInstances) _rpcEngine->requestRPC(*instance, __CLOUDR_FENCE_RPC_NAME, tag); + for (const auto &instance : _freeInstances) _rpcEngine->requestRPC(instance->getId(), __CLOUDR_FENCE_RPC_NAME, tag); } /** @@ -349,7 +332,6 @@ class InstanceManager final : public HiCR::InstanceManager __INLINE__ void finalizeWorker() { // Do not continue listening - // printf("[CloudR] Worker %lu running finalizeWorker() RPC.\n", _rpcEngine->getInstanceManager()->getCurrentInstance()->getId()); _continueListening = false; } @@ -393,7 +375,7 @@ class InstanceManager final : public HiCR::InstanceManager std::vector> _cloudrInstances; /// A collection of ready-to-use instances currently on standby - std::set _freeInstances; + std::set _freeInstances; }; // class CloudR } // namespace HiCR::backend::cloudr \ No newline at end of file From 705b1cdb2b0c93659a433d177d5aac9222a2224b Mon Sep 17 00:00:00 2001 From: Luca Terracciano Date: Tue, 16 Sep 2025 15:40:41 +0200 Subject: [PATCH 3/4] ci: remove docker container folder --- .build-tools/containers/README.md | 1 - .build-tools/containers/build.sh | 25 -------------- .build-tools/containers/buildenv/Dockerfile | 1 - .build-tools/containers/buildenv/run.sh | 11 ------- .build-tools/containers/deploy.sh | 27 ---------------- .build-tools/containers/docs/Dockerfile | 36 --------------------- .build-tools/containers/manifest.sh | 6 ---- .build-tools/containers/run.sh | 24 -------------- 8 files changed, 131 deletions(-) delete mode 100644 .build-tools/containers/README.md delete mode 100755 .build-tools/containers/build.sh delete mode 100644 .build-tools/containers/buildenv/Dockerfile delete mode 100755 .build-tools/containers/buildenv/run.sh delete mode 100755 .build-tools/containers/deploy.sh delete mode 100644 .build-tools/containers/docs/Dockerfile delete mode 100755 .build-tools/containers/manifest.sh delete mode 100755 .build-tools/containers/run.sh diff --git a/.build-tools/containers/README.md b/.build-tools/containers/README.md deleted file mode 100644 index 4e6076f..0000000 --- a/.build-tools/containers/README.md +++ /dev/null @@ -1 +0,0 @@ -Containers to run the CI/CD pipelines for the HiCR and downstream projects diff --git a/.build-tools/containers/build.sh b/.build-tools/containers/build.sh deleted file mode 100755 index 92dd125..0000000 --- a/.build-tools/containers/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -if command -v arch &>/dev/null; then - target_arch=$(arch) - - if [ $target_arch == "aarch64" ]; then - target_arch="arm64" - else - target_arch="amd64" - fi -else - if [[ $# -ne 2 ]]; then - echo "arch not installed. Please provice manually the target architecture. Usage: $0 " - exit 1 - else - target_arch=${2} - fi -fi - -folder=${1} -echo "Building $folder for arch $target_arch" - -docker_base_image=registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/${folder} - -docker build -t "${docker_base_image}:latest-${target_arch}" ${folder} \ No newline at end of file diff --git a/.build-tools/containers/buildenv/Dockerfile b/.build-tools/containers/buildenv/Dockerfile deleted file mode 100644 index 461701b..0000000 --- a/.build-tools/containers/buildenv/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -FROM ghcr.io/algebraic-programming/hicr/buildenv:latest \ No newline at end of file diff --git a/.build-tools/containers/buildenv/run.sh b/.build-tools/containers/buildenv/run.sh deleted file mode 100755 index f0dcfe6..0000000 --- a/.build-tools/containers/buildenv/run.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -if [[ $# -ne 2 ]]; then - echo "Usage: $0 " - exit 1 -fi - -folder=${1} -arch=${2} - -docker run --name cloudr --shm-size=1024M --privileged -td "registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/${folder}:latest" bash diff --git a/.build-tools/containers/deploy.sh b/.build-tools/containers/deploy.sh deleted file mode 100755 index 5a18586..0000000 --- a/.build-tools/containers/deploy.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -if command -v arch &>/dev/null; then - target_arch=$(arch) - - if [ $target_arch == "aarch64" ]; then - target_arch="arm64" - else - target_arch="amd64" - fi -else - if [[ $# -ne 2 ]]; then - echo "arch not installed. Please provice manually the target architecture. Usage: $0 " - exit 1 - else - arch=${2} - fi -fi - -folder=${1} -echo "Deploying $folder for arch $target_arch" - -docker_base_image=registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/${folder} - -docker login registry.gitlab.huaweirc.ch - -docker push "${docker_base_image}:latest-${target_arch}" \ No newline at end of file diff --git a/.build-tools/containers/docs/Dockerfile b/.build-tools/containers/docs/Dockerfile deleted file mode 100644 index dbe3831..0000000 --- a/.build-tools/containers/docs/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM python:3.8 - -RUN pip install --upgrade pip -RUN pip install sphinx -RUN pip install sphinx_rtd_theme -RUN pip install sphinxcontrib-bibtex -RUN pip install doxysphinx -RUN pip install sphinxcontrib.needs -RUN pip install sphinxcontrib.plantuml -RUN pip install autoapi -RUN pip install sphinx-autoapi -RUN pip install myst_parser -RUN pip install sphinx_copybutton -RUN pip install sphinxcontrib.doxylink -RUN pip install sphinx_design -RUN pip install Sphinx-Substitution-Extensions -RUN pip install sphinx_toolbox -RUN pip install sphinx-theme -RUN pip install sphinx-book-theme -RUN pip install 'clang-format==18.1.0' - -RUN apt update -RUN apt install -y build-essential -RUN apt install -y doxygen -RUN apt install -y graphviz -RUN apt install -y fonts-freefont-ttf -RUN apt install -y texlive -RUN apt install -y texlive-latex-extra -RUN apt install -y texlive-fonts-extra -RUN apt install -y libffi-dev -RUN apt install -y ghostscript -RUN apt install -y texlive-extra-utils -RUN apt install -y texlive-font-utils - - - diff --git a/.build-tools/containers/manifest.sh b/.build-tools/containers/manifest.sh deleted file mode 100755 index 981510c..0000000 --- a/.build-tools/containers/manifest.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/env bash - -docker pull registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/buildenv:latest-amd64 -docker pull registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/buildenv:latest-arm64 - -docker buildx imagetools create --tag registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/buildenv:latest registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/buildenv:latest-amd64 registry.gitlab.huaweirc.ch/zrc-von-neumann-lab/runtime-system-innovations/cloudr/buildenv:latest-arm64 \ No newline at end of file diff --git a/.build-tools/containers/run.sh b/.build-tools/containers/run.sh deleted file mode 100755 index e9cf7ee..0000000 --- a/.build-tools/containers/run.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -if command -v arch &>/dev/null; then - target_arch=$(arch) - - if [ $target_arch == "aarch64" ]; then - target_arch="arm64" - else - target_arch="amd64" - fi -else - if [[ $# -ne 2 ]]; then - echo "arch not installed. Please provice manually the target architecture. Usage: $0 " - exit 1 - else - arch=${2} - fi -fi - -folder=${1} -echo "Running $folder for arch $target_arch" - -build_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -$build_dir/$folder/run.sh ${folder} ${target_arch} From 378b2cb34ad9f91c5ff002e7d961df13f46a3ffe Mon Sep 17 00:00:00 2001 From: Luca Terracciano Date: Tue, 16 Sep 2025 16:35:50 +0200 Subject: [PATCH 4/4] ci: remove redundant permissions --- .github/workflows/pr-development.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/pr-development.yml b/.github/workflows/pr-development.yml index 8c1961d..ea068d3 100644 --- a/.github/workflows/pr-development.yml +++ b/.github/workflows/pr-development.yml @@ -17,16 +17,12 @@ permissions: jobs: ci-arm64: uses: Algebraic-Programming/CloudR/.github/workflows/pr-development-workflow.yml@master - permissions: - pull-requests: write with: os: ubuntu-24.04-arm arch: arm64 ci-amd64: uses: Algebraic-Programming/CloudR/.github/workflows/pr-development-workflow.yml@master - permissions: - pull-requests: write with: os: ubuntu-24.04 arch: amd64 \ No newline at end of file