diff --git a/.gitignore b/.gitignore index 03b6fd1..b3a28a5 100755 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,368 @@ -*~ -*.swp -bazel-* workspace/ + +# Created by https://www.toptal.com/developers/gitignore/api/vim,bazel,linux,macos,python,intellij+all,visualstudiocode +# Edit at https://www.toptal.com/developers/gitignore?templates=vim,bazel,linux,macos,python,intellij+all,visualstudiocode + +### Bazel ### +# gitignore template for Bazel build system +# website: https://bazel.build/ + +# Ignore all bazel-* symlinks. There is no full list since this can change +# based on the name of the directory bazel is cloned into. +/bazel-* + +# Directories for the Bazel IntelliJ plugin containing the generated +# IntelliJ project files and plugin configuration. Seperate directories are +# for the IntelliJ, Android Studio and CLion versions of the plugin. +/.ijwb/ +/.aswb/ +/.clwb/ + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Python ### +# Byte-compiled / optimized / DLL files __pycache__/ -.vscode/ -.idea/ -*.swo +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/vim,bazel,linux,macos,python,intellij+all,visualstudiocode diff --git a/WORKSPACE b/WORKSPACE index faeec9a..856b7d1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -28,6 +28,8 @@ http_archive( "https://github.com/apache/brpc/archive/0.9.7.tar.gz" ], strip_prefix = "brpc-0.9.7", + patches = ["//thirdparty/patches:01-fix_dl_sym.patch"], + patch_args = ["-p", "1"], ) # depend by brpc diff --git a/config/tn_build.yaml b/config/tn_build.yaml index 804f6a7..3637ec1 100644 --- a/config/tn_build.yaml +++ b/config/tn_build.yaml @@ -8,9 +8,10 @@ dependencies: - openmpi==4.1.3 - openssl==1.1.1t - libxcrypt==4.4.28 - - gcc==10.3.0 - - gxx==10.3.0 - - libstdcxx-devel_linux-64==10.3.0 + - sysroot_linux-64 <2.13 # for running on CentOS 6 + - gcc >=10.3.0,<11.2 # https://github.com/apache/brpc/issues/1693 fix from brpc 1.3.0 + - gxx >=10.3.0,<11.2 + - libstdcxx-devel_linux-64 >=10.3.0,<11.2,!=11.1 # 11.1 do not install libstdc++.so correctly - openjdk==8.0.382 - patch - pip diff --git a/core/utility/mpi_manager.h b/core/utility/mpi_manager.h index ab852b5..4099efe 100644 --- a/core/utility/mpi_manager.h +++ b/core/utility/mpi_manager.h @@ -17,6 +17,7 @@ #include #include +#include #include namespace tensornet { diff --git a/thirdparty/patches/01-fix_dl_sym.patch b/thirdparty/patches/01-fix_dl_sym.patch new file mode 100644 index 0000000..c472a58 --- /dev/null +++ b/thirdparty/patches/01-fix_dl_sym.patch @@ -0,0 +1,39 @@ +From ded02c195096a256752124241d3e72cf9e7cc339 Mon Sep 17 00:00:00 2001 +From: wangweibing +Date: Tue, 7 Jun 2022 14:57:45 +0800 +Subject: [PATCH] Fix _dl_sym undefined reference + +--- + src/bthread/mutex.cpp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/bthread/mutex.cpp b/src/bthread/mutex.cpp +index 441bc6c872..e044eae243 100644 +--- a/src/bthread/mutex.cpp ++++ b/src/bthread/mutex.cpp +@@ -44,7 +44,7 @@ + #include "bthread/log.h" + + extern "C" { +-extern void* _dl_sym(void* handle, const char* symbol, void* caller); ++extern void* __attribute__((weak)) _dl_sym(void* handle, const char* symbol, void* caller); + } + + namespace bthread { +@@ -408,8 +408,14 @@ static void init_sys_mutex_lock() { + #if defined(OS_LINUX) + // TODO: may need dlvsym when GLIBC has multiple versions of a same symbol. + // http://blog.fesnel.com/blog/2009/08/25/preloading-with-multiple-symbol-versions +- sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_lock", (void*)init_sys_mutex_lock); +- sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_unlock", (void*)init_sys_mutex_lock); ++ if (_dl_sym) { ++ sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_lock", (void*)init_sys_mutex_lock); ++ sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_unlock", (void*)init_sys_mutex_lock); ++ } else { ++ // _dl_sym may be undefined reference in some system, fallback to dlsym ++ sys_pthread_mutex_lock = (MutexOp)dlsym(RTLD_NEXT, "pthread_mutex_lock"); ++ sys_pthread_mutex_unlock = (MutexOp)dlsym(RTLD_NEXT, "pthread_mutex_unlock"); ++ } + #elif defined(OS_MACOSX) + // TODO: look workaround for dlsym on mac + sys_pthread_mutex_lock = (MutexOp)dlsym(RTLD_NEXT, "pthread_mutex_lock"); diff --git a/thirdparty/patches/BUILD b/thirdparty/patches/BUILD new file mode 100644 index 0000000..ac88b82 --- /dev/null +++ b/thirdparty/patches/BUILD @@ -0,0 +1 @@ +exports_files(["*.patch"])