-
Notifications
You must be signed in to change notification settings - Fork 449
/
Makefile
189 lines (151 loc) · 6.81 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
WORKING_DIR := $(dir $(MKFILE_PATH))
ANALYTICAL_DIR := $(WORKING_DIR)/analytical_engine
INTERACTIVE_DIR := $(WORKING_DIR)/interactive_engine
LEARNING_DIR := $(WORKING_DIR)/learning_engine/graph-learn
ANALYTICAL_BUILD_DIR := $(ANALYTICAL_DIR)/build
LEARNING_BUILD_DIR := $(LEARNING_DIR)/graphlearn/cmake-build
CLIENT_DIR := $(WORKING_DIR)/python
COORDINATOR_DIR := $(WORKING_DIR)/coordinator
K8S_DIR := $(WORKING_DIR)/k8s
DOCS_DIR := $(WORKING_DIR)/docs
BUILD_TYPE ?= release
# analytical engine build options
NETWORKX ?= ON
# testing build option
BUILD_TEST ?= OFF
# whether to build graphlearn-torch extension (graphlearn is built by default)
WITH_GLTORCH ?= ON
# INSTALL_PREFIX is environment variable, but if it is not set, then set default value
ifeq ($(INSTALL_PREFIX),)
INSTALL_PREFIX := /opt/graphscope
endif
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
NUMPROC := $(shell grep -c ^processor /proc/cpuinfo)
SUFFIX := so
endif
ifeq ($(UNAME),Darwin)
NUMPROC := $(shell sysctl -n hw.ncpu)
SUFFIX := dylib
endif
# x86_64 or aarch64
ARCH := $(shell uname -m)
VERSION := $(shell cat $(WORKING_DIR)/VERSION)
# pip installation arguments
PIP_ARGS = --timeout=1000 --no-cache-dir
## Common
.PHONY: all graphscope install clean
# coordinator relies on client, which relies on learning
all: coordinator analytical interactive gsctl
graphscope: all
install: analytical-install interactive-install learning-install coordinator
echo "Run the following command to correctly set environment variable"
echo "export GRAPHSCOPE_HOME=$(INSTALL_PREFIX)"
clean:
rm -rf $(ANALYTICAL_BUILD_DIR) $(ANALYTICAL_DIR)/proto
cd $(ANALYTICAL_DIR)/java && mvn clean
cd $(INTERACTIVE_DIR) && mvn clean || true
# TODO: use maven clean to clean ir target
rm -rf $(INTERACTIVE_DIR)/executor/assembly/v6d/target
rm -rf $(INTERACTIVE_DIR)/executor/assembly/groot/target
rm -rf $(INTERACTIVE_DIR)/executor/ir/target
rm -rf $(LEARNING_BUILD_DIR) $(LEARNING_DIR)/proto/*.h $(LEARNING_DIR)/proto/*.cc
rm -rf $(LEARNING_DIR)/graphlearn/built
cd $(CLIENT_DIR) && python3 setup.py clean --all
cd $(COORDINATOR_DIR) && python3 setup.py clean --all
## Modules
.PHONY: client coordinator analytical interactive learning gsctl
.PHONY: analytical-java
gsctl:
cd $(CLIENT_DIR) && \
python3 ./setup_gsctl.py develop --user
client: learning
cd $(CLIENT_DIR) && \
python3 -m pip install ${PIP_ARGS} "torch<=2.2.1" "networkx<=3.0" --index-url https://download.pytorch.org/whl/cpu --user && \
python3 -m pip install ${PIP_ARGS} -r requirements.txt -r requirements-dev.txt --user && \
export PATH=$(PATH):$(HOME)/.local/bin && \
python3 setup.py build_ext --inplace --user && \
if [ $(WITH_GLTORCH) = ON ]; then \
python3 setup.py build_gltorch_ext --inplace --user; \
fi && \
python3 -m pip install --user --no-build-isolation --editable $(CLIENT_DIR) && \
rm -rf $(CLIENT_DIR)/*.egg-info
coordinator: client
cd $(COORDINATOR_DIR) && \
python3 -m pip install ${PIP_ARGS} "torch<=2.2.1" "networkx<=3.0" --index-url https://download.pytorch.org/whl/cpu --user && \
python3 -m pip install ${PIP_ARGS} -r requirements.txt -r requirements-dev.txt --user && \
python3 setup.py build_builtin && \
python3 -m pip install --user --editable $(COORDINATOR_DIR) && \
rm -rf $(COORDINATOR_DIR)/*.egg-info
# We deliberately make $(ENGINE) depends on a file, and $(ENGINE)-install depends on $(ENGINE),
# so that when we execute `make $(ENGINE)-install` after `make $(ENGINE)`, it will not
# rebuild $(ENGINE) from scratch.
# If we doesn't make gxe depends on a file (as a PHONY), then make will never
# know if $(ENGINE) is up-to-date or not, so it will always rebuild gxe.
# Note: `$(ENGINE)` stands for `analytical`, `interactive` and `learning`.
.PHONY: analytical-install interactive-install learning-install
.PHONY: analytical-java-install
analytical-install: analytical
$(MAKE) -C $(ANALYTICAL_BUILD_DIR) install
install -d $(INSTALL_PREFIX)/lib/cmake/graphscope-analytical/cmake
if [ -d "${INSTALL_PREFIX}/lib64/cmake/graphscope-analytical" ]; then \
install $(INSTALL_PREFIX)/lib64/cmake/graphscope-analytical/*.cmake $(INSTALL_PREFIX)/lib/cmake/graphscope-analytical; \
install $(INSTALL_PREFIX)/lib64/cmake/graphscope-analytical/cmake/* $(INSTALL_PREFIX)/lib/cmake/graphscope-analytical/cmake; \
fi
analytical: $(ANALYTICAL_BUILD_DIR)/grape_engine
$(ANALYTICAL_BUILD_DIR)/grape_engine:
mkdir -p $(ANALYTICAL_BUILD_DIR) && \
cd $(ANALYTICAL_BUILD_DIR) && \
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) \
-DNETWORKX=$(NETWORKX) \
-DBUILD_TESTS=${BUILD_TEST} \
-DENABLE_JAVA_SDK=OFF .. && \
$(MAKE) -j$(NUMPROC)
analytical-java-install: analytical-java
$(MAKE) -C $(ANALYTICAL_BUILD_DIR) install
install -d $(INSTALL_PREFIX)/lib/cmake/graphscope-analytical/cmake
if [ -d "${INSTALL_PREFIX}/lib64/cmake/graphscope-analytical" ]; then \
install $(INSTALL_PREFIX)/lib64/cmake/graphscope-analytical/*.cmake $(INSTALL_PREFIX)/lib/cmake/graphscope-analytical; \
install $(INSTALL_PREFIX)/lib64/cmake/graphscope-analytical/cmake/* $(INSTALL_PREFIX)/lib/cmake/graphscope-analytical/cmake; \
fi
analytical-java: $(ANALYTICAL_BUILD_DIR)/graphx_runner
$(ANALYTICAL_BUILD_DIR)/graphx_runner:
mkdir -p $(ANALYTICAL_BUILD_DIR) && \
cd $(ANALYTICAL_BUILD_DIR) && \
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) \
-DNETWORKX=$(NETWORKX) \
-DBUILD_TESTS=${BUILD_TEST} \
-DENABLE_JAVA_SDK=ON .. && \
$(MAKE) -j$(NUMPROC)
interactive-install: interactive
mkdir -p $(INSTALL_PREFIX)
tar -xf $(INTERACTIVE_DIR)/assembly/target/graphscope.tar.gz --strip-components 1 -C $(INSTALL_PREFIX)
interactive: $(INTERACTIVE_DIR)/assembly/target/graphscope.tar.gz
$(INTERACTIVE_DIR)/assembly/target/graphscope.tar.gz:
cd $(INTERACTIVE_DIR) && \
mvn --version && \
mvn package -DskipTests -Drust.compile.mode=$(BUILD_TYPE) -P graphscope -Drevision=$(VERSION) --quiet
learning-install: learning
mkdir -p $(INSTALL_PREFIX)
$(MAKE) -C $(LEARNING_BUILD_DIR) install
learning: $(LEARNING_DIR)/graphlearn/built/lib/libgraphlearn_shared.$(SUFFIX)
$(LEARNING_DIR)/graphlearn/built/lib/libgraphlearn_shared.$(SUFFIX):
(git submodule update --init || true)
cd $(LEARNING_DIR) && (git submodule update --init third_party/pybind11 || true)
mkdir -p $(LEARNING_BUILD_DIR)
cd $(LEARNING_BUILD_DIR) && \
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) \
-DKNN=OFF \
-DWITH_VINEYARD=ON \
-DTESTING=${BUILD_TEST} .. && \
$(MAKE) -j$(NUMPROC)
.PHONY: prepare-client graphscope-docs
prepare-client:
cd $(CLIENT_DIR) && \
pip3 install ${PIP_ARGS} "torch<=2.2.1" "networkx<=3.0" --index-url https://download.pytorch.org/whl/cpu --user && \
pip3 install ${PIP_ARGS} -r requirements.txt --user && \
pip3 install ${PIP_ARGS} -r requirements-dev.txt --user && \
python3 setup.py build_proto
graphscope-docs: prepare-client
$(MAKE) -C $(DOCS_DIR)/ html