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
aede4820
Commit
aede4820
authored
May 16, 2018
by
Tatsuya Nishiyama
Committed by
Tianqi Chen
May 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error during running on nvptx with cuda9 (#1162)
parent
1b14fd19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
11 deletions
+42
-11
python/tvm/contrib/nvcc.py
+42
-11
No files found.
python/tvm/contrib/nvcc.py
View file @
aede4820
...
...
@@ -104,6 +104,28 @@ def find_cuda_path():
raise
RuntimeError
(
"Cannot find cuda path"
)
def
get_cuda_version
(
cuda_path
):
"""Utility function to get cuda version
Parameters
----------
cuda_path : str
Path to cuda root.
Returns
-------
version : float
The cuda version
"""
version_file_path
=
os
.
path
.
join
(
cuda_path
,
"version.txt"
)
try
:
with
open
(
version_file_path
)
as
f
:
version_str
=
f
.
readline
()
.
replace
(
'
\n
'
,
''
)
.
replace
(
'
\r
'
,
''
)
return
float
(
version_str
.
split
(
" "
)[
2
][:
2
])
except
:
raise
RuntimeError
(
"Cannot read cuda version file"
)
@register_func
(
"tvm_callback_libdevice_path"
)
def
find_libdevice_path
(
arch
):
"""Utility function to find libdevice
...
...
@@ -112,22 +134,31 @@ def find_libdevice_path(arch):
----------
arch : int
The compute architecture in int
Returns
-------
path : str
Path to libdevice.
"""
cuda_path
=
find_cuda_path
()
lib_path
=
os
.
path
.
join
(
cuda_path
,
"nvvm/libdevice"
)
selected_ver
=
0
selected_path
=
None
for
fn
in
os
.
listdir
(
lib_path
):
if
not
fn
.
startswith
(
"libdevice"
):
continue
ver
=
int
(
fn
.
split
(
"."
)[
-
3
]
.
split
(
"_"
)[
-
1
])
if
ver
>
selected_ver
and
ver
<=
arch
:
selected_ver
=
ver
selected_path
=
fn
if
selected_path
is
None
:
raise
RuntimeError
(
"Cannot find libdevice for arch {}"
.
format
(
arch
))
return
os
.
path
.
join
(
lib_path
,
selected_path
)
cuda_ver
=
get_cuda_version
(
cuda_path
)
if
cuda_ver
==
9.0
or
cuda_ver
==
9.1
:
path
=
os
.
path
.
join
(
lib_path
,
"libdevice.10.bc"
)
else
:
for
fn
in
os
.
listdir
(
lib_path
):
if
not
fn
.
startswith
(
"libdevice"
):
continue
ver
=
int
(
fn
.
split
(
"."
)[
-
3
]
.
split
(
"_"
)[
-
1
])
if
ver
>
selected_ver
and
ver
<=
arch
:
selected_ver
=
ver
selected_path
=
fn
if
selected_path
is
None
:
raise
RuntimeError
(
"Cannot find libdevice for arch {}"
.
format
(
arch
))
path
=
os
.
path
.
join
(
lib_path
,
selected_path
)
return
path
def
callback_libdevice_path
(
arch
):
...
...
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