diff --git a/cmake/cfg.cmake b/cmake/cfg.cmake index ad2a45e2b6a02a7c8850ca65a10919ca4437bf1a..39dfb6a8dad63aaf590d5b49b8210fe879be566b 100644 --- a/cmake/cfg.cmake +++ b/cmake/cfg.cmake @@ -25,8 +25,6 @@ execute_process( include_directories(${CFG_INCLUDE_DIR}) -list(APPEND ONEFLOW_INCLUDE_SRC_DIRS ${CFG_INCLUDE_DIR}) - function(GENERATE_CFG_AND_PYBIND11_CPP SRCS HDRS PYBIND_SRCS ROOT_DIR) list(APPEND CFG_SOURCE_FILE_CONVERT_PROTO oneflow/core/common/error.proto diff --git a/cmake/oneflow.cmake b/cmake/oneflow.cmake index 9a4b95d89c5a1a3e38571b6116d47f7faa7431c5..f440566be9fd07d976bca0662a9d6d516967d87a 100644 --- a/cmake/oneflow.cmake +++ b/cmake/oneflow.cmake @@ -52,10 +52,6 @@ function(target_treat_warnings_as_errors target) # disable for pointer operations of intrusive linked lists target_try_compile_options(${target} -Wno-error=array-bounds) - - # avoid check of memcpy for non-trivial types in opencv headers - target_try_compile_options(${target} -Wno-error=class-memaccess) - endif() endfunction() @@ -369,7 +365,7 @@ set(ONEFLOW_INCLUDE_DIR "${ONEFLOW_PYTHON_DIR}/oneflow/include") add_custom_target(of_include_copy COMMAND ${CMAKE_COMMAND} -E remove_directory "${ONEFLOW_INCLUDE_DIR}" && ${CMAKE_COMMAND} -E make_directory "${ONEFLOW_INCLUDE_DIR}") add_dependencies(of_include_copy oneflow_internal) -foreach(of_include_src_dir ${ONEFLOW_INCLUDE_SRC_DIRS}) +foreach(of_include_src_dir ${ONEFLOW_THIRD_PARTY_INCLUDE_DIRS} ${CFG_INCLUDE_DIR}) set(oneflow_all_include_file) file(GLOB_RECURSE oneflow_all_include_file "${of_include_src_dir}/*.*") copy_files("${oneflow_all_include_file}" "${of_include_src_dir}" "${ONEFLOW_INCLUDE_DIR}" of_include_copy) diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index f7fe10090b41ae7c938ca2923129361d5ea40004..9a3afc8875df41eafcc8f4523365bb49edcb8631 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -181,7 +181,7 @@ if (RPC_BACKEND MATCHES "GRPC") list(APPEND oneflow_third_party_dependencies grpc) endif() -list(APPEND ONEFLOW_INCLUDE_SRC_DIRS +list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR} ${GFLAGS_INCLUDE_DIR} ${GLOG_INCLUDE_DIR} @@ -203,7 +203,7 @@ list(APPEND ONEFLOW_INCLUDE_SRC_DIRS ) if (NOT WITH_XLA) - list(APPEND ONEFLOW_INCLUDE_SRC_DIRS ${RE2_INCLUDE_DIR}) + list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS ${RE2_INCLUDE_DIR}) endif() if (BUILD_CUDA) @@ -217,7 +217,7 @@ if (BUILD_CUDA) list(APPEND oneflow_third_party_dependencies cub_copy_headers_to_destination) list(APPEND oneflow_third_party_dependencies nccl) - list(APPEND ONEFLOW_INCLUDE_SRC_DIRS + list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS ${CUDNN_INCLUDE_DIRS} ${CUB_INCLUDE_DIR} ${NCCL_INCLUDE_DIR} @@ -243,11 +243,11 @@ if(BUILD_HWLOC) list(APPEND oneflow_third_party_dependencies hwloc) list(APPEND oneflow_third_party_libs ${HWLOC_STATIC_LIBRARIES}) list(APPEND oneflow_third_party_libs ${PCIACCESS_STATIC_LIBRARIES}) - list(APPEND ONEFLOW_INCLUDE_SRC_DIRS ${HWLOC_INCLUDE_DIR}) + list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS ${HWLOC_INCLUDE_DIR}) add_definitions(-DWITH_HWLOC) endif() -include_directories(${ONEFLOW_INCLUDE_SRC_DIRS}) +include_directories(SYSTEM ${ONEFLOW_THIRD_PARTY_INCLUDE_DIRS}) if(WITH_XLA) list(APPEND oneflow_third_party_dependencies tensorflow_copy_libs_to_destination) diff --git a/oneflow/core/kernel/gather_kernel_util.cpp b/oneflow/core/kernel/gather_kernel_util.cpp index 5e2b21b3e7ffb4ff6fd609065a732c42ca2d1f08..fbf23647d87ef9f79b68dbb05c4922f1b514c542 100644 --- a/oneflow/core/kernel/gather_kernel_util.cpp +++ b/oneflow/core/kernel/gather_kernel_util.cpp @@ -85,7 +85,7 @@ void GatherKernelUtilImpl::Forward(DeviceCtx* ctx, const const T* from = in + outer_idx * gather_dim_size * inner_dim_size + idx * inner_dim_size; std::copy(from, from + inner_dim_size, to); } else { - std::memset(to, 0, inner_dim_size * sizeof(K)); + std::memset(reinterpret_cast(to), 0, inner_dim_size * sizeof(K)); } } }