Skip to content

Commit

Permalink
Merge branch 'main' into ir_fix_type_convert
Browse files Browse the repository at this point in the history
  • Loading branch information
shirly121 authored Oct 10, 2023
2 parents 99b33cd + b56948e commit 2815630
Show file tree
Hide file tree
Showing 39 changed files with 772 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# only_if: $CIRRUS_TAG != ''

env:
MACOSX_DEPLOYMENT_TARGET: "11"
MACOSX_DEPLOYMENT_TARGET: "12"

macosx_arm64_wheel_task:
macos_instance:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-graphscope-wheels-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
jobs:
build-wheels:
if: (github.ref == 'refs/heads/main' && github.repository == 'alibaba/GraphScope') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'alibaba/GraphScope') || (github.event_name == 'workflow_dispatch')
runs-on: macos-11
runs-on: macos-12
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:

build-client-wheels:
if: (github.ref == 'refs/heads/main' && github.repository == 'alibaba/GraphScope') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'alibaba/GraphScope') || (github.event_name == 'workflow_dispatch')
runs-on: macos-11
runs-on: macos-12
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:

python-test:
if: ${{ (github.ref == 'refs/heads/main' && github.repository == 'alibaba/GraphScope') || (github.event_name == 'workflow_dispatch') }}
runs-on: macos-11
runs-on: macos-12
needs: [build-wheels, build-client-wheels]
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pip3 install graphscope

注意 `graphscope` 的版本要求,需要 `Python` >= 3.7 及 `pip` >= 19.0.

GraphScope 包在大多数流行的Linux发行版 (Ubuntu 20.04+ / Centos 7+) 与 macOS 11+ (Intel) / macOS 12+ (Apple silicon) 上测试通过,对于 Windows 用户,需要在 WSL2 上安装 Ubuntu 来使用 GraphScope。
GraphScope 包在大多数流行的Linux发行版 (Ubuntu 20.04+ / Centos 7+) 与 macOS 12+ (Intel/Apple silicon) 上测试通过,对于 Windows 用户,需要在 WSL2 上安装 Ubuntu 来使用 GraphScope。

接下来我们会用一个具体的例子,来演示 GraphScope 如何帮助数据科学家高效的分析、处理大规模图数据。

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ GraphScope pre-compiled package is distributed as a python package and can be ea
pip3 install graphscope
```

Note that `graphscope` requires `Python` >= `3.8` and `pip` >= `19.3`. The package is built for and tested on the most popular Linux (Ubuntu 20.04+ / CentOS 7+) and macOS 11+ (Intel) / macOS 12+ (Apple silicon) distributions. For Windows users, you may want to install Ubuntu on WSL2 to use this package.
Note that `graphscope` requires `Python` >= `3.8` and `pip` >= `19.3`. The package is built for and tested on the most popular Linux (Ubuntu 20.04+ / CentOS 7+) and macOS 12+ (Intel/Apple silicon) distributions. For Windows users, you may want to install Ubuntu on WSL2 to use this package.

Next, we will walk you through a concrete example to illustrate how GraphScope can be used by data scientists to effectively analyze large graphs.

Expand Down
2 changes: 1 addition & 1 deletion docs/deployment/install_on_local.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This guide will walk you through the process of installing GraphScope on your lo

## Prerequisites

- Ubuntu 20.04 or later, CentOS 7 or later, or macOS 11 (Intel) / macOS 12 (Apple silicon) or later
- Ubuntu 20.04 or later, CentOS 7 or later, or macOS 12 (Intel/Apple silicon) or later
- Python 3.7 ~ 3.11, and pip >= 19.3
- JDK 11 (If you want to use GIE, both JDK 8 and 20 have known compatibility issues)

Expand Down
2 changes: 1 addition & 1 deletion docs/interactive_engine/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ And it is tested on the following 64-bit operating systems:

- Ubuntu 18.04 or later
- CentOS 7 or later
- macOS 11 (Intel) / macOS 12 (Apple silicon) or later, with both Intel chip and Apple M1 chip
- macOS 12 (Intel/Apple silicon) or later, with both Intel chip and Apple M1 chip

If your environment satisfies the above requirement, you can easily install GraphScope through pip:

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Coordinator 作为 GraphScope 后端服务的入口,通过 grpc 接收来自 P
本地部署GraphScope
-----------------

我们提供了一个可在本地安装GraphScope相关依赖的脚本,该脚本可以运行在 Ubuntu 20.04+ 或 MacOS 11+ (Intel) / MacOS 12+ (Apple silicon) 平台上, 主要的用法如下:
我们提供了一个可在本地安装GraphScope相关依赖的脚本,该脚本可以运行在 Ubuntu 20.04+ 或 MacOS 12+ (Intel/Apple silicon) 平台上, 主要的用法如下:
你可以通过 `python3 gsctl.py -h` 获取更详细的帮助信息。

* 安装 GraphScope 开发相关依赖
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/frequently_asked_questions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

- CentOS 7+
- Ubuntu 18.04+
- MacOS 10.15+
- MacOS 12 (Intel/Apple Silicon)

对于分布式部署,需要用户拥有一个 Kubernetes 集群,GraphScope 在 **Kubernetes version >= v1.12.0+** 的环境上测试通过。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GraphScope 目前支持的平台如下:
- Python 3.7 - 3.9
- Ubuntu 18.04 or later
- CentOS 7 or later
- macOS 11.2.1 (Big Sur) or later, with both Intel chip and Apple M1 chip
- macOS 12 (Monterey) or later, with both Intel chip and Apple M1 chip


单机环境下安装
Expand Down
6 changes: 5 additions & 1 deletion flex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ add_compile_definitions(FLEX_VERSION="${FLEX_VERSION}")
if (APPLE)
set(CMAKE_MACOSX_RPATH ON)
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -Werror -Wl,-rpath,$ORIGIN")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -Wl,-rpath,$ORIGIN -lopen-pal")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -Werror -Wl,-rpath,$ORIGIN")
endif ()
endif ()

find_package(MPI REQUIRED)
Expand Down
11 changes: 11 additions & 0 deletions flex/bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ if(Hiactor_FOUND)
LIBRARY DESTINATION lib)
endif()

if(Hiactor_FOUND)
include_directories(../engines/http_server)
add_executable(rt_bench rt_bench.cc)
target_link_libraries(rt_bench flex_utils flex_rt_mutable_graph flex_graph_db flex_server)

install(TARGETS rt_bench
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
endif()

add_executable(rt_admin rt_admin.cc)
target_link_libraries(rt_admin flex_utils flex_rt_mutable_graph flex_graph_db)

Expand Down
247 changes: 247 additions & 0 deletions flex/bin/rt_bench.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
/** Copyright 2020 Alibaba Group Holding Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "grape/util.h"

#include <boost/program_options.hpp>
#include <chrono>
#include <fstream>
#include <hiactor/core/actor-app.hh>
#include <iostream>
#include <vector>
#include "flex/engines/graph_db/database/graph_db.h"
#include "flex/engines/http_server/executor_group.actg.h"
#include "flex/engines/http_server/generated/executor_ref.act.autogen.h"
#include "flex/engines/http_server/graph_db_service.h"

namespace bpo = boost::program_options;
using namespace std::chrono_literals;
class Req {
public:
static Req& get() {
static Req r;
return r;
}
void init(int warmup_num, int benchmark_num) {
warmup_num_ = warmup_num;
num_of_reqs_ = warmup_num + benchmark_num;

if (num_of_reqs_ == warmup_num_ || num_of_reqs_ >= reqs_.size()) {
num_of_reqs_ = reqs_.size();
}
std::cout << "warmup count: " << warmup_num_
<< "; benchmark count: " << num_of_reqs_ << "\n";
}
void load(const std::string& file) {
std::cout << "load queries from " << file << "\n";
std::ifstream fi(file, std::ios::binary);
const size_t size = 4096;
std::vector<char> buffer(size);
std::vector<char> tmp(size);
size_t index = 0;
while (fi.read(buffer.data(), size)) {
auto len = fi.gcount();
for (size_t i = 0; i < len; ++i) {
if (index >= 4 && tmp[index - 1] == '#') {
if (tmp[index - 4] == 'e' && tmp[index - 3] == 'o' &&
tmp[index - 2] == 'r') {
reqs_.emplace_back(
std::string(tmp.begin(), tmp.begin() + index - 4));

index = 0;
}
}
tmp[index++] = buffer[i];
}
buffer.clear();
}
fi.close();
std::cout << "load " << reqs_.size() << " queries\n";
num_of_reqs_ = reqs_.size();
// reqs_.resize(100000);
start_.resize(reqs_.size());
end_.resize(reqs_.size());
}

seastar::future<> do_query(server::executor_ref& ref) {
auto id = cur_.fetch_add(1);
if (id >= num_of_reqs_) {
return seastar::make_ready_future<>();
}
start_[id] = std::chrono::system_clock::now();
return ref.run_graph_db_query(server::query_param{reqs_[id]})
.then_wrapped(
[&, id](seastar::future<server::query_result>&& fut) mutable {
auto result = fut.get0();
end_[id] = std::chrono::system_clock::now();
})
.then([&] { return do_query(ref); });
}

seastar::future<> simulate() {
hiactor::scope_builder builder;
builder.set_shard(hiactor::local_shard_id())
.enter_sub_scope(hiactor::scope<server::executor_group>(0));
return seastar::do_with(
builder.build_ref<server::executor_ref>(0),
[&](server::executor_ref& ref) { return do_query(ref); });
}

void output() {
std::vector<long long> vec(29, 0);
std::vector<int> count(29, 0);
std::vector<std::vector<long long>> ts(29);
for (size_t idx = warmup_num_; idx < num_of_reqs_; idx++) {
auto& s = reqs_[idx];
size_t id = static_cast<size_t>(s.back()) - 1;
auto tmp = std::chrono::duration_cast<std::chrono::microseconds>(
end_[idx] - start_[idx])
.count();
ts[id].emplace_back(tmp);
vec[id] += tmp;
count[id] += 1;
}
std::vector<std::string> queries = {
"IC1", "IC2", "IC3", "IC4", "IC5", "IC6", "IC7", "IC8",
"IC9", "IC10", "IC11", "IC12", "IC13", "IC14", "IS1", "IS2",
"IS3", "IS4", "IS5", "IS6", "IS7", "IU1", "IU2", "IU3",
"IU4", "IU5", "IU6", "IU7", "IU8"};
for (auto i = 0; i < vec.size(); ++i) {
size_t sz = ts[i].size();
if (sz > 0) {
std::cout << queries[i] << "; mean: " << vec[i] * 1. / count[i]
<< "; counts: " << count[i] << "; ";

std::sort(ts[i].begin(), ts[i].end());
std::cout << " min: " << ts[i][0] << "; ";
std::cout << " max: " << ts[i].back() << "; ";
std::cout << " P50: " << ts[i][sz / 2] << "; ";
std::cout << " P90: " << ts[i][sz * 9 / 10] << "; ";
std::cout << " P95: " << ts[i][sz * 95 / 100] << "; ";
std::cout << " P99: " << ts[i][sz * 99 / 100] << "\n";
}
}
std::cout << "unit: MICROSECONDS\n";
}

private:
Req() : cur_(0), warmup_num_(0) {}

std::atomic<uint32_t> cur_;
uint32_t warmup_num_;
uint32_t num_of_reqs_;
std::vector<std::string> reqs_;
std::vector<std::chrono::system_clock::time_point> start_;
std::vector<std::chrono::system_clock::time_point> end_;

// std::vector<executor_ref> executor_refs_;
};

int main(int argc, char** argv) {
bpo::options_description desc("Usage:");
desc.add_options()("help", "Display help message")(
"version,v", "Display version")("shard-num,s",
bpo::value<uint32_t>()->default_value(1),
"shard number of actor system")(
"graph-config,g", bpo::value<std::string>(), "graph schema config file")(
"data-path,d", bpo::value<std::string>(), "data directory path")(
"bulk-load,l", bpo::value<std::string>(), "bulk-load config file")(
"warmup-num,w", bpo::value<uint32_t>()->default_value(0),
"num of warmup reqs")("benchmark-num,b",
bpo::value<uint32_t>()->default_value(0),
"num of benchmark reqs")(
"req-file,r", bpo::value<std::string>(), "requests file");

google::InitGoogleLogging(argv[0]);
FLAGS_logtostderr = true;

bpo::variables_map vm;
bpo::store(bpo::command_line_parser(argc, argv).options(desc).run(), vm);
bpo::notify(vm);

if (vm.count("help")) {
std::cout << desc << std::endl;
return 0;
}
if (vm.count("version")) {
std::cout << "GraphScope/Flex version " << FLEX_VERSION << std::endl;
return 0;
}

bool enable_dpdk = false;
uint32_t shard_num = vm["shard-num"].as<uint32_t>();

std::string graph_schema_path = "";
std::string data_path = "";
std::string bulk_load_config_path = "";

if (!vm.count("graph-config")) {
LOG(ERROR) << "graph-config is required";
return -1;
}
graph_schema_path = vm["graph-config"].as<std::string>();
if (!vm.count("data-path")) {
LOG(ERROR) << "data-path is required";
return -1;
}
data_path = vm["data-path"].as<std::string>();
if (vm.count("bulk-load")) {
bulk_load_config_path = vm["bulk-load"].as<std::string>();
}

setenv("TZ", "Asia/Shanghai", 1);
tzset();

double t0 = -grape::GetCurrentTime();
auto& db = gs::GraphDB::get();

auto schema = gs::Schema::LoadFromYaml(graph_schema_path);
auto loading_config =
gs::LoadingConfig::ParseFromYaml(schema, bulk_load_config_path);
db.Init(schema, loading_config, data_path, shard_num);

t0 += grape::GetCurrentTime();
uint32_t warmup_num = vm["warmup-num"].as<uint32_t>();
uint32_t benchmark_num = vm["benchmark-num"].as<uint32_t>();
LOG(INFO) << "Finished loading graph, elapsed " << t0 << " s";
std::string req_file = vm["req-file"].as<std::string>();
Req::get().load(req_file);
Req::get().init(warmup_num, benchmark_num);
hiactor::actor_app app;

auto begin = std::chrono::system_clock::now();
int ac = 1;
char* av[] = {(char*) "rt_bench"};
app.run(ac, av, [shard_num] {
return seastar::parallel_for_each(
boost::irange<unsigned>(0u, shard_num),
[](unsigned id) {
return seastar::smp::submit_to(
id, [id] { return Req::get().simulate(); });
})
.then([] {
hiactor::actor_engine().exit();
fmt::print("Exit actor system.\n");
});
});
auto end = std::chrono::system_clock::now();
std::cout << "cost time:"
<< std::chrono::duration_cast<std::chrono::milliseconds>(end -
begin)
.count()
<< "\n";
Req::get().output();
// std::cout << timer.get_time() / 1us << " microseconds\n";
}
3 changes: 2 additions & 1 deletion flex/engines/hqps_db/core/utils/keyed.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ struct KeyedT<KeyedRowVertexSetImpl<LabelT, KEY_T, VID_T, SET_T...>,
PropertySelector<grape::EmptyType>> {
using keyed_set_t = KeyedRowVertexSetImpl<LabelT, VID_T, SET_T...>;
// // The builder type.
using keyed_builder_t = KeyedRowVertexSetBuilder<LabelT, VID_T, SET_T...>;
using keyed_builder_t =
KeyedRowVertexSetBuilder<LabelT, KEY_T, VID_T, SET_T...>;
using unkeyed_builder_t =
typename KeyedRowVertexSetImpl<LabelT, KEY_T, VID_T, SET_T...>::builder_t;
static keyed_builder_t create_keyed_builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TwoLabelVertexSetImplBuilder {
}

res_t Build() {
VLOG(10) << "Try to resize from " << bitset_.size_ << ", to "
VLOG(10) << "Try to resize from " << bitset_.cardinality() << ", to "
<< vec_.size();
bitset_.resize(vec_.size());
return res_t(std::move(vec_), std::move(data_), std::move(labels_),
Expand Down
Loading

0 comments on commit 2815630

Please sign in to comment.