Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
09bbe0fb
Commit
09bbe0fb
authored
Jun 15, 2016
by
Vitaliy Lyudvichenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing unix build and cmake MKL searching
parent
b96fbe4c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
31 deletions
+55
-31
CMakeLists.txt
modules/dnn/CMakeLists.txt
+1
-1
OpenCVFindMKL.cmake
modules/dnn/cmake/OpenCVFindMKL.cmake
+42
-25
all_layers.hpp
modules/dnn/include/opencv2/dnn/all_layers.hpp
+10
-2
perf_convolution.cpp
modules/dnn/perf/perf_convolution.cpp
+2
-3
No files found.
modules/dnn/CMakeLists.txt
View file @
09bbe0fb
...
...
@@ -37,6 +37,7 @@ if(${the_module}_WITH_BLAS)
set
(
BLAS_CBLAS_H
"mkl_cblas.h"
)
set
(
BLAS_LIBRARIES
${
MKL_LIBRARIES
}
)
set
(
BLAS_BINARIES
""
)
add_definitions
(
${
MKL_CXX_FLAGS
}
)
endif
()
set
(
BLAS_PREF
${
the_module
}
_BLAS
)
...
...
@@ -54,7 +55,6 @@ if(${the_module}_WITH_BLAS)
list
(
APPEND OPENCV_MODULE_
${
the_module
}
_DEPS_EXT
${${
the_module
}
_BLAS_LIBRARIES
}
)
target_link_libraries
(
${
the_module
}
${${
the_module
}
_BLAS_LIBRARIES
}
)
add_definitions
(
-DHAVE_CBLAS
)
add_definitions
(
-DCBLAS_H_INCLUDE=<
${${
BLAS_PREF
}
_CBLAS_H
}
>
)
message
(
CMAKE_CURRENT_BINARY_DIR=
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_custom_command
(
TARGET
${
the_module
}
PRE_BUILD
#OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cblas.h
COMMAND
${
CMAKE_COMMAND
}
ARGS -E echo \
"
\#
include <
${${
BLAS_PREF
}
_CBLAS_H
}
>
\"
>
${
CMAKE_CURRENT_BINARY_DIR
}
/cblas.h
...
...
modules/dnn/cmake/OpenCVFindMKL.cmake
View file @
09bbe0fb
...
...
@@ -13,6 +13,28 @@
# MKL_LIBRARIES - IPP libraries that are used by OpenCV
#
macro
(
mkl_fail
)
set
(
HAVE_MKL OFF CACHE BOOL
"True if MKL found"
)
set
(
MKL_ROOT_DIR
${
MKL_ROOT_DIR
}
CACHE PATH
"Path to MKL directory"
)
unset
(
MKL_INCLUDE_DIRS CACHE
)
unset
(
MKL_LIBRARIES CACHE
)
endmacro
()
macro
(
get_mkl_version VERSION_FILE
)
# read MKL version info from file
file
(
STRINGS
${
VERSION_FILE
}
STR1 REGEX
"__INTEL_MKL__"
)
file
(
STRINGS
${
VERSION_FILE
}
STR2 REGEX
"__INTEL_MKL_MINOR__"
)
file
(
STRINGS
${
VERSION_FILE
}
STR3 REGEX
"__INTEL_MKL_UPDATE__"
)
#file(STRINGS ${VERSION_FILE} STR4 REGEX "INTEL_MKL_VERSION")
# extract info and assign to variables
string
(
REGEX MATCHALL
"[0-9]+"
MKL_VERSION_MAJOR
${
STR1
}
)
string
(
REGEX MATCHALL
"[0-9]+"
MKL_VERSION_MINOR
${
STR2
}
)
string
(
REGEX MATCHALL
"[0-9]+"
MKL_VERSION_UPDATE
${
STR3
}
)
set
(
MKL_VERSION_STR
"
${
MKL_VERSION_MAJOR
}
.
${
MKL_VERSION_MINOR
}
.
${
MKL_VERSION_UPDATE
}
"
CACHE STRING
"MKL version"
FORCE
)
endmacro
()
if
(
NOT DEFINED MKL_USE_MULTITHREAD
)
OCV_OPTION
(
MKL_WITH_TBB
"Use MKL with TBB multithreading"
OFF
)
#ON IF WITH_TBB)
OCV_OPTION
(
MKL_WITH_OPENMP
"Use MKL with OpenMP multithreading"
OFF
)
#ON IF WITH_OPENMP)
...
...
@@ -29,29 +51,20 @@ if(NOT MKL_ROOT_DIR OR NOT EXISTS ${MKL_ROOT_DIR}/include/mkl.h)
list
(
APPEND MKLROOT_PATHS $ENV{
${
ProgramFilesx86
}
}/IntelSWTools/compilers_and_libraries/windows/mkl
)
endif
()
if
(
UNIX
)
list
(
APPEND MKLROOT_PATHS
"opt/intel/mkl"
)
list
(
APPEND MKLROOT_PATHS
"
/
opt/intel/mkl"
)
endif
()
find_path
(
MKL_ROOT_DIR include/mkl.h PATHS
${
MKLROOT_PATHS
}
)
endif
()
if
(
NOT MKL_ROOT_DIR
)
mkl_fail
()
return
()
endif
()
set
(
MKL_INCLUDE_DIRS
${
MKL_ROOT_DIR
}
/include
)
set
(
MKL_INCLUDE_HEADERS
${
MKL_INCLUDE_DIRS
}
/mkl.h
${
MKL_INCLUDE_DIRS
}
/mkl_version.h
)
macro
(
get_mkl_version VERSION_FILE
)
# read MKL version info from file
file
(
STRINGS
${
VERSION_FILE
}
STR1 REGEX
"__INTEL_MKL__"
)
file
(
STRINGS
${
VERSION_FILE
}
STR2 REGEX
"__INTEL_MKL_MINOR__"
)
file
(
STRINGS
${
VERSION_FILE
}
STR3 REGEX
"__INTEL_MKL_UPDATE__"
)
#file(STRINGS ${VERSION_FILE} STR4 REGEX "INTEL_MKL_VERSION")
# extract info and assign to variables
string
(
REGEX MATCHALL
"[0-9]+"
MKL_VERSION_MAJOR
${
STR1
}
)
string
(
REGEX MATCHALL
"[0-9]+"
MKL_VERSION_MINOR
${
STR2
}
)
string
(
REGEX MATCHALL
"[0-9]+"
MKL_VERSION_UPDATE
${
STR3
}
)
set
(
MKL_VERSION_STR
"
${
MKL_VERSION_MAJOR
}
.
${
MKL_VERSION_MINOR
}
.
${
MKL_VERSION_UPDATE
}
"
CACHE STRING
"MKL version"
FORCE
)
endmacro
()
#determine arch
if
(
CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8
)
set
(
MKL_X64 1
)
...
...
@@ -70,20 +83,22 @@ endif()
if
(
MSVC
)
set
(
MKL_EXT
".lib"
)
set
(
MKL_PRE
""
)
else
()
set
(
MKL_EXT
".a"
)
set
(
MKL_PRE
"lib"
)
endif
()
set
(
MKL_LIB_DIR
${
MKL_ROOT_DIR
}
/lib/
${
MKL_ARCH
}
)
set
(
MKL_LIBRARIES
${
MKL_LIB_DIR
}
/
mkl_core
${
MKL_EXT
}
${
MKL_LIB_DIR
}
/
mkl_intel_
${
MKL_LP64
}${
MKL_EXT
}
)
set
(
MKL_LIBRARIES
${
MKL_LIB_DIR
}
/
${
MKL_PRE
}
mkl_core
${
MKL_EXT
}
${
MKL_LIB_DIR
}
/
${
MKL_PRE
}
mkl_intel_
${
MKL_LP64
}${
MKL_EXT
}
)
if
(
MKL_WITH_TBB
)
list
(
APPEND MKL_LIBRARIES
${
MKL_LIB_DIR
}
/mkl_tbb_thread
${
MKL_EXT
}
)
list
(
APPEND MKL_LIBRARIES
${
MKL_LIB_DIR
}
/
${
MKL_PRE
}
mkl_tbb_thread
${
MKL_EXT
}
)
list
(
APPEND MKL_LIBRARIES
${
MKL_ROOT_DIR
}
/../tbb/lib/
${
MKL_ARCH
}
/tbb
${
MKL_EXT
}
)
elseif
(
MKL_WITH_OPENMP
)
message
(
FATAL_ERROR
"Multithreaded MKL is not supported yet"
)
else
()
list
(
APPEND MKL_LIBRARIES
${
MKL_LIB_DIR
}
/mkl_sequential
${
MKL_EXT
}
)
list
(
APPEND MKL_LIBRARIES
${
MKL_LIB_DIR
}
/
${
MKL_PRE
}
mkl_sequential
${
MKL_EXT
}
)
endif
()
include
(
FindPackageHandleStandardArgs
)
...
...
@@ -96,10 +111,13 @@ if(MKL_FOUND)
set
(
HAVE_MKL ON CACHE BOOL
"True if MKL found"
)
set
(
MKL_ROOT_DIR
${
MKL_ROOT_DIR
}
CACHE PATH
"Path to MKL directory"
)
set
(
MKL_INCLUDE_DIRS
${
MKL_INCLUDE_DIRS
}
CACHE PATH
"Path to MKL include directory"
)
set
(
MKL_LIBRARIES
${
MKL_LIBRARIES
}
CACHE FILEPATH
"MKL libarries"
)
if
(
NOT UNIX
)
set
(
MKL_LIBRARIES
${
MKL_LIBRARIES
}
CACHE FILEPATH
"MKL libarries"
)
else
()
#it's ugly but helps to avoid cyclic lib problem
set
(
MKL_LIBRARIES
${
MKL_LIBRARIES
}
${
MKL_LIBRARIES
}
${
MKL_LIBRARIES
}
"-lpthread"
"-lm"
"-ldl"
)
set
(
MKL_LIBRARIES
${
MKL_LIBRARIES
}
CACHE STRING
"MKL libarries"
)
endif
()
else
()
set
(
HAVE_MKL OFF CACHE BOOL
"True if MKL found"
)
set
(
MKL_ROOT_DIR
${
MKL_ROOT_DIR
}
CACHE PATH
"Path to MKL directory"
)
unset
(
MKL_INCLUDE_DIRS
)
unset
(
MKL_LIBRARIES
)
endif
()
\ No newline at end of file
endif
()
modules/dnn/include/opencv2/dnn/all_layers.hpp
View file @
09bbe0fb
...
...
@@ -47,6 +47,11 @@ namespace cv
{
namespace
dnn
{
//! @addtogroup dnn
//! @{
//!
//! @defgroup LayerList Partial List of Implemented Layers
//! @{
//! LSTM recurrent layer
class
LSTMLayer
:
public
Layer
...
...
@@ -124,6 +129,10 @@ namespace dnn
*/
void
forward
(
std
::
vector
<
Blob
*>
&
input
,
std
::
vector
<
Blob
>
&
output
);
};
//! @}
//! @}
}
}
#endif
\ No newline at end of file
#endif
modules/dnn/perf/perf_convolution.cpp
View file @
09bbe0fb
...
...
@@ -41,7 +41,7 @@ PERF_TEST_P( ConvolutionPerfTest, perf, Combine(
BlobShape
inpShape
=
get
<
1
>
(
params
).
first
;
int
outCn
=
get
<
1
>
(
params
).
second
;
int
groups
=
get
<
2
>
(
params
);
int
stride
=
(
ksz
>=
11
)
?
4
:
get
<
3
>
(
params
);
int
stride
=
(
ksz
>=
11
)
?
4
:
(
int
)
get
<
3
>
(
params
);
int
inpCn
=
inpShape
[
1
];
Blob
wgtBlob
(
BlobShape
(
outCn
,
inpCn
/
groups
,
ksz
,
ksz
)),
biasBlob
(
BlobShape
(
outCn
,
1
,
1
,
1
));
...
...
@@ -77,4 +77,4 @@ PERF_TEST_P( ConvolutionPerfTest, perf, Combine(
SANITY_CHECK_NOTHING
();
}
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment