Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
21e3e81f
Commit
21e3e81f
authored
Jan 23, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed dot() so it doesn't call cublasSdot anymore since cublasSdot gives the
wrong outputs sometimes.
parent
24687a9e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
40 deletions
+2
-40
cublas_dlibapi.cpp
dlib/dnn/cublas_dlibapi.cpp
+0
-18
cublas_dlibapi.h
dlib/dnn/cublas_dlibapi.h
+1
-17
tensor.h
dlib/dnn/tensor.h
+1
-5
No files found.
dlib/dnn/cublas_dlibapi.cpp
View file @
21e3e81f
...
...
@@ -7,7 +7,6 @@
#include "cublas_dlibapi.h"
#include "cuda_utils.h"
#include "tensor.h"
#include <cublas_v2.h>
...
...
@@ -89,23 +88,6 @@ namespace dlib
return
c
.
get_handle
();
}
// -----------------------------------------------------------------------------------
float
dot
(
const
tensor
&
a
,
const
tensor
&
b
)
{
DLIB_CASSERT
(
a
.
size
()
==
b
.
size
(),
""
);
float
result
=
0
;
CHECK_CUBLAS
(
cublasSdot
(
context
(),
a
.
size
(),
a
.
device
(),
1
,
b
.
device
(),
1
,
&
result
));
return
result
;
}
// -----------------------------------------------------------------------------------
void
gemm
(
...
...
dlib/dnn/cublas_dlibapi.h
View file @
21e3e81f
...
...
@@ -5,30 +5,14 @@
#ifdef DLIB_USE_CUDA
#include "tensor.h"
#include "cuda_errors.h"
namespace
dlib
{
class
tensor
;
namespace
cuda
{
// -----------------------------------------------------------------------------------
float
dot
(
const
tensor
&
a
,
const
tensor
&
b
);
/*!
requires
- a.size() == b.size()
ensures
- returns the dot product between a and b when they are both treated as
a.size() dimensional vectors. That is, this function pointwise
multiplies the vectors together, then sums the result and returns it.
!*/
// -----------------------------------------------------------------------------------
void
gemm
(
...
...
dlib/dnn/tensor.h
View file @
21e3e81f
...
...
@@ -7,7 +7,6 @@
#include <cstring>
#include "../matrix.h"
#include "cudnn_dlibapi.h"
#include "cublas_dlibapi.h"
#include "gpu_data.h"
#include <memory>
...
...
@@ -408,9 +407,7 @@ namespace dlib
const
tensor
&
b
)
{
#ifdef DLIB_USE_CUDA
return
cuda
::
dot
(
a
,
b
);
#else
// TODO, do on GPU?
DLIB_CASSERT
(
a
.
size
()
==
b
.
size
(),
""
);
const
float
*
da
=
a
.
host
();
const
float
*
db
=
b
.
host
();
...
...
@@ -418,7 +415,6 @@ namespace dlib
for
(
size_t
i
=
0
;
i
<
a
.
size
();
++
i
)
sum
+=
da
[
i
]
*
db
[
i
];
return
sum
;
#endif
}
// ----------------------------------------------------------------------------------------
...
...
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