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
c79ae7d4
Commit
c79ae7d4
authored
Nov 21, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed gemm so it doesn't cause device to host copies in the assert statements.
parent
d059f3c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
cublas_dlibapi.cpp
dlib/dnn/cublas_dlibapi.cpp
+23
-19
No files found.
dlib/dnn/cublas_dlibapi.cpp
View file @
c79ae7d4
...
@@ -85,43 +85,47 @@ namespace dlib
...
@@ -85,43 +85,47 @@ namespace dlib
const
auto
transa
=
trans_lhs
?
CUBLAS_OP_T
:
CUBLAS_OP_N
;
const
auto
transa
=
trans_lhs
?
CUBLAS_OP_T
:
CUBLAS_OP_N
;
const
auto
transb
=
trans_rhs
?
CUBLAS_OP_T
:
CUBLAS_OP_N
;
const
auto
transb
=
trans_rhs
?
CUBLAS_OP_T
:
CUBLAS_OP_N
;
const
int
dest_nr
=
dest
.
num_samples
();
const
int
dest_nc
=
dest
.
size
()
/
dest_nr
;
const
int
lhs_nr
=
lhs
.
num_samples
();
const
int
lhs_nc
=
lhs
.
size
()
/
lhs_nr
;
const
int
rhs_nr
=
rhs
.
num_samples
();
const
int
rhs_nc
=
rhs
.
size
()
/
rhs_nr
;
if
(
trans_lhs
&&
trans_rhs
)
if
(
trans_lhs
&&
trans_rhs
)
{
{
DLIB_
CASSERT
(
mat
(
dest
).
nr
()
==
trans
(
mat
(
lhs
)).
nr
()
&&
DLIB_
ASSERT
(
dest_nr
==
lhs_nc
&&
mat
(
dest
).
nc
()
==
trans
(
mat
(
rhs
)).
nc
()
&&
dest_nc
==
rhs_nr
&&
trans
(
mat
(
lhs
)).
nc
()
==
trans
(
mat
(
rhs
)).
nr
()
,
""
)
lhs_nr
==
rhs_nc
,
""
)
}
}
else
if
(
!
trans_lhs
&&
trans_rhs
)
else
if
(
!
trans_lhs
&&
trans_rhs
)
{
{
DLIB_
CASSERT
(
mat
(
dest
).
nr
()
==
mat
(
lhs
).
nr
()
&&
DLIB_
ASSERT
(
dest_nr
==
lhs_nr
&&
mat
(
dest
).
nc
()
==
trans
(
mat
(
rhs
)).
nc
()
&&
dest_nc
==
rhs_nr
&&
mat
(
lhs
).
nc
()
==
trans
(
mat
(
rhs
)).
nr
()
,
""
)
lhs_nc
==
rhs_nc
,
""
)
}
}
else
if
(
trans_lhs
&&
!
trans_rhs
)
else
if
(
trans_lhs
&&
!
trans_rhs
)
{
{
DLIB_
CASSERT
(
mat
(
dest
).
nr
()
==
trans
(
mat
(
lhs
)).
nr
()
&&
DLIB_
ASSERT
(
dest_nr
==
lhs_nc
&&
mat
(
dest
).
nc
()
==
mat
(
rhs
).
nc
()
&&
dest_nc
==
rhs_nc
&&
trans
(
mat
(
lhs
)).
nc
()
==
mat
(
rhs
).
nr
()
,
""
)
lhs_nr
==
rhs_nr
,
""
)
}
}
else
else
{
{
DLIB_
CASSERT
(
mat
(
dest
).
nr
()
==
mat
(
lhs
).
nr
()
&&
DLIB_
ASSERT
(
dest_nr
==
lhs_nr
&&
mat
(
dest
).
nc
()
==
mat
(
rhs
).
nc
()
&&
dest_nc
==
rhs_nc
&&
mat
(
lhs
).
nc
()
==
mat
(
rhs
).
nr
()
,
""
)
lhs_nc
==
rhs_nr
,
""
)
}
}
const
int
m
=
mat
(
dest
).
nc
();
const
int
k
=
trans_rhs
?
rhs_nc
:
rhs_nr
;
const
int
n
=
mat
(
dest
).
nr
();
const
int
k
=
trans_rhs
?
mat
(
rhs
).
nc
()
:
mat
(
rhs
).
nr
();
check
(
cublasSgemm
(
context
(),
check
(
cublasSgemm
(
context
(),
transb
,
transb
,
transa
,
transa
,
m
,
n
,
k
,
dest_nc
,
dest_nr
,
k
,
&
alpha
,
&
alpha
,
rhs
.
device
(),
mat
(
rhs
).
nc
()
,
rhs
.
device
(),
rhs_nc
,
lhs
.
device
(),
mat
(
lhs
).
nc
()
,
lhs
.
device
(),
lhs_nc
,
&
beta
,
&
beta
,
dest
.
device
(),
mat
(
dest
).
nc
()
));
dest
.
device
(),
dest_nc
));
}
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
...
...
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