Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
wenyuanbo
tic
Commits
20ddd2b5
Commit
20ddd2b5
authored
May 15, 2019
by
ghostplant
Committed by
Tianqi Chen
May 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using heavy API to query single attribution (#3179)
parent
605b5e60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
src/codegen/opt/build_cuda_on.cc
+5
-4
src/runtime/cuda/cuda_device_api.cc
+5
-3
No files found.
src/codegen/opt/build_cuda_on.cc
View file @
20ddd2b5
...
...
@@ -84,12 +84,13 @@ std::string NVRTCCompile(const std::string& code, bool include_path = false) {
std
::
vector
<
std
::
string
>
compile_params
;
std
::
vector
<
const
char
*>
param_cstrings
{};
nvrtcProgram
prog
;
cudaDeviceProp
device_prop
;
std
::
string
cc
=
"30"
;
cudaError_t
e
=
cudaGetDeviceProperties
(
&
device_prop
,
0
);
int
major
,
minor
;
cudaError_t
e1
=
cudaDeviceGetAttribute
(
&
major
,
cudaDevAttrComputeCapabilityMajor
,
0
);
cudaError_t
e2
=
cudaDeviceGetAttribute
(
&
minor
,
cudaDevAttrComputeCapabilityMinor
,
0
);
if
(
e
==
cudaSuccess
)
{
cc
=
std
::
to_string
(
device_prop
.
major
)
+
std
::
to_string
(
device_prop
.
minor
);
if
(
e
1
==
cudaSuccess
&&
e2
==
cudaSuccess
)
{
cc
=
std
::
to_string
(
major
)
+
std
::
to_string
(
minor
);
}
else
{
LOG
(
WARNING
)
<<
"cannot detect compute capability from your device, "
<<
"fall back to compute_30."
;
...
...
src/runtime/cuda/cuda_device_api.cc
View file @
20ddd2b5
...
...
@@ -26,6 +26,7 @@
#include <dmlc/thread_local.h>
#include <tvm/runtime/registry.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include "cuda_common.h"
...
...
@@ -73,9 +74,10 @@ class CUDADeviceAPI final : public DeviceAPI {
return
;
}
case
kDeviceName
:
{
cudaDeviceProp
props
;
CUDA_CALL
(
cudaGetDeviceProperties
(
&
props
,
ctx
.
device_id
));
*
rv
=
std
::
string
(
props
.
name
);
std
::
string
name
(
256
,
0
);
CUDA_DRIVER_CALL
(
cuDeviceGetName
(
&
name
[
0
],
name
.
size
(),
ctx
.
device_id
));
name
.
resize
(
strlen
(
name
.
c_str
()));
*
rv
=
std
::
move
(
name
);
return
;
}
case
kMaxClockRate
:
{
...
...
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