Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
24be7b26
Commit
24be7b26
authored
Dec 26, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Dec 26, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2049 from asmorkalov:android_cuda_warning_fix
parents
1acc1085
1e038e28
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
27 deletions
+49
-27
gpumat.cpp
modules/core/src/gpumat.cpp
+38
-16
CMakeLists.txt
modules/dynamicuda/CMakeLists.txt
+1
-1
main.cpp
modules/dynamicuda/src/main.cpp
+10
-10
No files found.
modules/core/src/gpumat.cpp
View file @
24be7b26
...
@@ -45,29 +45,42 @@
...
@@ -45,29 +45,42 @@
#include <iostream>
#include <iostream>
#if defined(HAVE_CUDA)
#if defined(HAVE_CUDA)
#
include <cuda_runtime.h>
#
include <cuda_runtime.h>
#
include <npp.h>
#
include <npp.h>
#
define CUDART_MINIMUM_REQUIRED_VERSION 4020
#
define CUDART_MINIMUM_REQUIRED_VERSION 4020
#
define NPP_MINIMUM_REQUIRED_VERSION 4200
#
define NPP_MINIMUM_REQUIRED_VERSION 4200
#
if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION)
#
if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION)
#
error "Insufficient Cuda Runtime library version, please update it."
#
error "Insufficient Cuda Runtime library version, please update it."
#
endif
#
endif
#
if (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD < NPP_MINIMUM_REQUIRED_VERSION)
#
if (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD < NPP_MINIMUM_REQUIRED_VERSION)
#
error "Insufficient NPP version, please update it."
#
error "Insufficient NPP version, please update it."
#
endif
#
endif
#endif
#endif
#ifdef DYNAMIC_CUDA_SUPPORT
#ifdef DYNAMIC_CUDA_SUPPORT
#include <dlfcn.h>
#
include <dlfcn.h>
#include <sys/types.h>
#
include <sys/types.h>
#include <sys/stat.h>
#
include <sys/stat.h>
#include <dirent.h>
#
include <dirent.h>
#endif
#endif
#ifdef ANDROID
#ifdef ANDROID
# ifdef LOG_TAG
# undef LOG_TAG
# endif
# ifdef LOGE
# undef LOGE
# endif
# ifdef LOGD
# undef LOGD
# endif
# ifdef LOGI
# undef LOGI
# endif
# include <android/log.h>
# include <android/log.h>
# define LOG_TAG "OpenCV::CUDA"
# define LOG_TAG "OpenCV::CUDA"
...
@@ -93,6 +106,9 @@ static GpuFactoryType gpuFactory = NULL;
...
@@ -93,6 +106,9 @@ static GpuFactoryType gpuFactory = NULL;
static
DeviceInfoFactoryType
deviceInfoFactory
=
NULL
;
static
DeviceInfoFactoryType
deviceInfoFactory
=
NULL
;
# if defined(__linux__) || defined(__APPLE__) || defined (ANDROID)
# if defined(__linux__) || defined(__APPLE__) || defined (ANDROID)
const
std
::
string
DYNAMIC_CUDA_LIB_NAME
=
"libopencv_dynamicuda.so"
;
# ifdef ANDROID
# ifdef ANDROID
static
const
std
::
string
getCudaSupportLibName
()
static
const
std
::
string
getCudaSupportLibName
()
{
{
...
@@ -144,7 +160,7 @@ static const std::string getCudaSupportLibName()
...
@@ -144,7 +160,7 @@ static const std::string getCudaSupportLibName()
LOGD
(
"Libraries folder found: %s"
,
pathBegin
);
LOGD
(
"Libraries folder found: %s"
,
pathBegin
);
fclose
(
file
);
fclose
(
file
);
return
std
::
string
(
pathBegin
)
+
"/libopencv_core_cuda.so"
;
return
std
::
string
(
pathBegin
)
+
DYNAMIC_CUDA_LIB_NAME
;
}
}
fclose
(
file
);
fclose
(
file
);
LOGE
(
"Could not find library path"
);
LOGE
(
"Could not find library path"
);
...
@@ -165,7 +181,7 @@ static const std::string getCudaSupportLibName()
...
@@ -165,7 +181,7 @@ static const std::string getCudaSupportLibName()
# else
# else
static
const
std
::
string
getCudaSupportLibName
()
static
const
std
::
string
getCudaSupportLibName
()
{
{
return
"libopencv_core_cuda.so"
;
return
DYNAMIC_CUDA_LIB_NAME
;
}
}
# endif
# endif
...
@@ -173,13 +189,18 @@ static bool loadCudaSupportLib()
...
@@ -173,13 +189,18 @@ static bool loadCudaSupportLib()
{
{
void
*
handle
;
void
*
handle
;
const
std
::
string
name
=
getCudaSupportLibName
();
const
std
::
string
name
=
getCudaSupportLibName
();
dlerror
();
handle
=
dlopen
(
name
.
c_str
(),
RTLD_LAZY
);
handle
=
dlopen
(
name
.
c_str
(),
RTLD_LAZY
);
if
(
!
handle
)
if
(
!
handle
)
{
LOGE
(
"Cannot dlopen %s: %s"
,
name
.
c_str
(),
dlerror
());
return
false
;
return
false
;
}
deviceInfoFactory
=
(
DeviceInfoFactoryType
)
dlsym
(
handle
,
"deviceInfoFactory"
);
deviceInfoFactory
=
(
DeviceInfoFactoryType
)
dlsym
(
handle
,
"deviceInfoFactory"
);
if
(
!
deviceInfoFactory
)
if
(
!
deviceInfoFactory
)
{
{
LOGE
(
"Cannot dlsym deviceInfoFactory: %s"
,
dlerror
());
dlclose
(
handle
);
dlclose
(
handle
);
return
false
;
return
false
;
}
}
...
@@ -187,6 +208,7 @@ static bool loadCudaSupportLib()
...
@@ -187,6 +208,7 @@ static bool loadCudaSupportLib()
gpuFactory
=
(
GpuFactoryType
)
dlsym
(
handle
,
"gpuFactory"
);
gpuFactory
=
(
GpuFactoryType
)
dlsym
(
handle
,
"gpuFactory"
);
if
(
!
gpuFactory
)
if
(
!
gpuFactory
)
{
{
LOGE
(
"Cannot dlsym gpuFactory: %s"
,
dlerror
());
dlclose
(
handle
);
dlclose
(
handle
);
return
false
;
return
false
;
}
}
...
...
modules/dynamicuda/CMakeLists.txt
View file @
24be7b26
...
@@ -5,7 +5,7 @@ endif()
...
@@ -5,7 +5,7 @@ endif()
set
(
the_description
"Dynamic CUDA linkage"
)
set
(
the_description
"Dynamic CUDA linkage"
)
add_definitions
(
-DUSE_CUDA
)
add_definitions
(
-DUSE_CUDA
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wundef
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wundef
-Wshadow
)
ocv_module_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/gpu/include"
)
ocv_module_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/gpu/include"
)
set
(
OPENCV_MODULE_TYPE SHARED
)
set
(
OPENCV_MODULE_TYPE SHARED
)
if
(
BUILD_FAT_JAVA_LIB
)
if
(
BUILD_FAT_JAVA_LIB
)
...
...
modules/dynamicuda/src/main.cpp
View file @
24be7b26
...
@@ -6,19 +6,19 @@
...
@@ -6,19 +6,19 @@
#include <iostream>
#include <iostream>
#ifdef HAVE_CUDA
#ifdef HAVE_CUDA
#include <cuda_runtime.h>
#
include <cuda_runtime.h>
#include <npp.h>
#
include <npp.h>
#define CUDART_MINIMUM_REQUIRED_VERSION 4020
#
define CUDART_MINIMUM_REQUIRED_VERSION 4020
#define NPP_MINIMUM_REQUIRED_VERSION 4200
#
define NPP_MINIMUM_REQUIRED_VERSION 4200
#if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION)
#
if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION)
#error "Insufficient Cuda Runtime library version, please update it."
#
error "Insufficient Cuda Runtime library version, please update it."
#endif
#
endif
#if (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD < NPP_MINIMUM_REQUIRED_VERSION)
#
if (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD < NPP_MINIMUM_REQUIRED_VERSION)
#error "Insufficient NPP version, please update it."
#
error "Insufficient NPP version, please update it."
#endif
#
endif
#endif
#endif
using
namespace
std
;
using
namespace
std
;
...
...
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