Skip to content

Commit

Permalink
adapt to boost-leaf
Browse files Browse the repository at this point in the history
Committed-by: xiaolei.zl from Dev container
  • Loading branch information
zhanglei1949 committed Sep 5, 2024
1 parent 95dcd53 commit 24657d2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "GraphScope",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-dev:latest",
"image": "registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-dev:v0.24.0-amd", // TODO(fixme)

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
Expand Down
51 changes: 33 additions & 18 deletions flex/bin/adhoc_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "flex/engines/graph_db/runtime/adhoc/runtime.h"

namespace bpo = boost::program_options;
namespace bl = boost::leaf;

std::string read_pb(const std::string& filename) {
std::ifstream file(filename, std::ios::binary);
Expand Down Expand Up @@ -74,6 +75,32 @@ void load_params(const std::string& filename,
}
}

gs::runtime::Context eval_plan(
const physical::PhysicalPlan& plan, gs::ReadTransaction& txn,
const std::map<std::string, std::string>& params) {
gs::runtime::Context ctx;
{
ctx = bl::try_handle_all(
[&plan, &txn, &params]() {
return gs::runtime::runtime_eval(plan, txn, params);
},
[&ctx](const gs::Status& err) {
LOG(FATAL) << "Error in execution: " << err.error_message();
return ctx;
},
[&](const bl::error_info& err) {
LOG(FATAL) << "boost leaf error: " << err.error().value() << ", "
<< err.exception()->what();
return ctx;
},
[&]() {
LOG(FATAL) << "Unknown error in execution";
return ctx;
});
}
return ctx;
}

int main(int argc, char** argv) {
bpo::options_description desc("Usage:");
desc.add_options()("help", "Display help message")(
Expand Down Expand Up @@ -158,41 +185,29 @@ int main(int argc, char** argv) {
double t1 = -grape::GetCurrentTime();
for (int i = 0; i < query_num; ++i) {
auto& m = map[i % params_num];
auto ctx = gs::runtime::runtime_eval(pb, txn, m);
if (!ctx) {
LOG(ERROR) << "Eval plan failed: " << ctx.error();
return -1;
}
auto ctx = eval_plan(pb, txn, m);
gs::Encoder output(outputs[i]);
gs::runtime::eval_sink(ctx.value(), txn, output);
gs::runtime::eval_sink(ctx, txn, output);
}
t1 += grape::GetCurrentTime();

double t2 = -grape::GetCurrentTime();
for (int i = 0; i < query_num; ++i) {
auto& m = map[i % params_num];
auto ctx = gs::runtime::runtime_eval(pb, txn, m);
if (!ctx) {
LOG(ERROR) << "Eval plan failed: " << ctx.error();
return -1;
}
auto ctx = eval_plan(pb, txn, m);
outputs[i].clear();
gs::Encoder output(outputs[i]);
gs::runtime::eval_sink(ctx.value(), txn, output);
gs::runtime::eval_sink(ctx, txn, output);
}
t2 += grape::GetCurrentTime();

double t3 = -grape::GetCurrentTime();
for (int i = 0; i < query_num; ++i) {
auto& m = map[i % params_num];
auto ctx = gs::runtime::runtime_eval(pb, txn, m);
if (!ctx) {
LOG(ERROR) << "Eval plan failed: " << ctx.error();
return -1;
}
auto ctx = eval_plan(pb, txn, m);
outputs[i].clear();
gs::Encoder output(outputs[i]);
gs::runtime::eval_sink(ctx.value(), txn, output);
gs::runtime::eval_sink(ctx, txn, output);
}
t3 += grape::GetCurrentTime();

Expand Down
12 changes: 11 additions & 1 deletion flex/scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@ echo "parallelism: $parallelism"
sudo apt-get update && sudo apt install -y \
ninja-build ragel libhwloc-dev libnuma-dev libpciaccess-dev vim wget curl \
git g++ libunwind-dev libgoogle-glog-dev cmake libopenmpi-dev default-jdk libcrypto++-dev \
libboost-all-dev libxml2-dev protobuf-compiler libprotobuf-dev libncurses5-dev libcurl4-openssl-dev
libxml2-dev protobuf-compiler libprotobuf-dev libncurses5-dev libcurl4-openssl-dev
sudo apt install -y xfslibs-dev libgnutls28-dev liblz4-dev maven openssl pkg-config \
libsctp-dev gcc make python3 systemtap-sdt-dev libtool libyaml-cpp-dev \
libc-ares-dev stow libfmt-dev diffutils valgrind doxygen python3-pip net-tools graphviz

# install boost
pushd /tmp/
curl -L -o boost_1_75_0.tar.gz "https://graphscope.oss-cn-beijing.aliyuncs.com/dependencies/boost_1_75_0.tar.gz"
tar -xzf boost_1_75_0.tar.gz
pushd boost_1_75_0 && ./bootstrap.sh \
--with-libraries=system,filesystem,context,program_options,regex,thread,chrono,date_time # unit_test_framework used by seastar
./b2 install link=shared runtime-link=shared variant=release threading=multi --with-test
popd && rm -rf boost_1_75_0
popd && rm boost_1_75_0.tar.gz

pushd /tmp
git clone https://github.com/alibaba/libgrape-lite.git
cd libgrape-lite
Expand Down

0 comments on commit 24657d2

Please sign in to comment.