Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Introduce grin apis #1191

Open
wants to merge 85 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
baa166f
draft commit of grin apis
andydiwenzhu Feb 10, 2023
926b662
pre implement arrow fragment by grin apis
andydiwenzhu Feb 13, 2023
d789df9
fix nbr, adjlist, project & dests
andydiwenzhu Feb 13, 2023
22b938e
macro format
andydiwenzhu Feb 14, 2023
a526c0d
reorg iterator logic & partition logic & property row logic
andydiwenzhu Feb 15, 2023
88cc56a
grin api implementations
andydiwenzhu Feb 20, 2023
e90d1d8
some fixes
andydiwenzhu Feb 21, 2023
812bafa
add doxygen comments
andydiwenzhu Feb 24, 2023
f2bf332
refine grin *.cc
andydiwenzhu Feb 26, 2023
8ee63d8
compile ok
andydiwenzhu Feb 27, 2023
fd890eb
update docs
andydiwenzhu Mar 1, 2023
b6f3a1d
a mixed example and updated docs
andydiwenzhu Mar 2, 2023
ee9f86c
refactor macro/type/func names
andydiwenzhu Mar 3, 2023
9ab9bb3
format func parameters & add vertex ordering predicate
andydiwenzhu Mar 6, 2023
caf908c
update macros and docs
andydiwenzhu Mar 9, 2023
62d008a
update docs
andydiwenzhu Mar 10, 2023
5d58284
refactor array-style access & vertex ordering
andydiwenzhu Mar 15, 2023
faabc0c
quick fix
andydiwenzhu Mar 15, 2023
c022184
reorg
andydiwenzhu Mar 16, 2023
aa267a2
use grin headers as submodule
andydiwenzhu Mar 16, 2023
0c6d17a
update docs
andydiwenzhu Mar 17, 2023
5de8334
add iterators
andydiwenzhu Mar 17, 2023
0268287
remove pointers in _T structs
andydiwenzhu Mar 20, 2023
b16338a
refine partition impl
andydiwenzhu Mar 20, 2023
9ba798a
refine partition & update headers
andydiwenzhu Mar 21, 2023
b8f21e1
debug grin_test
andydiwenzhu Mar 21, 2023
3d848a7
hot fix grin header
andydiwenzhu Mar 21, 2023
d3082d6
fix list filter return new value
andydiwenzhu Mar 21, 2023
90cc495
build libvineyard_grin lib
andydiwenzhu Mar 21, 2023
161b5c7
fix get edge from adjacentlist
andydiwenzhu Mar 22, 2023
0c275e5
implement vertex/edge total num (by type) methods
andydiwenzhu Mar 24, 2023
722725b
implement iodests in grin fragment
andydiwenzhu Mar 24, 2023
5323302
update docs
andydiwenzhu Mar 24, 2023
b241677
implement destroys
andydiwenzhu Mar 28, 2023
165ffaa
rename & update impl
andydiwenzhu Mar 28, 2023
b0c0fef
fix get properties by name
andydiwenzhu Mar 28, 2023
799109d
fix for destroy value and name
andydiwenzhu Mar 29, 2023
b924bef
add destroy partitioned graph handler impl
andydiwenzhu Mar 29, 2023
5560acf
add get graph from storage
andydiwenzhu Mar 29, 2023
102ec98
refine get value from property table
andydiwenzhu Mar 29, 2023
a17798a
refine type cast
andydiwenzhu Mar 30, 2023
86d8b37
remove limits.h
andydiwenzhu Mar 31, 2023
1716bba
add rust gen and reorg predefine.h
andydiwenzhu Mar 31, 2023
6cff974
refine rust codegen
andydiwenzhu Apr 12, 2023
aa1d053
refine doc after removing local complete
andydiwenzhu Apr 12, 2023
7cc4086
update storage feature protobuf impl
andydiwenzhu Apr 13, 2023
305a1d8
impl vertex primary key & gie schema converter
andydiwenzhu Apr 17, 2023
4d8ff04
update gie schema proto in grin
andydiwenzhu Apr 18, 2023
9fba8d1
rename trait in storage feature proto to feature to distinguish trait…
andydiwenzhu Apr 18, 2023
11324ec
make sure grin.so has C interface
andydiwenzhu Apr 21, 2023
080d662
fix for c tests
andydiwenzhu Apr 24, 2023
e1b21be
revert submodule reorg
andydiwenzhu Apr 24, 2023
43068ed
fix for test
andydiwenzhu May 4, 2023
ddc9e0d
expand value APIs and remove datatype.h impls
andydiwenzhu May 7, 2023
6088c02
impl fast_vertex_ref trait
andydiwenzhu May 8, 2023
b8c41d7
imsync datatype with schema
andydiwenzhu May 8, 2023
05c270f
change some handlers into integers for better performance
andydiwenzhu May 8, 2023
6dfe5b9
add fast vertex ref to message
andydiwenzhu May 8, 2023
ac480ce
impl error code
andydiwenzhu May 8, 2023
29b6e7f
quick fix insert string to row
andydiwenzhu May 9, 2023
d964311
add error_code to rust codegen
andydiwenzhu May 9, 2023
6f80b2d
null value in rust codegen and errorcode update
andydiwenzhu May 9, 2023
bdee5bd
grin api rename
andydiwenzhu May 10, 2023
823689c
add protoc to cmake
andydiwenzhu May 10, 2023
d46d4d7
remove total num impls
andydiwenzhu May 10, 2023
c58e8c7
fix original id impl
andydiwenzhu May 12, 2023
86cba7c
fix shared ptr copy problem in Graph_T
andydiwenzhu May 12, 2023
18b4abd
impl for value/original_id update
andydiwenzhu May 14, 2023
9581461
fix grin include
andydiwenzhu May 15, 2023
97d7435
small fixes
andydiwenzhu May 15, 2023
e5d179b
fix some adjlist bug
andydiwenzhu May 16, 2023
3c6c180
fix adjacent list bug
andydiwenzhu May 16, 2023
3c0367c
fix adjacent bug
andydiwenzhu May 16, 2023
7dd3cf5
change vertex handler from void* to int64
andydiwenzhu May 17, 2023
da59a45
grin graph cache optimize
andydiwenzhu May 18, 2023
301a923
update codegen rs
andydiwenzhu May 19, 2023
9148ed7
is_simple in adjlist
andydiwenzhu May 19, 2023
d3a44f4
optimize vertexlist and adjlist impl
andydiwenzhu May 21, 2023
5582d1b
update v6d impl for removing table from property
andydiwenzhu May 22, 2023
6fd6086
fix for remove column macros
andydiwenzhu May 22, 2023
3c6b783
fix get string bug
andydiwenzhu May 23, 2023
cd3ce9f
remove used code in arrow fragment group
andydiwenzhu May 23, 2023
c5e5b3a
fix simple vertex/adj list init bugs
andydiwenzhu May 23, 2023
a04fc92
optimize if branch using likely
andydiwenzhu May 24, 2023
e35a263
remove const value ptr support in v6d for inefficiency
andydiwenzhu May 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "Vineyard",
// 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",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/common-utils:2":{
"installZsh": "true",
"configureZshAsDefaultShell": "true",
"installOhMyZsh": true,
"upgradePackages": "false"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {},
"extensions": [
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens"
]
}
},

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "root"

// Uncomment this to enable C++ and Rust debugging in containers
// "capAdd": ["SYS_PTRACE"],
// "securityOpt": ["seccomp=unconfined"],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [3000],

// Use 'portsAttributes' to set default properties for specific forwarded ports.
// More info: https://containers.dev/implementors/json_reference/#port-attributes
// "portsAttributes": {
// "9000": {
// "label": "Hello Remote World",
// "onAutoForward": "notify"
// }
// },

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install"

// Improve performance

// Uncomment these to mount a folder to a volume
// https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume
// "mounts": [
// "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
// ],
// "postCreateCommand": "sudo chown graphscope node_modules"


// Uncomment these to use a named volume for your entire source tree
// https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-named-volume-for-your-entire-source-tree
// "workspaceMount": "source=gs,target=/workspace,type=volume",
// "workspaceFolder": "/workspace"
// "postCreateCommand": "sudo chown -R graphscope:graphscope /workspace"
}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@
path = modules/graph/thirdparty/libgrape-lite
url = https://github.com/alibaba/libgrape-lite.git
shallow = true
[submodule "modules/graph/grin/include"]
path = modules/graph/grin/include
url = https://github.com/GraphScope/GRIN.git
56 changes: 56 additions & 0 deletions modules/basic/ds/arrow_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,62 @@
}
}

const void* get_arrow_array_data_element(std::shared_ptr<arrow::Array> const& array, unsigned offset) {
if (array->type()->Equals(arrow::int8())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Int8Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::uint8())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::UInt8Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::int16())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Int16Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::uint16())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::UInt16Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::int32())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Int32Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::uint32())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::UInt32Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::int64())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Int64Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::uint64())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::UInt64Array>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::float32())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::FloatArray>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::float64())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::DoubleArray>(array)->raw_values() + offset);
} else if (array->type()->Equals(arrow::utf8())) {
return reinterpret_cast<const void*>(new std::string(
std::dynamic_pointer_cast<arrow::StringArray>(array).get()->GetView(offset)));
} else if (array->type()->Equals(arrow::large_utf8())) {
return reinterpret_cast<const void*>(new std::string(
std::dynamic_pointer_cast<arrow::LargeStringArray>(array).get()->GetView(offset)));
} else if (array->type()->id() == arrow::Type::LIST) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::ListArray>(array).get() + offset);
} else if (array->type()->id() == arrow::Type::LARGE_LIST) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::LargeListArray>(array).get() + offset);
} else if (array->type()->id() == arrow::Type::FIXED_SIZE_LIST) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::FixedSizeListArray>(array).get() + offset);
} else if (array->type()->Equals(arrow::null())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::NullArray>(array).get() + offset);
} else {
LOG(ERROR) << "Unsupported arrow array type '" << array->type()->ToString()
<< "', type id: " << array->type()->id();
return NULL;
}
}

Check notice on line 801 in modules/basic/ds/arrow_utils.cc

View check run for this annotation

codefactor.io / CodeFactor

modules/basic/ds/arrow_utils.cc#L746-L801

Complex Method
Status TypeLoosen(const std::vector<std::shared_ptr<arrow::Schema>>& schemas,
std::shared_ptr<arrow::Schema>& schema) {
int field_num = -1;
Expand Down
2 changes: 2 additions & 0 deletions modules/basic/ds/arrow_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ std::string type_name_from_arrow_type(

const void* get_arrow_array_data(std::shared_ptr<arrow::Array> const& array);

const void* get_arrow_array_data_element(std::shared_ptr<arrow::Array> const& array, unsigned offset);

Status TypeLoosen(const std::vector<std::shared_ptr<arrow::Schema>>& schemas,
std::shared_ptr<arrow::Schema>& schema);

Expand Down
43 changes: 43 additions & 0 deletions modules/graph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ file(GLOB_RECURSE VINEYARD_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}"
"*.h")

find_package(MPI REQUIRED)
find_package(libgrapelite REQUIRED)

find_package(Protobuf REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/grin/include/proto/graph.proto)


if(VINEYARD_MOD_SRCS)
vineyard_generate(
Expand Down Expand Up @@ -48,6 +55,8 @@ file(GLOB_RECURSE GRAPH_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}" "fragment/*.cc"
"writer/*.cc"
)

message(${GRAPH_SRC_FILES})

add_library(vineyard_graph ${GRAPH_SRC_FILES})
target_add_debuginfo(vineyard_graph)
target_compile_options(vineyard_graph PUBLIC "-fopenmp")
Expand Down Expand Up @@ -148,6 +157,7 @@ add_dependencies(vineyard_tests vineyard_graph_tests)
if(BUILD_VINEYARD_TESTS)
enable_testing()
file(GLOB TEST_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/test" "${CMAKE_CURRENT_SOURCE_DIR}/test/*.cc")
list(REMOVE_ITEM TEST_FILES "grin_test.cc")
foreach(f ${TEST_FILES})
string(REGEX MATCH "^(.*)\\.[^.]*$" dummy ${f})
set(T_NAME ${CMAKE_MATCH_1})
Expand All @@ -168,3 +178,36 @@ if(BUILD_VINEYARD_TESTS)
add_dependencies(vineyard_graph_tests ${T_NAME})
endforeach()
endif()

# grin lib
file(GLOB_RECURSE GRIN_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}" "grin/*.cc")
add_library(vineyard_grin ${GRIN_SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(vineyard_grin PRIVATE vineyard_graph ${Protobuf_LIBRARIES})
install_vineyard_target(vineyard_grin)


# grin test
if(BUILD_VINEYARD_TESTS)
enable_testing()
file(GLOB TEST_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/test" "${CMAKE_CURRENT_SOURCE_DIR}/test/grin_*.cc")
foreach(f ${TEST_FILES})
string(REGEX MATCH "^(.*)\\.[^.]*$" dummy ${f})
set(T_NAME ${CMAKE_MATCH_1})
message(STATUS "Found unit_test - " ${T_NAME})
if(BUILD_VINEYARD_TESTS_ALL)
add_executable(${T_NAME} test/${T_NAME}.cc)
else()
add_executable(${T_NAME} EXCLUDE_FROM_ALL test/${T_NAME}.cc)
endif()
target_link_libraries(${T_NAME} PRIVATE
vineyard_graph
vineyard_grin
${Protobuf_LIBRARIES}
${ARROW_SHARED_LIB}
${MPI_CXX_LIBRARIES})
if(${LIBUNWIND_FOUND})
target_link_libraries(${T_NAME} PRIVATE ${LIBUNWIND_LIBRARIES})
endif()
add_test(${T_NAME}, ${T_NAME})
endforeach()
endif()
Loading
Loading