Skip to content

Commit

Permalink
add warning
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Feb 22, 2021
1 parent 720d0ee commit 607f2d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/tvm/contrib/thrust.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@
# under the License.
"""Utilities for thrust"""
from tvm._ffi import get_global_func
import logging


def maybe_warn(target, func_name):
if get_global_func(func_name, allow_missing=True) and not "thrust" in target.libs:
logging.warning("TVM is built with thrust but thrust is not used.")
if "thrust" in target.libs and get_global_func(func_name, allow_missing=True) is None:
logging.warning("thrust is requested but TVM is not built with thrust.")


def can_use_thrust(target, func_name):
maybe_warn(target, func_name)
return (
target.kind.name in ["cuda", "nvptx"]
and "thrust" in target.libs
Expand All @@ -27,6 +36,7 @@ def can_use_thrust(target, func_name):


def can_use_rocthrust(target, func_name):
maybe_warn(target, func_name)
return (
target.kind.name == "rocm"
and "thrust" in target.libs
Expand Down

0 comments on commit 607f2d5

Please sign in to comment.