Skip to content

Commit

Permalink
feat:support deployment on CentOS Stream 9 (#808)
Browse files Browse the repository at this point in the history
* u

* update docker file

* u

* update

* update

* update

* update

* update

* update

* support deployment

* u

* update

* update
  • Loading branch information
AntiTopQuark authored Dec 20, 2024
1 parent 09ae84c commit 071f637
Show file tree
Hide file tree
Showing 9 changed files with 520 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ set(DEPS_LOCAL_LIBRARY_DIR /usr/local/lib)

include_directories(SYSTEM ${DEPS_INCLUDE_DIR} ${DEPS_LOCAL_INCLUDE_DIR}) # just for IDE
link_directories(${DEPS_LIBRARY_DIR} ${DEPS_LIBRARY64_DIR})
if (OURSYSTEM STREQUAL "centos")
if (OURSYSTEM MATCHES "^centos")
if (OURSYSTEM STREQUAL "centos9")
add_compile_definitions(USING_CENTOS9=1)
add_definitions(-D__const__=__unused__)
message(STATUS "Compiling for OURSYSTEM=centos9: Setting __const__=__unused__")
else()
add_compile_definitions(USING_CENTOS9=0)
endif()

link_directories(${DEPS_LIBRARY64_DIR})
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
link_directories(${DEPS_LOCAL_LIBRARY_DIR})
Expand Down
357 changes: 357 additions & 0 deletions ci/images/tugraph-compile-centos-stream-9-Dockerfile

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions ci/images/tugraph-mini-runtime-centos-stream-9-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# quay.io Image
FROM quay.io/centos/centos:stream9
# Alibaba Image
# FROM reg.docker.alibaba-inc.com/fma/centos:9

RUN sed -i 's/^enabled=0/enabled=1/g' /etc/yum.repos.d/centos-addons.repo \
&& sed -i 's/^enabled=0/enabled=1/g' /etc/yum.repos.d/centos.repo

RUN dnf update -y && dnf install -y \
gcc \
openssl-devel.x86_64 \
wget \
libgfortran.x86_64 \
libgomp \
compat-openssl11

# install tugraph
# specifies the path of the object storage where the installation package resides
# example "=https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/tugraph-4.3.2"
ARG FILEPATH
# specifies installation package name for tugraph
# example "=tugraph-4.3.2-1.el8.x86_64.rpm"
ARG FILENAME

RUN wget ${FILEPATH}/${FILENAME}
RUN rpm -ivh ${FILENAME} && rm /${FILENAME}

ENV LD_LIBRARY_PATH=/usr/local/lib64/lgraph:/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH

CMD lgraph_server -d run
77 changes: 77 additions & 0 deletions ci/images/tugraph-runtime-centos-stream-9-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# quay.io Image
FROM quay.io/centos/centos:stream9
# Alibaba Image
# FROM reg.docker.alibaba-inc.com/fma/centos:9

RUN sed -i 's/^enabled=0/enabled=1/g' /etc/yum.repos.d/centos-addons.repo \
&& sed -i 's/^enabled=0/enabled=1/g' /etc/yum.repos.d/centos.repo

RUN dnf update -y && dnf install -y \
git \
gcc \
gcc-c++ \
make \
wget \
bzip2 \
unzip \
openssl-devel.x86_64 \
libgfortran.x86_64 \
libgomp \
libcurl-devel.x86_64 \
compat-openssl11 && dnf clean all

# install g++ 9.4.0
# if it is not accessible, replace it with the link below
# http://ftp.gnu.org/gnu/gcc/gcc-9.4.0/gcc-9.4.0.tar.gz
RUN wget http://ftp.gnu.org/gnu/gcc/gcc-9.4.0/gcc-9.4.0.tar.gz \
&& tar -xvf gcc-9.4.0.tar.gz && cd gcc-9.4.0 \
&& ./contrib/download_prerequisites && mkdir build && cd build \
&& ../configure CFLAGS=-fPIC CXXFLAGS=-fPIC -enable-checking=release -enable-languages=c,c++ -disable-multilib \
&& make -j4 && make install \
&& cp ./x86_64-*-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25 /usr/lib64/ \
&& cd /usr/lib64 && ln -sf libstdc++.so.6.0.25 libstdc++.so.6 \
&& rm -rf /gcc-* && ln -s /usr/local/bin/gcc /usr/local/bin/cc

# install python3
# if it is not accessible, replace it with the link below
# https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/Python-3.6.9.tgz \
&& tar xf Python-3.6.9.tgz && cd Python-3.6.9 && ./configure --prefix=/usr/local \
&& make -j4 && make install \
&& python3 -m pip install --upgrade pip -i https://pypi.antfin-inc.com/simple/ --trusted-host pypi.antfin-inc.com \
&& python3 -m pip install nest_asyncio pexpect requests pytest httpx cython==3.0.0a11 sphinx myst_parser sphinx_panels sphinx_rtd_theme numpy==1.19.5 torch==1.10.2 dgl==1.0.0 ogb pandas==0.24.2 -i https://pypi.antfin-inc.com/simple/ --trusted-host pypi.antfin-inc.com \
&& rm -rf /Python*

# install cmake
# if it is not accessible, replace it with the link below
# https://cmake.org/files/v3.25/cmake-3.25.2.tar.gz
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/cmake-3.25.2.tar.gz \
&& tar xf cmake-3.25.2.tar.gz && cd cmake-3.25.2 \
&& ./bootstrap && make -j4 && make install && rm -rf /cmake-3.*

# install boost-1.68
# if it is not accessible, replace it with the link below
# https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.gz
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/boost_1_68_0.tar.gz \
&& wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/geometry-extensions.tar.gz \
&& tar xf boost_1_68_0.tar.gz && tar xf geometry-extensions.tar.gz \
&& cd boost_1_68_0 && ./bootstrap.sh --with-libraries=system,random,thread,filesystem,chrono,atomic,date_time,regex,stacktrace,log \
&& ./b2 ${JFLAG} cxxflags="-std=c++17 -fPIC" install \
&& sed -i '513s/BOOST_MPL_ASSERT_MSG((I < 1), INVALID_INDEX,/BOOST_MPL_ASSERT_MSG((I < 1), INVALID_INDEX_,/' /usr/local/include/boost/geometry/index/detail/predicates.hpp \
&& cp -r /extensions /usr/local/include/boost/geometry/ \
&& rm -rf /boost_* /extensions /geometry-extensions.tar.gz

# install tugraph
# specifies the path of the object storage where the installation package resides
# example "=https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/tugraph-4.3.2"
ARG FILEPATH
# specifies installation package name for tugraph
# example "=tugraph-4.3.2-1.el8.x86_64.rpm"
ARG FILENAME

RUN wget ${FILEPATH}/${FILENAME} && rpm -ivh ${FILENAME} && rm -f /${FILENAME}

ENV LD_LIBRARY_PATH=/usr/local/lib64/lgraph:/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH \
PYTHONPATH=/usr/local/lib64/lgraph:/usr/local/lib64:$PYTHONPATH

CMD lgraph_server -d run
2 changes: 2 additions & 0 deletions include/fma-common/hardware_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
#include <net/if.h>
#include <unistd.h>
#include <sys/times.h>
#if !USING_CENTOS9
#include <sys/vtimes.h>
#endif
#include <limits.h>
#include <fstream>
#endif // #ifdef _WIN32 #elif __APPLE__
Expand Down
25 changes: 20 additions & 5 deletions include/lgraph/olap_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,11 @@ class OlapBase {
if (this->edge_direction_policy_ == DUAL_DIRECTION) {
auto worker = Worker::SharedWorker();
worker->Delegate([&]() {
#pragma omp parallel for default(none)
#if USING_CENTOS9
#pragma omp parallel for default(none) firstprivate(this)
#else
#pragma omp parallel for default(none)
#endif
for (size_t ei = 0; ei < this->num_edges_; ei++) {
size_t src = this->edge_list_[ei].src;
size_t dst = this->edge_list_[ei].dst;
Expand All @@ -736,8 +740,11 @@ class OlapBase {
this->in_index_[vi + 1] += this->in_index_[vi];
}
}

#pragma omp parallel for
#if USING_CENTOS9
#pragma omp parallel for firstprivate(this)
#else
#pragma omp parallel for
#endif
for (size_t ei = 0; ei < this->num_edges_; ei++) {
size_t src = this->edge_list_[ei].src;
size_t dst = this->edge_list_[ei].dst;
Expand Down Expand Up @@ -769,7 +776,11 @@ class OlapBase {
} else {
auto worker = Worker::SharedWorker();
worker->Delegate([&]() {
#pragma omp parallel for default(none)
#if USING_CENTOS9
#pragma omp parallel for default(none) firstprivate(this)
#else
#pragma omp parallel for default(none)
#endif
for (size_t ei = 0; ei < this->num_edges_; ei++) {
size_t src = this->edge_list_[ei].src;
size_t dst = this->edge_list_[ei].dst;
Expand All @@ -786,7 +797,11 @@ class OlapBase {
this->out_index_[vi + 1] += this->out_index_[vi];
}

#pragma omp parallel for
#if USING_CENTOS9
#pragma omp parallel for firstprivate(this)
#else
#pragma omp parallel for
#endif
for (size_t ei = 0; ei < this->num_edges_; ei++) {
size_t src = this->edge_list_[ei].src;
size_t dst = this->edge_list_[ei].dst;
Expand Down
13 changes: 13 additions & 0 deletions procedures/algo_cpp/ktruss_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ size_t ktruss_count_common(std::vector<AdjUnit<size_t>> &list_a,
} else if (ptr_a->neighbour > ptr_b->neighbour) {
ptr_b++;
} else {
#if USING_CENTOS9
auto edge_a = ptr_a->edge_data;
auto edge_b = ptr_b->edge_data;
write_add(&edge_a, (size_t)1);
write_add(&edge_b, (size_t)1);
#else
write_add(&ptr_a->edge_data, (size_t)1);
write_add(&ptr_b->edge_data, (size_t)1);
#endif
local_count++;
ptr_a++;
ptr_b++;
Expand Down Expand Up @@ -169,7 +176,13 @@ size_t KTrussCore(OlapBase<Empty> &graph, size_t value_k,
auto &neighbour_adj = edges[dst];
local_count = ktruss_count_common(src_adj, neighbour_adj, src, dst);
}
#if USING_CENTOS9
auto edge_data= edge.edge_data;
write_add(&edge_data, local_count);
#else
write_add(&edge.edge_data, local_count);
#endif

}
return 0;
},
Expand Down
3 changes: 3 additions & 0 deletions release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ if (OURSYSTEM STREQUAL "centos7")
elseif (OURSYSTEM STREQUAL "centos8")
set(CPACK_PACKAGE_RELEASE "1.el8")
set(CPACK_GENERATOR "RPM")
elseif (OURSYSTEM STREQUAL "centos9")
set(CPACK_PACKAGE_RELEASE "1.el9")
set(CPACK_GENERATOR "RPM")
elseif (OURSYSTEM STREQUAL "ubuntu")
set(CPACK_PACKAGE_RELEASE "1")
set(CPACK_GENERATOR "DEB")
Expand Down
10 changes: 9 additions & 1 deletion src/BuildLGraphServer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,19 @@ add_library(${TARGET_SERVER_LIB} STATIC
http/algo_task.cpp
${PROTO_SRCS})

target_compile_options(${TARGET_SERVER_LIB} PUBLIC
if (OURSYSTEM STREQUAL "centos9")
target_compile_options(${TARGET_SERVER_LIB} PUBLIC
-DGFLAGS_NS=${GFLAGS_NS}
-D__const__=__unused__
-pipe
-fPIC -fno-omit-frame-pointer)
else()
target_compile_options(${TARGET_SERVER_LIB} PUBLIC
-DGFLAGS_NS=${GFLAGS_NS}
-D__const__=
-pipe
-fPIC -fno-omit-frame-pointer)
endif()

if (NOT (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
target_link_libraries(${TARGET_SERVER_LIB}
Expand Down

0 comments on commit 071f637

Please sign in to comment.