Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SeetaResearch
/
Dragon
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5bd1f6b5
authored
Dec 01, 2017
by
Ting PAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix syntax error on compiling without cuda
1 parent
ddc5f3c2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
Dragon/include/core/context_cuda.h
Dragon/include/utils/cuda_device.h
Dragon/include/core/context_cuda.h
View file @
5bd1f6b
...
@@ -102,8 +102,8 @@ class CUDAContext {
...
@@ -102,8 +102,8 @@ class CUDAContext {
}
}
inline
static
void
Memset
(
size_t
nbytes
,
void
*
ptr
)
{
cudaMemset
(
ptr
,
0
,
nbytes
);
}
inline
static
void
Memset
(
size_t
nbytes
,
void
*
ptr
)
{
cudaMemset
(
ptr
,
0
,
nbytes
);
}
template
<
class
DstContext
,
class
SrcContext
>
template
<
class
DstContext
,
class
SrcContext
>
inline
static
void
Memcpy
(
size_t
nbytes
,
void
*
dst
,
const
void
*
src
)
{
inline
static
void
Memcpy
(
size_t
nbytes
,
void
*
dst
,
const
void
*
src
)
{
CUDA_CHECK
(
cudaMemcpy
(
dst
,
src
,
nbytes
,
cudaMemcpyDefault
));
CUDA_CHECK
(
cudaMemcpy
(
dst
,
src
,
nbytes
,
cudaMemcpyDefault
));
}
}
...
@@ -188,16 +188,19 @@ static inline cudnnHandle_t& cudnn_handle() {
...
@@ -188,16 +188,19 @@ static inline cudnnHandle_t& cudnn_handle() {
#endif
#endif
#else // WITH_CUDA
#else // WITH_CUDA
class
CUDAContext
{
class
CUDAContext
{
public
:
public
:
CUDAContext
(
const
DeviceOption
&
option
)
{
LOG
(
FATAL
)
<<
"CUDA was not compiled."
;
}
CUDAContext
(
const
DeviceOption
&
option
)
{
CUDA_NOT_COMPILED
;
}
CUDAContext
(
const
int
gpu_id
=
0
)
{
LOG
(
FATAL
)
<<
"CUDA was not compiled."
;
}
CUDAContext
(
const
int
gpu_id
=
0
)
{
CUDA_NOT_COMPILED
;
}
void
SwitchToDevice
()
{
CUDA_NOT_COMPILED
;
}
void
FinishDeviceCompution
()
{
CUDA_NOT_COMPILED
;
}
template
<
class
DstContext
,
class
SrcContext
>
template
<
class
DstContext
,
class
SrcContext
>
static
void
Memcpy
(
size_t
nbytes
,
void
*
dst
,
const
void
*
src
)
{
static
void
Memcpy
(
size_t
nbytes
,
void
*
dst
,
const
void
*
src
)
{
CUDA_NOT_COMPILED
;
}
LOG
(
FATAL
)
<<
"CUDA was not compiled."
;
}
};
};
#endif // WITH_CUDA
#endif // WITH_CUDA
}
// namespace dragon
}
// namespace dragon
...
...
Dragon/include/utils/cuda_device.h
View file @
5bd1f6b
...
@@ -106,6 +106,11 @@ class DeviceGuard {
...
@@ -106,6 +106,11 @@ class DeviceGuard {
}
// namespace dragon
}
// namespace dragon
#else
#define CUDA_NOT_COMPILED \
LOG(FATAL) << "CUDA was not compiled.";
#endif // WITH_CUDA
#endif // WITH_CUDA
#endif // DRAGON_UTILS_CUDA_DEVICE_H_
#endif // DRAGON_UTILS_CUDA_DEVICE_H_
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment