From 24cf3c50e5857e3533d3aaf2e0c4cbd48f5601ae Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Tue, 27 Feb 2024 18:06:01 +0000 Subject: [PATCH 1/3] nits: run clang format --- include/faabric/util/queue.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/include/faabric/util/queue.h b/include/faabric/util/queue.h index 28462a32b..9f9e2f164 100644 --- a/include/faabric/util/queue.h +++ b/include/faabric/util/queue.h @@ -222,24 +222,34 @@ template class SpinLockQueue { public: - void enqueue(T& value, long timeoutMs = DEFAULT_QUEUE_TIMEOUT_MS) { - while (!mq.push(value)) { ; }; + void enqueue(T& value, long timeoutMs = DEFAULT_QUEUE_TIMEOUT_MS) + { + while (!mq.push(value)) { + ; + }; } - T dequeue(long timeoutMs = DEFAULT_QUEUE_TIMEOUT_MS) { + T dequeue(long timeoutMs = DEFAULT_QUEUE_TIMEOUT_MS) + { T value; - while (!mq.pop(value)) { ; } + while (!mq.pop(value)) { + ; + } return value; } - long size() { + long size() + { throw std::runtime_error("Size for fast queue unimplemented!"); } - void drain() { - while (mq.pop()) { ; } + void drain() + { + while (mq.pop()) { + ; + } } void reset() { ; } From 15f6693a8fb949651f446c6ba7476a92f5ee275e Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Tue, 27 Feb 2024 18:32:37 +0000 Subject: [PATCH 2/3] mpi: remove obsolete getLocalQueueSize method --- include/faabric/mpi/MpiWorld.h | 2 -- src/mpi/MpiWorld.cpp | 7 ------- tests/test/mpi/test_mpi_world.cpp | 15 -------------- tests/test/mpi/test_multiple_mpi_worlds.cpp | 23 --------------------- 4 files changed, 47 deletions(-) diff --git a/include/faabric/mpi/MpiWorld.h b/include/faabric/mpi/MpiWorld.h index 2402d2e36..27765e144 100644 --- a/include/faabric/mpi/MpiWorld.h +++ b/include/faabric/mpi/MpiWorld.h @@ -185,8 +185,6 @@ class MpiWorld std::shared_ptr getLocalQueue(int sendRank, int recvRank); - long getLocalQueueSize(int sendRank, int recvRank); - void overrideHost(const std::string& newHost); double getWTime(); diff --git a/src/mpi/MpiWorld.cpp b/src/mpi/MpiWorld.cpp index aa335b094..3c15d92ba 100644 --- a/src/mpi/MpiWorld.cpp +++ b/src/mpi/MpiWorld.cpp @@ -1546,13 +1546,6 @@ int MpiWorld::getIndexForRanks(int sendRank, int recvRank) const return index; } -long MpiWorld::getLocalQueueSize(int sendRank, int recvRank) -{ - const std::shared_ptr& queue = - getLocalQueue(sendRank, recvRank); - return queue->size(); -} - double MpiWorld::getWTime() { double t = faabric::util::getTimeDiffMillis(creationTime); diff --git a/tests/test/mpi/test_mpi_world.cpp b/tests/test/mpi/test_mpi_world.cpp index 1d3aec71a..8c1aca149 100644 --- a/tests/test/mpi/test_mpi_world.cpp +++ b/tests/test/mpi/test_mpi_world.cpp @@ -242,21 +242,6 @@ TEST_CASE_METHOD(MpiTestFixture, "Test send and recv on same host", "[mpi]") world.send( rankA1, rankA2, BYTES(messageData.data()), MPI_INT, messageData.size()); - SECTION("Test queueing") - { - // Check the message itself is on the right queue - REQUIRE(world.getLocalQueueSize(rankA1, rankA2) == 1); - REQUIRE(world.getLocalQueueSize(rankA2, rankA1) == 0); - REQUIRE(world.getLocalQueueSize(rankA1, 0) == 0); - REQUIRE(world.getLocalQueueSize(rankA2, 0) == 0); - - // Check message content - const std::shared_ptr& queueA2 = - world.getLocalQueue(rankA1, rankA2); - MPIMessage actualMessage = *(queueA2->dequeue()); - checkMessage(actualMessage, worldId, rankA1, rankA2, messageData); - } - SECTION("Test recv") { // Receive the message diff --git a/tests/test/mpi/test_multiple_mpi_worlds.cpp b/tests/test/mpi/test_multiple_mpi_worlds.cpp index 735556f6e..a1062e81b 100644 --- a/tests/test/mpi/test_multiple_mpi_worlds.cpp +++ b/tests/test/mpi/test_multiple_mpi_worlds.cpp @@ -155,29 +155,6 @@ TEST_CASE_METHOD(MultiWorldMpiTestFixture, worldB.send( rankA1, rankA2, BYTES(messageData.data()), MPI_INT, messageData.size()); - SECTION("Test queueing") - { - // Check for world A - REQUIRE(worldA.getLocalQueueSize(rankA1, rankA2) == 1); - REQUIRE(worldA.getLocalQueueSize(rankA2, rankA1) == 0); - REQUIRE(worldA.getLocalQueueSize(rankA1, 0) == 0); - REQUIRE(worldA.getLocalQueueSize(rankA2, 0) == 0); - const std::shared_ptr& queueA2 = - worldA.getLocalQueue(rankA1, rankA2); - MPIMessage actualMessage = *(queueA2->dequeue()); - // checkMessage(actualMessage, worldId, rankA1, rankA2, messageData); - - // Check for world B - REQUIRE(worldB.getLocalQueueSize(rankA1, rankA2) == 1); - REQUIRE(worldB.getLocalQueueSize(rankA2, rankA1) == 0); - REQUIRE(worldB.getLocalQueueSize(rankA1, 0) == 0); - REQUIRE(worldB.getLocalQueueSize(rankA2, 0) == 0); - const std::shared_ptr& queueA2B = - worldB.getLocalQueue(rankA1, rankA2); - actualMessage = *(queueA2B->dequeue()); - // checkMessage(actualMessage, worldId, rankA1, rankA2, messageData); - } - SECTION("Test recv") { MPI_Status status{}; From 7b284a21038d12dfbd96b553bc99c82bc2332a93 Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Wed, 28 Feb 2024 09:18:27 +0000 Subject: [PATCH 3/3] gha: add cautionary timeout in gha tests --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9eebd4ffb..ceb787294 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -105,6 +105,7 @@ jobs: if: github.event.pull_request.draft == false needs: [conan-cache] runs-on: ubuntu-latest + timeout-minutes: 20 strategy: fail-fast: false matrix: @@ -139,6 +140,7 @@ jobs: if: github.event.pull_request.draft == false needs: [conan-cache] runs-on: ubuntu-latest + timeout-minutes: 20 env: CONAN_CACHE_MOUNT_SOURCE: ~/.conan/ steps: