forked from pytorch/ELF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 113aba7
Showing
190 changed files
with
32,811 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
version: 2 | ||
|
||
jobs: | ||
build_and_test_1804: | ||
resource_class: xlarge | ||
docker: | ||
- image: pytorch/elf:ci_ubuntu_1804 | ||
steps: | ||
- checkout | ||
- run: | ||
name: submodules | ||
command: | | ||
git submodule sync | ||
git submodule update --init --recursive | ||
- run: | ||
name: cpp_style | ||
command: ./codetools/check_cpp_style.sh | ||
- run: | ||
name: python_style | ||
command: ./codetools/check_py_style.sh | ||
- run: | ||
name: compile | ||
command: make clean all VERBOSE=1 | ||
- run: | ||
name: cpp_tests | ||
command: make test_cpp | ||
- run: | ||
name: python_tests | ||
command: "true" | ||
|
||
workflows: | ||
version: 2 | ||
build_and_test_1804: | ||
jobs: | ||
- build_and_test_1804 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM ubuntu:bionic | ||
|
||
WORKDIR /tmp/docker_init | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y \ | ||
clang-format \ | ||
clang-tidy \ | ||
cmake \ | ||
curl \ | ||
g++ \ | ||
gcc \ | ||
git \ | ||
libboost-all-dev \ | ||
libzmq3-dev \ | ||
; | ||
RUN ln -sf `which clang-format-6.0` /usr/bin/clang-format | ||
RUN curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh > conda_install.sh | ||
RUN bash conda_install.sh -p /conda -b | ||
ENV PATH=/conda/bin:${PATH} | ||
RUN conda update -n base conda | ||
RUN conda create -yn elf_env python=3.6 | ||
RUN source activate elf_env | ||
RUN conda install -y \ | ||
flake8 \ | ||
numpy \ | ||
pytest \ | ||
zeromq \ | ||
; | ||
RUN conda install -c conda-forge autopep8 | ||
RUN conda install -c pytorch pytorch torchvision cuda90 | ||
|
||
RUN rm -rf /tmp/docker_init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlinesLeft: true | ||
AlignOperands: false | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
ColumnLimit: 80 | ||
CommentPragmas: '^ IWYU pragma:' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ] | ||
IncludeCategories: | ||
- Regex: '^<.*\.h(pp)?>' | ||
Priority: 1 | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 3 | ||
IndentCaseLabels: true | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
ReflowComments: true | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 8 | ||
UseTab: Never | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[flake8] | ||
exclude = | ||
__init__.py | ||
__pycache__, | ||
.git, | ||
build, | ||
experimental, | ||
third_party, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Build and interpreter artifacts | ||
*.a | ||
*.bin | ||
*.dSYM | ||
*.o | ||
*.pyc | ||
*.so | ||
build/ | ||
__pycache__/ | ||
|
||
# Random junk | ||
*.sw? | ||
*.db | ||
*.json | ||
*.sgf | ||
*.swo | ||
*.tree | ||
.codemod.bookmark | ||
.nfs* | ||
tmp*.sh | ||
tags | ||
build/ | ||
save_dir*/ | ||
test-*/ | ||
Testing/ | ||
pachi-*/ | ||
experimental/patterns.prob | ||
experimental/patterns.spat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[submodule "third_party/concurrentqueue"] | ||
path = third_party/concurrentqueue | ||
url = https://github.com/cameron314/concurrentqueue.git | ||
[submodule "third_party/cppzmq"] | ||
path = third_party/cppzmq | ||
url = https://github.com/zeromq/cppzmq.git | ||
[submodule "third_party/googletest"] | ||
path = third_party/googletest | ||
url = https://github.com/google/googletest.git | ||
[submodule "third_party/json"] | ||
path = third_party/json | ||
url = https://github.com/nlohmann/json.git | ||
[submodule "third_party/pybind11"] | ||
path = third_party/pybind11 | ||
url = https://github.com/pybind/pybind11.git | ||
[submodule "third_party/spdlog"] | ||
path = third_party/spdlog | ||
url = https://github.com/gabime/spdlog.git | ||
[submodule "third_party/tbb"] | ||
path = third_party/tbb | ||
url = https://github.com/01org/tbb.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
cmake_minimum_required(VERSION 3.3) | ||
|
||
# Basic third-party dependencies | ||
|
||
find_package(Threads) | ||
|
||
#find_package(Boost REQUIRED COMPONENTS | ||
# thread | ||
#) | ||
#include_directories(${Boost_INCLUDE_DIR}) | ||
|
||
# Include third-party dependencies | ||
|
||
add_subdirectory( | ||
third_party | ||
${CMAKE_CURRENT_BINARY_DIR}/third_party) | ||
find_package(TBB REQUIRED tbb) # Need to find_package in parent scope | ||
|
||
# Sanity checks | ||
|
||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||
# require at least gcc 7.1 | ||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1) | ||
message(FATAL_ERROR "GCC version must be at least 7.1!") | ||
endif() | ||
endif() | ||
|
||
# Variables from Git | ||
|
||
execute_process(COMMAND git rev-parse HEAD | ||
OUTPUT_VARIABLE GIT_COMMIT_HASH) | ||
string(STRIP ${GIT_COMMIT_HASH} GIT_COMMIT_HASH) | ||
execute_process(COMMAND git diff-index --quiet HEAD -- | ||
RESULT_VARIABLE GIT_UNSTAGED) | ||
if(${GIT_UNSTAGED}) | ||
set(GIT_STAGED_STRING unstaged) | ||
else() | ||
set(GIT_STAGED_STRING staged) | ||
endif() | ||
|
||
# Global compiler config | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(PYBIND11_CPP_STANDARD -std=c++17) | ||
set(CMAKE_CXX_FLAGS | ||
"${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wno-register -fPIC -march=native") | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") | ||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
|
||
# Define a convenience function for tests | ||
function(add_cpp_tests prefix lib_to_link) | ||
set(test_list ${ARGV}) | ||
list(REMOVE_AT test_list 0) | ||
list(REMOVE_AT test_list 0) | ||
foreach(test_file ${test_list}) | ||
string(REPLACE "/" "_" test_name ${test_file}) | ||
string(REPLACE ".cc" "" test_name ${test_name}) | ||
string(CONCAT test_name ${prefix} ${test_name}) | ||
add_executable(${test_name} ${test_file}) | ||
add_test(${test_name} ${test_name}) | ||
target_link_libraries(${test_name} ${lib_to_link} gtest) | ||
endforeach(test_file) | ||
endfunction(add_cpp_tests) | ||
|
||
# Include everything in src_cpp | ||
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src_cpp/) | ||
|
||
# Main ELF library | ||
|
||
add_subdirectory( | ||
src_cpp/elf | ||
${CMAKE_CURRENT_BINARY_DIR}/elf) | ||
|
||
# ELF games | ||
|
||
add_subdirectory( | ||
src_cpp/elfgames/go | ||
${CMAKE_CURRENT_BINARY_DIR}/elfgames/go) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
=============== | ||
Code of Conduct | ||
=============== | ||
|
||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the `full text`__ so that you can understand what actions will and will not be tolerated. | ||
|
||
__ https://code.facebook.com/pages/876921332402685/open-source-code-of-conduct) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
=================== | ||
Contributing to ELF | ||
=================== | ||
|
||
We want to make contributing to this project as easy and transparent as possible. | ||
|
||
Dependencies | ||
============ | ||
|
||
In addition to the project dependencies, you'll need the following if you'd like to contribute code to ELF2:: | ||
|
||
sudo apt-get install clang-format clang-tidy | ||
conda install flake8 pytest | ||
conda install -c conda-forge autopep8 | ||
|
||
Pull Requests | ||
============= | ||
|
||
We actively welcome your pull requests. | ||
|
||
1. Fork the repo and create your branch from ``master``. | ||
2. If you've added code that should be tested, add tests. | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints (see the ``codetools/`` directory). | ||
6. If you haven't already, complete the Contributor License Agreement ("CLA"). | ||
|
||
We have a continuous integration system that will double-check steps 4 and 5 for you. | ||
|
||
Contributor License Agreement ("CLA") | ||
===================================== | ||
|
||
In order to accept your pull request, we need you to submit a CLA. You only need | ||
to do this once to work on any of Facebook's open source projects. | ||
|
||
Complete your CLA `here`__. | ||
|
||
__ https://code.facebook.com/cla | ||
|
||
Issues | ||
====== | ||
|
||
We use GitHub issues to track public bugs. Please ensure your description is | ||
clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
This project is still an extremely unstable prototype so we will be limited in | ||
the amount of support we're able to provide. | ||
|
||
Coding Style | ||
============ | ||
|
||
- For C++, we use a style very similar to the `HHVM style guide`__. This prescription is not formal, and our ``.clang-format`` file and existing code should eventually be a good source of truth. Due to a quirk of ``Python.h``, all ``pybind`` includes must be first in the include order. | ||
- For Python, we use pep8. | ||
|
||
__ https://github.com/facebook/hhvm/blob/master/hphp/doc/coding-conventions.md | ||
|
||
We have tools to check your C++ and Python code in the ``codetools/`` directory | ||
|
||
License | ||
======= | ||
|
||
By contributing to ELF, you agree that your contributions will be licensed | ||
under the LICENSE file in the root directory of this source tree. |
Oops, something went wrong.