Skip to content

Commit

Permalink
[Feature](mlu-ops):update log format use fmtlib. (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahxn0 authored Sep 25, 2024
1 parent 561ff07 commit 373537c
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 95 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project(mluops VERSION ${BUILD_VERSION})
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/test")
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wdeprecated-declarations -fPIC -std=c++11 -pthread -pipe")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Wl,--gc-sections -fPIC")

Expand Down Expand Up @@ -88,6 +90,7 @@ elseif (NOT BANG_CNCC_EXECUTABLE)
message(FATAL_ERROR "cncc not found, please ensure cncc is in your PATH env or set variable BANG_CNCC_EXECUTABLE from cmake. Otherwise you should check path used by find_program(BANG_CNCC_EXECUTABLE) in FindBANG.cmake")
endif()

find_package(fmt REQUIRED)
# setup cncc flags
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -Werror -Wdeprecated-declarations -Wall -std=c++11 -fPIC -pthread --neuware-path=${NEUWARE_HOME}")
if(${_CMAKE_BUILD_TYPE_LOWER} MATCHES "debug")
Expand Down Expand Up @@ -174,11 +177,16 @@ else()
message(FATAL_ERROR "${MLUOP_SYMBOL_VIS_FILE} doesn't exist.")
endif()


set(LINK_FLAGS "-Wl,--version-script=${CMAKE_BINARY_DIR}/${MLUOP_SYMBOL_VIS_FILE}")
message(STATUS "LINK_FLAGS:${LINK_FLAGS}")
add_library(mluopscore STATIC ${core_src_files})

target_link_libraries(mluopscore cnnl cnrt cndrv)
if (TARGET fmt::fmt-header-only)
target_link_libraries(mluopscore fmt::fmt-header-only)
endif()

bang_add_library(mluops SHARED ${src_files} ${src_helper_files})

if(${MLUOP_BUILD_STATIC} MATCHES "ON")
Expand All @@ -195,6 +203,7 @@ target_link_libraries(mluops
cnrt cndrv dl
-Wl,--end-group
)

target_link_libraries(mluops ${LINK_FLAGS})
set_target_properties(mluops PROPERTIES
OUTPUT_NAME "mluops"
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ MLU-OPS™提供了以下功能:
- 寒武纪 MLU 驱动:
- 运行时依赖驱动 v5.10.25 或更高版本
- 外部链接库:
- libxml2-dev、libprotobuf-dev、protobuf-compiler、llvm-6.0-dev、libeigen3-dev>=3.4
- libxml2-dev、libprotobuf-dev、protobuf-compiler、llvm-6.0-dev、libfmt-dev>=11.0.2、libeigen3-dev>=3.4
- Python环境:
- 依赖Python-3版本(默认版本 python 3.8.0,最低要求 python 3.6.0)

Expand Down Expand Up @@ -93,11 +93,24 @@ MLU-OPS™提供了以下功能:
make -j24 && make install

- 准备链接库环境
- apt-get安装依赖库

```sh
sudo apt-get update
sudo apt-get install protobuf-compiler libxml2-dev libprotobuf-dev llvm-6.0-dev
```
- 源码编译fmtlib
```sh
git clone --branch 11.0.2 https://github.com/fmtlib/fmt.git --depth=1
cd fmt
mkdir build && cd build
cmake ..
make -j32
make install
# 验证是否安装成功
pkg-config --modversion fmt
# 若输出 11.0.2,表示fmt安装成功
```

## 获取关于 BANG 语言基础和开发相关工具介绍的文档
可查看最新版 [开发者文档](https://developer.cambricon.com/index/document/index/classid/3.html)
Expand Down
1 change: 1 addition & 0 deletions build.property
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"driver": "6.0.3",
"eigen3": "3.4.0",
"libxml2": "2.9.0",
"fmt": "11.0.2",
"protoc": "3.9.0"},
"package_type": ["rpm","deb"]
}
Loading

0 comments on commit 373537c

Please sign in to comment.