Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 5d04a10

Browse files
committed
DML release v0.1.4-beta
1 parent 5120785 commit 5d04a10

File tree

110 files changed

+14418
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+14418
-199
lines changed

CMakeLists.txt

+66-104
Original file line numberDiff line numberDiff line change
@@ -14,143 +14,105 @@
1414
#
1515

1616
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
17-
project(dml VERSION 0.1.3 LANGUAGES C CXX)
17+
project(Dml VERSION 0.1.4 LANGUAGES C CXX)
1818

19-
set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
19+
set(PROJECT_SOVERSION 0)
2020

2121
option(DML_HW "Build hardware path or not" OFF)
22-
# TODO: See todo below
23-
option(DML_RECORD_SWITCHES "Enables -frecord-gcc-switches flag" OFF)
22+
option(DML_SUPPRESS_WARNINGS "Suppress all compiler warnings" OFF)
23+
24+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
25+
option(DML_RECORD_SWITCHES "Enables -frecord-gcc-switches flag" OFF)
26+
else()
27+
set(DML_RECORD_SWITCHES OFF CACHE BOOL "Disable recording of switches for non-gnu compiler" FORCE)
28+
endif()
29+
30+
# TODO: Remove all options below
2431
option(LIB_ACCEL_3_2 "Use libaccel-3.2" OFF)
32+
option(SANITIZE_MEMORY "Enables memory sanitizing" OFF)
33+
option(SANITIZE_THREADS "Enables threads sanitizing" OFF)
2534
option(LOG_HW_INIT "Enables HW initialization log" OFF)
2635
option(EFFICIENT_WAIT "Enables usage of umonitor/umwait" OFF)
2736

28-
include(cmake/CompileOptions.cmake)
29-
include(cmake/git_revision.cmake)
30-
include(GenerateExportHeader)
31-
include(CMakePackageConfigHelpers)
37+
if (SANITIZE_MEMORY)
38+
message(STATUS "Memory sanitizing build is enabled")
3239

33-
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
34-
message(STATUS "CMAKE_BUILD_TYPE is unset, defaulting to Release")
35-
set(CMAKE_BUILD_TYPE "Release")
40+
if (WIN32)
41+
message(FATAL_ERROR "Memory sanitizing is not supported in Windows")
42+
else ()
43+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=leak -g")
44+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=leak -g")
45+
endif ()
3646
endif ()
3747

38-
if (MSVC)
39-
add_compile_options(
40-
# Security
41-
/GS
48+
if (SANITIZE_THREADS)
49+
message(STATUS "Threads sanitizing build is enabled")
4250

43-
# Quality
44-
# /WX
45-
# TODO: There are several warning to consider, also MSVC warning level can be set only via CMAKE_CXX_FLAGS
46-
# /Wall
47-
)
48-
else()
49-
add_compile_options(
50-
# Security
51-
-fPIC
52-
-Werror
53-
-fstack-protector
54-
--param=ssp-buffer-size=8
55-
-Wl,-z,relro,-z,now
56-
-Wl,-z,noexecstack
57-
-fstack-clash-protection
58-
# -frecord-gcc-switches TODO: seems unnecessary
59-
60-
# Quality
61-
# TODO: I can't fix all of them in one go (>100)
62-
# -Werror -Wall -Wextra -pedantic
63-
)
64-
65-
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
66-
add_compile_definitions(_FORTIFY_SOURCE=2)
67-
endif ()
68-
69-
# TODO: They were already included into SDL options, why do we have the choice?
70-
if (DML_RECORD_SWITCHES)
71-
add_compile_options(-frecord-gcc-switches)
51+
if (WIN32)
52+
message(FATAL_ERROR "Threads sanitizing is not supported in Windows")
53+
else ()
54+
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
55+
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
56+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -g")
57+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -g")
7258
endif ()
73-
endif()
59+
endif ()
7460

75-
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
61+
include(cmake/CompileOptions.cmake)
62+
include(cmake/utils.cmake)
63+
include(CMakePackageConfigHelpers)
64+
include(GNUInstallDirs)
7665

77-
# Finding Intel DML library sources
78-
file(GLOB DML_C_SRC sources/*.c)
66+
if (NOT CMAKE_BUILD_TYPE)
67+
message(STATUS "CMAKE_BUILD_TYPE is unset, defaulting to Release")
68+
set(CMAKE_BUILD_TYPE Release)
69+
endif ()
7970

80-
# Adding Intel DML reference library target
81-
add_library(dml ${DML_C_SRC} $<TARGET_OBJECTS:dml_core>
82-
$<TARGET_OBJECTS:sw_path>
83-
$<$<BOOL:$<TARGET_PROPERTY:ENABLE_HW_PATH>>:$<TARGET_OBJECTS:hw_path>>)
71+
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
72+
include(cmake/msvc.cmake)
73+
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
74+
include(cmake/gnu.cmake)
75+
else ()
76+
message(FATAL_ERROR "Unknown compiler ID: ${CMAKE_C_COMPILER_ID}")
77+
endif ()
8478

85-
target_link_libraries(dml ${CMAKE_DL_LIBS})
79+
# Project-wide settings
80+
add_compile_options(
81+
${DML_SECURITY_OPTIONS}
82+
$<$<BOOL:${DML_RECORD_SWITCHES}>:-frecord-gcc-switches>)
83+
add_compile_definitions(${DML_SECURITY_DEFINITIONS})
8684

87-
# Setting external and internal interfaces for DML reference library
88-
target_include_directories(dml
89-
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include/dml>
90-
PRIVATE $<TARGET_PROPERTY:dml_core,INTERFACE_INCLUDE_DIRECTORIES>
91-
PRIVATE $<$<BOOL:$<TARGET_PROPERTY:ENABLE_HW_PATH>>:$<TARGET_PROPERTY:hw_path,INTERFACE_INCLUDE_DIRECTORIES>>
92-
PRIVATE sources/include)
85+
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
9386

87+
# TODO: Remove when option is removed
9488
if (DML_HW)
9589
message(STATUS "HW path: ON")
9690
endif()
9791

98-
target_compile_features(dml PRIVATE c_std_11)
99-
100-
set_target_properties(dml PROPERTIES ENABLE_HW_PATH ${DML_HW})
101-
102-
target_compile_definitions(dml PUBLIC DML
103-
PRIVATE DML_BADARG_CHECK
104-
PRIVATE $<$<BOOL:$<TARGET_PROPERTY:ENABLE_HW_PATH>>: DML_HW>)
105-
92+
# TODO: Remove
10693
get_git_revision()
10794

108-
# Internal libraries
10995
add_subdirectory(sources)
110-
add_subdirectory(middle-layer)
111-
add_subdirectory(high-level-api)
112-
113-
# Testing
11496
add_subdirectory(examples)
11597

116-
# Configuration files
117-
generate_export_header(dml)
118-
11998
# Install rules
120-
install(TARGETS dml dml_ml dml_common dmlhl
121-
EXPORT DmlConfig
122-
ARCHIVE DESTINATION lib
123-
INCLUDES DESTINATION include)
124-
125-
export(TARGETS dml dml_ml dml_common dmlhl
126-
NAMESPACE Dml::
127-
FILE "${CMAKE_CURRENT_BINARY_DIR}/DmlConfig.cmake")
128-
129-
install(EXPORT DmlConfig
99+
install(EXPORT ${PROJECT_NAME}Targets
130100
NAMESPACE Dml::
131-
DESTINATION ${CMAKE_INSTALL_PREFIX}/dml/cmake)
101+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
102+
103+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
104+
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
132105

133106
write_basic_package_version_file(
134-
"${PROJECT_BINARY_DIR}/DmlConfigVersion.cmake"
107+
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
135108
VERSION ${PROJECT_VERSION}
136109
COMPATIBILITY AnyNewerVersion
137110
)
138111

139-
install(FILES "${PROJECT_BINARY_DIR}/DmlConfigVersion.cmake"
140-
DESTINATION ${CMAKE_INSTALL_PREFIX}/dml/cmake)
141-
142-
install(DIRECTORY include
143-
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/dml
144-
FILES_MATCHING PATTERN *.h)
145-
146-
install(DIRECTORY high-level-api/include/dml
147-
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/
148-
FILES_MATCHING PATTERN *.hpp)
149-
150-
install(DIRECTORY middle-layer/common/include/dml_common
151-
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/
152-
FILES_MATCHING PATTERN *.hpp)
112+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
113+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
114+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
153115

154-
install(DIRECTORY middle-layer/include/dml_ml
155-
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/
156-
FILES_MATCHING PATTERN *.hpp)
116+
install(DIRECTORY include/
117+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
118+
FILES_MATCHING PATTERN *.h PATTERN *.hpp)

Doxyfile

+4-11
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ PROJECT_NAME = "Intel DML Library"
5353
# could be handy for archiving the generated documentation or if some version
5454
# control system is used.
5555

56-
PROJECT_NUMBER = "v0.1.3-beta"
56+
PROJECT_NUMBER = "v0.1.4-beta"
5757

5858
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5959
# for a project that appears at the top of each page and should give viewer a
@@ -831,10 +831,7 @@ WARN_LOGFILE =
831831
# Note: If this tag is empty the current directory is searched.
832832

833833
INPUT = examples \
834-
tests \
835834
sources \
836-
high-level-api \
837-
middle-layer \
838835
README.md \
839836
include \
840837
doc/LOW_LEVEL_API_GUIDE.md \
@@ -925,13 +922,9 @@ RECURSIVE = YES
925922
# Note that relative paths are relative to the directory from which doxygen is
926923
# run.
927924

928-
EXCLUDE = tests/common/t_align_allocator.cxx \
929-
sources/hw-path/include/libaccel_config.h \
930-
middle-layer/dispatcher/ \
931-
high-level-api/tests \
932-
tests/benchmarks/job_api/sources/job_api_launcher.cpp \
933-
tests/benchmarks/yaml-cpp \
934-
tests/job_api_tests/ta_mem_move.cpp
925+
EXCLUDE = sources/hw-path/include/libaccel_config.h \
926+
include/dml/cpp/middle_layer/\
927+
sources/middle_layer/
935928

936929
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
937930
# directories that are symbolic links (a Unix file system feature) are excluded

README.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ Intel® Data Mover Library (Intel® DML) is an open-source library to provide hi
77
## Get Started
88

99
### Prerequisites
10-
- Minimal CPU vector instruction set supported for not optimized code is Intel® Streaming SIMD Extensions 2 (Pentium® 4 processor or higher)
11-
- Compiler:
12-
- Linux* OS: gcc 8.2 or higher
13-
- Windows* OS: MSVC 19 or higher
14-
- Cross-platform build tool: CMake* version 3.12 or higher
15-
- Make: GNU 'make' (Linux* OS) or 'nmake' (Windows*)
16-
- Documentation generator: Doxygen 1.8.17 or higher
17-
- Universally Unique ID library: `uuid-dev` version 2.35.2 or higher.
10+
11+
To build the library, make sure all system and build requirements are set up.
12+
See [Library Presetting](./doc/DML_REFERENCE_MANUAL.md#library-presetting) section for the list of all requirements.
13+
1814
### Build
1915

2016
To build the library, complete the following steps:
@@ -112,4 +108,4 @@ The library is licensed under the MIT license. Refer to the
112108
"[LICENSE](LICENSE)" file for the full license text.
113109

114110
This distribution includes third party software governed by separate license
115-
terms (see "[THIRD-PARTY-PROGRAMS](third-party-programs.txt)").
111+
terms (see "[THIRD-PARTY-PROGRAMS](THIRD-PARTY-PROGRAMS)").

cmake/gnu.cmake

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Copyright 2021 Intel Corporation.
3+
#
4+
# This software and the related documents are Intel copyrighted materials,
5+
# and your use of them is governed by the express license under which they
6+
# were provided to you ("License"). Unless the License provides otherwise,
7+
# you may not use, modify, copy, publish, distribute, disclose or transmit
8+
# this software or the related documents without Intel's prior written
9+
# permission.
10+
#
11+
# This software and the related documents are provided as is, with no
12+
# express or implied warranties, other than those that are expressly
13+
# stated in the License.
14+
#
15+
16+
list(APPEND DML_SECURITY_OPTIONS
17+
-fPIC
18+
-fstack-protector
19+
--param=ssp-buffer-size=8
20+
-Wl,-z,relro,-z,now
21+
-Wl,-z,noexecstack
22+
-fstack-clash-protection
23+
)
24+
25+
list(APPEND DML_SECURITY_DEFINITIONS
26+
$<$<CONFIG:RELEASE>:_FORTIFY_SOURCE=2>)
27+
28+
list(APPEND DML_QUALITY_OPTIONS
29+
$<$<BOOL:${DML_WERROR}>:-Werror>
30+
-Wall
31+
-Wextra
32+
-pedantic
33+
)
34+
35+
list(APPEND DML_AVX512_OPTIONS -march=skylake-avx512) # -mavx512dq -mavx512vl -mavx512bw -mclflushopt -mclwb

cmake/msvc.cmake

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright 2021 Intel Corporation.
3+
#
4+
# This software and the related documents are Intel copyrighted materials,
5+
# and your use of them is governed by the express license under which they
6+
# were provided to you ("License"). Unless the License provides otherwise,
7+
# you may not use, modify, copy, publish, distribute, disclose or transmit
8+
# this software or the related documents without Intel's prior written
9+
# permission.
10+
#
11+
# This software and the related documents are provided as is, with no
12+
# express or implied warranties, other than those that are expressly
13+
# stated in the License.
14+
#
15+
16+
list(APPEND DML_SECURITY_OPTIONS
17+
/GS
18+
)
19+
20+
list(APPEND DML_SECURITY_DEFINITIONS)
21+
22+
list(APPEND DML_QUALITY_OPTIONS
23+
$<$<BOOL:DML_WERROR>:/Wx>>
24+
#/Wall MSVC warning level can be set only via CMAKE_CXX_FLAGS
25+
)
26+
27+
list(APPEND DML_AVX512_OPTIONS /arch:AVX512)

cmake/utils.cmake

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright 2018-2021 Intel Corporation.
3+
#
4+
# This software and the related documents are Intel copyrighted materials,
5+
# and your use of them is governed by the express license under which they
6+
# were provided to you ("License"). Unless the License provides otherwise,
7+
# you may not use, modify, copy, publish, distribute, disclose or transmit
8+
# this software or the related documents without Intel's prior written
9+
# permission.
10+
#
11+
# This software and the related documents are provided as is, with no
12+
# express or implied warranties, other than those that are expressly
13+
# stated in the License.
14+
#
15+
16+
macro(get_git_revision)
17+
# Find git revision
18+
execute_process(COMMAND git rev-parse --short HEAD
19+
OUTPUT_VARIABLE GIT_REV
20+
ERROR_QUIET)
21+
22+
if ("${GIT_REV}" STREQUAL "")
23+
set(GIT_REV "N/A")
24+
else()
25+
string(STRIP "${GIT_REV}" GIT_REV)
26+
endif()
27+
28+
add_compile_definitions(DML_GIT_REVISION="${GIT_REV}")
29+
endmacro()

0 commit comments

Comments
 (0)