From 56aac5f86ea0ec9b883559e26f1b68843c0209bf Mon Sep 17 00:00:00 2001 From: YangZhou Date: Tue, 7 Feb 2023 19:32:13 +0800 Subject: [PATCH] add codelab glog --- runtime/.clang-format | 29 + runtime/engine/codelab/glog/CMakeLists.txt | 8 + runtime/engine/codelab/glog/README.md | 38 + .../codelab/glog/glog_logtostderr_main.cc | 25 + runtime/engine/codelab/glog/glog_main.cc | 23 + runtime/examples/text_lm/local/data/chars.dic | 12638 ++ runtime/examples/text_lm/local/data/words.dic | 123691 +++++++++++++++ 7 files changed, 136452 insertions(+) create mode 100644 runtime/.clang-format create mode 100644 runtime/engine/codelab/glog/CMakeLists.txt create mode 100644 runtime/engine/codelab/glog/README.md create mode 100644 runtime/engine/codelab/glog/glog_logtostderr_main.cc create mode 100644 runtime/engine/codelab/glog/glog_main.cc create mode 100644 runtime/examples/text_lm/local/data/chars.dic create mode 100644 runtime/examples/text_lm/local/data/words.dic diff --git a/runtime/.clang-format b/runtime/.clang-format new file mode 100644 index 000000000..af946a4a9 --- /dev/null +++ b/runtime/.clang-format @@ -0,0 +1,29 @@ +# This file is used by clang-format to autoformat paddle source code +# +# The clang-format is part of llvm toolchain. +# It need to install llvm and clang to format source code style. +# +# The basic usage is, +# clang-format -i -style=file PATH/TO/SOURCE/CODE +# +# The -style=file implicit use ".clang-format" file located in one of +# parent directory. +# The -i means inplace change. +# +# The document of clang-format is +# http://clang.llvm.org/docs/ClangFormat.html +# http://clang.llvm.org/docs/ClangFormatStyleOptions.html +--- +Language: Cpp +BasedOnStyle: Google +IndentWidth: 4 +TabWidth: 4 +ContinuationIndentWidth: 4 +MaxEmptyLinesToKeep: 2 +AccessModifierOffset: -2 # The private/protected/public has no indent in class +Standard: Cpp11 +AllowAllParametersOfDeclarationOnNextLine: true +BinPackParameters: false +BinPackArguments: false +... + diff --git a/runtime/engine/codelab/glog/CMakeLists.txt b/runtime/engine/codelab/glog/CMakeLists.txt new file mode 100644 index 000000000..08a98641f --- /dev/null +++ b/runtime/engine/codelab/glog/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.14 FATAL_ERROR) + +add_executable(glog_main ${CMAKE_CURRENT_SOURCE_DIR}/glog_main.cc) +target_link_libraries(glog_main glog) + + +add_executable(glog_logtostderr_main ${CMAKE_CURRENT_SOURCE_DIR}/glog_logtostderr_main.cc) +target_link_libraries(glog_logtostderr_main glog) diff --git a/runtime/engine/codelab/glog/README.md b/runtime/engine/codelab/glog/README.md new file mode 100644 index 000000000..3282c920d --- /dev/null +++ b/runtime/engine/codelab/glog/README.md @@ -0,0 +1,38 @@ +# [GLOG](https://rpg.ifi.uzh.ch/docs/glog.html) + +Unless otherwise specified, glog writes to the filename `/tmp/...log...