Skip to content

Commit

Permalink
Fix compilation errors after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenraven committed Aug 29, 2022
1 parent 672d988 commit d195361
Show file tree
Hide file tree
Showing 29 changed files with 116 additions and 68 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FAABRIC_VERSION=0.3.1
FAABRIC_CLI_IMAGE=kubasz51/faasm-faabric:0.3.1
FAABRIC_BASE_CLI_IMAGE=kubasz51/faasm-faabric-base:0.4.0
COMPOSE_PROJECT_NAME=faabric-dev
CONAN_CACHE_MOUNT_SOURCE=./conan-cache/
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.1
0.4.0
31 changes: 15 additions & 16 deletions cmake/ExternalProjects.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR})

if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.16.1/conan.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/conan.cmake"
EXPECTED_HASH SHA256=396e16d0f5eabdc6a14afddbcfff62a54a7ee75c6da23f32f7a31bc85db23484
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake"
TLS_VERIFY ON)
endif()

include(${CMAKE_CURRENT_BINARY_DIR}/conan.cmake)

conan_check(VERSION 1.43.0 REQUIRED)
conan_check(VERSION 1.51.3 REQUIRED)

# Enable revisions in the conan config
execute_process(COMMAND ${CONAN_CMD} config set general.revisions_enabled=1
Expand All @@ -29,19 +28,19 @@ endif()

conan_cmake_configure(
REQUIRES
"abseil/20211102.0@#469a22da5f3d4beeb200450447aa5d04"
"boost/1.78.0@#c6275b1e5ecf6e51fe8baf1e322bb065"
"catch2/2.13.7@#31c8cd08e3c957a9eac8cb1377cf5863"
"abseil/20220623.0@#732381dc99db29b4cfd293684891da56"
"boost/1.79.0@#3249d9bd2b863a9489767bf9c8a05b4b"
"catch2/2.13.9@#8793d3e6287d3684201418de556d98fe"
"cppcodec/0.2@#f6385611ce2f7cff954ac8b16e25c4fa"
"cpprestsdk/2.10.18@#36e30936126a3da485ce05d619fb1249"
"cppzmq/4.8.1@#e0f26b0614b3d812815edc102ce0d881"
"flatbuffers/2.0.0@#82f5d13594b370c3668bb8abccffc706"
"hiredis/1.0.2@#297f55bf1e66f8b9c1dc0e7d35e705ab"
"protobuf/3.19.1@#985baec06b243f56bce18cf7acbc4e34"
"cpprestsdk/2.10.18@#ed9788e9d202d6eadd92581368ddfc2f"
"cppzmq/4.8.1@#010df8fa1c5ebbc615704e8c16693bac"
"flatbuffers/2.0.5@#c6a9508bd476da080f7aecbe7a094b68"
"hiredis/1.0.2@#370dad964286cadb1f15dc90252e8ef3"
"protobuf/3.19.4@#a0bea09d5f31f0dc4fc0197644f5bc93"
"rapidjson/cci.20211112@#65b4e5feb6f1edfc8cbac0f669acaf17"
"readerwriterqueue/1.0.5@#4232c2ff826eb41e33d8ad8efd3c4c4c"
"spdlog/1.9.2@#3724602b7b7e843c5e0a687c45e279c9"
"zeromq/4.3.4@#3b9b0de9c4509784dc92629f3aaf2fe4"
"readerwriterqueue/1.0.6@#a95c8da3d68822dec4d4c13fff4b5c96"
"spdlog/1.10.0@#6406c337028e15e56cd6a070cbac54c4"
"zeromq/4.3.4@#d4fe4001f6c2e5960e58c251687c5b2f"
GENERATORS
cmake_find_package
cmake_paths
Expand Down Expand Up @@ -89,7 +88,7 @@ include(${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake)
find_package(absl REQUIRED)
find_package(Boost 1.78.0 REQUIRED)
find_package(Catch2 REQUIRED)
find_package(Flatbuffers REQUIRED)
find_package(FlatBuffers REQUIRED)
find_package(Protobuf 3.19.1 REQUIRED)
find_package(RapidJSON REQUIRED)
find_package(ZLIB REQUIRED)
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,27 @@ services:
command: ./bin/faabric_dist_test_server
depends_on:
- redis

base-cli:
image: ${FAABRIC_BASE_CLI_IMAGE}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
- ./:/code/faabric
- ./build:/build/faabric
- ${CONAN_CACHE_MOUNT_SOURCE}:/root/.conan
working_dir: /code/faabric
stdin_open: true
tty: true
privileged: true
environment:
- LOG_LEVEL=debug
- REDIS_STATE_HOST=redis
- REDIS_QUEUE_HOST=redis
- OVERRIDE_CPU_COUNT=${OVERRIDE_CPU_COUNT:-0}
- ASAN_OPTIONS=verbosity=1:halt_on_error=1
- TSAN_OPTIONS=halt_on_error=1:suppressions=/code/faabric/thread-sanitizer-ignorelist.txt:history_size=7:second_deadlock_stack=1
- UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1
- FAABRIC_DOCKER="on"
depends_on:
- redis
8 changes: 4 additions & 4 deletions docker/faabric-base-runtime.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bookworm-20211220-slim
FROM debian:bookworm-20220822-slim
# Debian "12" testing

RUN apt-get update \
Expand All @@ -15,7 +15,7 @@ RUN apt-get update \
liblttng-ust-ctl5 \
liblttng-ust1 \
libpython3-dev \
libssl1.1 \
libssl3 \
libstdc++6 \
libunwind-13 \
liburcu8 \
Expand All @@ -30,6 +30,6 @@ RUN apt-get update \
redis-tools \
sudo \
unzip \
&& apt-get clean autoclean \
&& apt-get autoremove
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes

11 changes: 5 additions & 6 deletions docker/faabric-base.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM kubasz51/faasm-faabric-base-runtime:0.3.1

RUN apt-get update \
&& apt-get upgrade --yes --no-install-recommends \
&& apt-get install --yes --no-install-recommends software-properties-common gpg wget curl \
&& apt-get install --yes --no-install-recommends \
autoconf \
automake \
Expand All @@ -14,7 +13,7 @@ RUN apt-get update \
clang-tools-13 \
cmake \
doxygen \
g++-11 \
g++-12 \
git \
libboost-filesystem-dev \
libc++-13-dev \
Expand All @@ -34,11 +33,11 @@ RUN apt-get update \
llvm-11-dev \
make \
ninja-build \
&& apt-get clean autoclean \
&& apt-get autoremove
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes

# Update pip
RUN pip install -U pip

RUN pip install cmake==3.22.1
RUN pip install conan==1.44.0
RUN pip install cmake==3.24.1
RUN pip install conan==1.51.3
2 changes: 1 addition & 1 deletion docker/faabric.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM kubasz51/faasm-faabric-base:0.3.1
FROM kubasz51/faasm-faabric-base:0.4.0
ARG FAABRIC_VERSION

# faabic-base image is not re-built often, so tag may be behind
Expand Down
2 changes: 1 addition & 1 deletion examples/server.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <faabric/endpoint/Endpoint.h>
#include <faabric/endpoint/FaabricEndpoint.h>
#include <faabric/endpoint/FaabricEndpointHandler.h>
#include <faabric/runner/FaabricMain.h>
#include <faabric/scheduler/ExecutorFactory.h>
Expand Down
2 changes: 1 addition & 1 deletion include/faabric/endpoint/FaabricEndpointHandler.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <faabric/endpoint/Endpoint.h>
#include <faabric/endpoint/FaabricEndpoint.h>
#include <faabric/proto/faabric.pb.h>

namespace faabric::endpoint {
Expand Down
2 changes: 1 addition & 1 deletion include/faabric/endpoint/macros.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <faabric/endpoint/Endpoint.h>
#include <faabric/endpoint/FaabricEndpoint.h>

using namespace faabric::endpoint;

Expand Down
2 changes: 1 addition & 1 deletion include/faabric/mpi-native/MpiExecutor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <faabric/endpoint/Endpoint.h>
#include <faabric/endpoint/FaabricEndpoint.h>
#include <faabric/endpoint/FaabricEndpointHandler.h>
#include <faabric/scheduler/ExecutorFactory.h>
#include <faabric/scheduler/Scheduler.h>
Expand Down
12 changes: 12 additions & 0 deletions include/faabric/proto/faabric.pb.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <memory>
#include <faabric/util/gids.h>

#include_next "faabric.pb.h"

Expand All @@ -17,13 +18,24 @@ struct MessageInBatch final
: batch(batch)
, msg(batch->mutable_messages()->at(idx))
{}
explicit MessageInBatch(Message& rmsg)
: batch(initBatch(rmsg))
, msg(batch->mutable_messages()->at(0))
{}

Message* operator->() { return &msg; }
const Message* operator->() const { return &msg; }
Message& operator*() { return msg; }
const Message& operator*() const { return msg; }
operator Message&() { return msg; }
operator const Message&() const { return msg; }
private:
static std::shared_ptr<BatchExecuteRequest> initBatch(Message& rmsg) {
auto batch = std::make_shared<faabric::BatchExecuteRequest>();
batch->set_id(faabric::util::generateGid());
*batch->add_messages() = std::move(rmsg);
return batch;
}
};

}
2 changes: 2 additions & 0 deletions include/faabric/util/func.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ faabric::Message messageFactory(const std::string& user,

std::shared_ptr<faabric::BatchExecuteRequest> batchExecFactory();

std::shared_ptr<faabric::BatchExecuteRequest> batchExecFactory(faabric::Message&& msg);

std::shared_ptr<faabric::BatchExecuteRequest> batchExecFactory(
const std::string& user,
const std::string& function,
Expand Down
2 changes: 1 addition & 1 deletion include/faabric/util/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cstdint>
#include <fcntl.h>
#include <functional>
#include <linux/userfaultfd.h>
#include "userfaultfd.h"
#include <memory>
#include <optional>
#include <span>
Expand Down
4 changes: 4 additions & 0 deletions include/faabric/util/userfaultfd.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifndef __packed
#define __packed __attribute__((__packed__))
#endif

// ------------------------------------------------------
// This is copied into Faabric from the kernel source because not all the UFFD
// definitions are available when running with HWE on Ubuntu 20.04.
Expand Down
4 changes: 2 additions & 2 deletions src/endpoint/FaabricEndpoint.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <faabric/endpoint/Endpoint.h>
#include <faabric/endpoint/FaabricEndpoint.h>
#include <faabric/scheduler/Scheduler.h>
#include <faabric/util/logging.h>
#include <faabric/util/macros.h>
Expand Down Expand Up @@ -253,7 +253,7 @@ void Endpoint::start(EndpointMode mode)

std::make_shared<SchedulerMonitoringTask>(state->ioc)->run();

int extraThreads = std::max(awaitSignal ? 0 : 1, this->threadCount - 1);
int extraThreads = std::max((mode == EndpointMode::SIGNAL) ? 0 : 1, this->threadCount - 1);
state->ioThreads.reserve(extraThreads);
auto ioc_run = [&ioc{ state->ioc }]() { ioc.run(); };
for (int i = 0; i < extraThreads; i++) {
Expand Down
7 changes: 1 addition & 6 deletions src/endpoint/FaabricEndpointHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,7 @@ void FaabricEndpointHandler::onFunctionResult(
(pid_t)syscall(SYS_gettid),
faabric::util::funcToString(result, true));

if (result.sgxresult().empty()) {
response.body() = result.outputdata();
return ctx.sendFunction(std::move(response));
}

response.body() = faabric::util::getJsonOutput(result);
response.body() = result.outputdata();
return ctx.sendFunction(std::move(response));
/*
} catch (faabric::redis::RedisNoResponseException& ex) {
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void Executor::threadPoolThread(std::stop_token st, int threadPoolIdx)
bool isThreads =
task.req->type() == faabric::BatchExecuteRequest::THREADS;
if (isThreads) {
sch.setThreadResult(msg, 1);
sch.setThreadResult(msg, 1, "", {});
} else {
sch.setFunctionResult(msg);
}
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/FunctionCallServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void FunctionCallServer::doAsyncRecv(transport::Message& message)
break;
}
case faabric::scheduler::FunctionCalls::DirectResult: {
recvDirectResult(buffer, bufferSize);
recvDirectResult(message.udata(), message.size());
break;
}
default: {
Expand Down
14 changes: 7 additions & 7 deletions src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ faabric::util::SchedulingDecision Scheduler::callFunctions(
SchedulingDecision decision = doSchedulingDecision(req, topologyHint);

// Pass decision as hint
return doCallFunctions(std::move(req), decision, lock, topologyHint);
return doCallFunctions(std::move(req), decision, caller, lock, topologyHint);
}

faabric::util::SchedulingDecision Scheduler::makeSchedulingDecision(
Expand All @@ -424,12 +424,12 @@ faabric::util::SchedulingDecision Scheduler::makeSchedulingDecision(
}

faabric::util::SchedulingDecision Scheduler::doSchedulingDecision(
const faabric::BatchExecuteRequest& req,
std::shared_ptr<faabric::BatchExecuteRequest> req,
faabric::util::SchedulingTopologyHint topologyHint)
{
ZoneScopedNS("Scheduler::makeSchedulingDecision", 5);
int nMessages = req.messages_size();
const faabric::Message& firstMsg = req.messages().at(0);
int nMessages = req->messages_size();
const faabric::Message& firstMsg = req->messages().at(0);
std::string funcStr = faabric::util::funcToString(firstMsg, false);

bool isStorage = firstMsg.isstorage();
Expand Down Expand Up @@ -668,7 +668,7 @@ faabric::util::SchedulingDecision Scheduler::doSchedulingDecision(
// Set up decision
SchedulingDecision decision(firstMsg.appid(), firstMsg.groupid());
for (int i = 0; i < hosts.size(); i++) {
decision.addMessage(hosts.at(i), req.messages().at(i));
decision.addMessage(hosts.at(i), req->messages().at(i));
}

// Cache decision for next time if necessary
Expand Down Expand Up @@ -1250,8 +1250,8 @@ void Scheduler::setFunctionResult(std::unique_ptr<faabric::Message> msg)

// Remove the app from in-flight map if still there, and this host is the
// master host for the message
if (msg.masterhost() == thisHost) {
removePendingMigration(msg.appid());
if (msg->masterhost() == thisHost) {
removePendingMigration(msg->appid());
}

// Write the successful result to the result queue
Expand Down
4 changes: 2 additions & 2 deletions src/transport/MessageEndpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ zmq::socket_t socketFactory(zmq::socket_type socketType,
}
default: {
SPDLOG_ERROR(
"Invalid bind socket type {} ({})", socketType, address);
"Invalid bind socket type {} ({})", (int) socketType, address);
throw std::runtime_error(
"Binding with invalid socket type");
}
Expand Down Expand Up @@ -179,7 +179,7 @@ zmq::socket_t socketFactory(zmq::socket_type socketType,
}
default: {
SPDLOG_ERROR("Invalid connect socket type {} ({})",
socketType,
(int) socketType,
address);
throw std::runtime_error(
"Connecting with unrecognized socket type");
Expand Down
11 changes: 11 additions & 0 deletions src/util/func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ std::shared_ptr<faabric::BatchExecuteRequest> batchExecFactory()
return req;
}

std::shared_ptr<faabric::BatchExecuteRequest> batchExecFactory(faabric::Message&& msg)
{
auto req = batchExecFactory();

uint32_t appId = faabric::util::generateGid();
*req->add_messages() = std::move(msg);
req->mutable_messages()->at(0).set_appid(appId);

return req;
}

std::shared_ptr<faabric::BatchExecuteRequest> batchExecFactory(
const std::string& user,
const std::string& function,
Expand Down
7 changes: 5 additions & 2 deletions tasks/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,19 @@ def cmake(


@task
def cc(ctx, target, shared=False):
def cc(ctx, target, shared=False, parallel = 0):
"""
Compile the given target
"""
build_dir = (
FAABRIC_SHARED_BUILD_DIR if shared else FAABRIC_STATIC_BUILD_DIR
)

cmake_cmd = "cmake --build . --target {}".format(target)
if parallel > 0:
cmake_cmd += " --parallel {}".format(parallel)
run(
"cmake --build . --target {}".format(target),
cmake_cmd,
check=True,
cwd=build_dir,
shell=True,
Expand Down
Loading

0 comments on commit d195361

Please sign in to comment.