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
90ff3dd9
Commit
90ff3dd9
authored
Oct 19, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added cublasSafeCall
parent
f299bde3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
safe_call.hpp
modules/gpu/src/cuda/safe_call.hpp
+10
-0
error.cpp
modules/gpu/src/error.cpp
+24
-1
No files found.
modules/gpu/src/cuda/safe_call.hpp
View file @
90ff3dd9
...
...
@@ -45,6 +45,7 @@
#include "cuda_runtime_api.h"
#include "cufft.h"
#include "cublas.h"
#include "NCV.hpp"
#if defined(__GNUC__)
...
...
@@ -52,11 +53,13 @@
#define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__, __func__)
#define ncvSafeCall(expr) ___ncvSafeCall(expr, __FILE__, __LINE__, __func__)
#define cufftSafeCall(expr) ___cufftSafeCall(expr, __FILE__, __LINE__, __func__)
#define cublasSafeCall(expr) ___cublasSafeCall(expr, __FILE__, __LINE__, __func__)
#else
/* defined(__CUDACC__) || defined(__MSVC__) */
#define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__)
#define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__)
#define ncvSafeCall(expr) ___ncvSafeCall(expr, __FILE__, __LINE__)
#define cufftSafeCall(expr) ___cufftSafeCall(expr, __FILE__, __LINE__)
#define cublasSafeCall(expr) ___cublasSafeCall(expr, __FILE__, __LINE__)
#endif
namespace
cv
...
...
@@ -67,6 +70,7 @@ namespace cv
void
nppError
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
void
ncvError
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
void
cufftError
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
void
cublasError
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
static
inline
void
___cudaSafeCall
(
cudaError_t
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
)
{
...
...
@@ -91,6 +95,12 @@ namespace cv
if
(
CUFFT_SUCCESS
!=
err
)
cv
::
gpu
::
cufftError
(
err
,
file
,
line
,
func
);
}
static
inline
void
___cublasSafeCall
(
cublasStatus_t
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
)
{
if
(
CUBLAS_STATUS_SUCCESS
!=
err
)
cv
::
gpu
::
cublasError
(
err
,
file
,
line
,
func
);
}
}
}
...
...
modules/gpu/src/error.cpp
View file @
90ff3dd9
...
...
@@ -178,7 +178,7 @@ namespace
error_entry
(
NPPST_MEM_INTERNAL_ERROR
)
};
const
size_t
ncv_error_num
=
sizeof
(
n
pp_errors
)
/
sizeof
(
npp
_errors
[
0
]);
const
size_t
ncv_error_num
=
sizeof
(
n
cv_errors
)
/
sizeof
(
ncv
_errors
[
0
]);
//////////////////////////////////////////////////////////////////////////
// CUFFT errors
...
...
@@ -197,6 +197,23 @@ namespace
};
const
int
cufft_error_num
=
sizeof
(
cufft_errors
)
/
sizeof
(
cufft_errors
[
0
]);
//////////////////////////////////////////////////////////////////////////
// CUBLAS errors
const
ErrorEntry
cublas_errors
[]
=
{
error_entry
(
CUBLAS_STATUS_SUCCESS
),
error_entry
(
CUBLAS_STATUS_NOT_INITIALIZED
),
error_entry
(
CUBLAS_STATUS_ALLOC_FAILED
),
error_entry
(
CUBLAS_STATUS_INVALID_VALUE
),
error_entry
(
CUBLAS_STATUS_ARCH_MISMATCH
),
error_entry
(
CUBLAS_STATUS_MAPPING_ERROR
),
error_entry
(
CUBLAS_STATUS_EXECUTION_FAILED
),
error_entry
(
CUBLAS_STATUS_INTERNAL_ERROR
)
};
const
int
cublas_error_num
=
sizeof
(
cublas_errors
)
/
sizeof
(
cublas_errors
[
0
]);
}
namespace
cv
...
...
@@ -236,6 +253,12 @@ namespace cv
string
msg
=
getErrorString
(
code
,
cufft_errors
,
cufft_error_num
);
cv
::
gpu
::
error
(
msg
.
c_str
(),
file
,
line
,
func
);
}
void
cublasError
(
int
code
,
const
char
*
file
,
const
int
line
,
const
char
*
func
)
{
string
msg
=
getErrorString
(
code
,
cublas_errors
,
cublas_error_num
);
cv
::
gpu
::
error
(
msg
.
c_str
(),
file
,
line
,
func
);
}
}
}
...
...
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