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
f50a8299
Commit
f50a8299
authored
Sep 03, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Sep 03, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1383 from pengx17:2.4_clblas
parents
757e7f84
ea165394
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
2 deletions
+51
-2
gemm.cpp
modules/ocl/src/gemm.cpp
+48
-2
initialization.cpp
modules/ocl/src/initialization.cpp
+3
-0
No files found.
modules/ocl/src/gemm.cpp
View file @
f50a8299
...
...
@@ -46,16 +46,62 @@
#include <iomanip>
#include "precomp.hpp"
namespace
cv
{
namespace
ocl
{
// used for clAmdBlas library to avoid redundant setup/teardown
void
clBlasSetup
();
void
clBlasTeardown
();
}}
/* namespace cv { namespace ocl */
#if !defined HAVE_CLAMDBLAS
void
cv
::
ocl
::
gemm
(
const
oclMat
&
,
const
oclMat
&
,
double
,
const
oclMat
&
,
double
,
oclMat
&
,
int
)
{
CV_Error
(
CV_StsNotImplemented
,
"OpenCL BLAS is not implemented"
);
}
void
cv
::
ocl
::
clBlasSetup
()
{
CV_Error
(
CV_StsNotImplemented
,
"OpenCL BLAS is not implemented"
);
}
void
cv
::
ocl
::
clBlasTeardown
()
{
//intentionally do nothing
}
#else
#include "clAmdBlas.h"
using
namespace
cv
;
static
bool
clBlasInitialized
=
false
;
static
Mutex
cs
;
void
cv
::
ocl
::
clBlasSetup
()
{
if
(
!
clBlasInitialized
)
{
AutoLock
al
(
cs
);
if
(
!
clBlasInitialized
)
{
openCLSafeCall
(
clAmdBlasSetup
());
clBlasInitialized
=
true
;
}
}
}
void
cv
::
ocl
::
clBlasTeardown
()
{
AutoLock
al
(
cs
);
if
(
clBlasInitialized
)
{
clAmdBlasTeardown
();
clBlasInitialized
=
false
;
}
}
void
cv
::
ocl
::
gemm
(
const
oclMat
&
src1
,
const
oclMat
&
src2
,
double
alpha
,
const
oclMat
&
src3
,
double
beta
,
oclMat
&
dst
,
int
flags
)
{
...
...
@@ -71,7 +117,8 @@ void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
dst
.
create
(
src1
.
rows
,
src2
.
cols
,
src1
.
type
());
dst
.
setTo
(
Scalar
::
all
(
0
));
}
openCLSafeCall
(
clAmdBlasSetup
()
);
clBlasSetup
();
const
clAmdBlasTranspose
transA
=
(
cv
::
GEMM_1_T
&
flags
)
?
clAmdBlasTrans
:
clAmdBlasNoTrans
;
const
clAmdBlasTranspose
transB
=
(
cv
::
GEMM_2_T
&
flags
)
?
clAmdBlasTrans
:
clAmdBlasNoTrans
;
...
...
@@ -156,6 +203,5 @@ void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
}
break
;
}
clAmdBlasTeardown
();
}
#endif
modules/ocl/src/initialization.cpp
View file @
f50a8299
...
...
@@ -68,6 +68,7 @@ namespace cv
namespace
ocl
{
extern
void
fft_teardown
();
extern
void
clBlasTeardown
();
/*
* The binary caching system to eliminate redundant program source compilation.
* Strictly, this is not a cache because we do not implement evictions right now.
...
...
@@ -1050,6 +1051,7 @@ namespace cv
void
Info
::
release
()
{
fft_teardown
();
clBlasTeardown
();
impl
->
release
();
impl
=
new
Impl
;
DeviceName
.
clear
();
...
...
@@ -1058,6 +1060,7 @@ namespace cv
Info
::~
Info
()
{
fft_teardown
();
clBlasTeardown
();
impl
->
release
();
}
...
...
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