提交 3ceeab55 编写于 作者: H Haipeng Wang

add openmp support

上级 f6fe56cb
...@@ -16,6 +16,11 @@ file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h) ...@@ -16,6 +16,11 @@ file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h)
include_directories(src/) include_directories(src/)
option(USE_OPENMP "openmp support" ON)
if(USE_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
endif()
add_library(paddle-mobile SHARED ${PADDLE_MOBILE_CC} ${PADDLE_MOBILE_H}) add_library(paddle-mobile SHARED ${PADDLE_MOBILE_CC} ${PADDLE_MOBILE_H})
add_subdirectory(test) add_subdirectory(test)
...@@ -51,9 +51,9 @@ void sigmoid(const Tensor *X, Tensor *Y) { ...@@ -51,9 +51,9 @@ void sigmoid(const Tensor *X, Tensor *Y) {
int inner_size = paddle_mobile::framework::product(inner_ddim); int inner_size = paddle_mobile::framework::product(inner_ddim);
DLOG << "step6"; DLOG << "step6";
#pragma omp parallel for
DLOG << "outsize=" << out_size; DLOG << "outsize=" << out_size;
DLOG << "innersize=" << inner_size; DLOG << "innersize=" << inner_size;
#pragma omp parallel for
for (int i = 0; i < out_size; ++i) { for (int i = 0; i < out_size; ++i) {
const float *input_outer_ptr = input + i * inner_size; const float *input_outer_ptr = input + i * inner_size;
float *output_outer_ptr = output + i * inner_size; float *output_outer_ptr = output + i * inner_size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册