Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW][FEA] Port nvtx.pyx to use non-legacy libcudf APIs #4235

Merged
merged 45 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bc16dc8
initial commit for libcudf++ nvtx.pyx
Feb 22, 2020
3afc2a6
initial commit for libcudf++ nvtx.pyx
Feb 22, 2020
cf409c7
style fix and CHANGELOG
Feb 22, 2020
f24d6a4
initial commit for libcudf++ nvtx.pyx
Feb 22, 2020
eb2cbfb
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Feb 26, 2020
a622c3a
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Feb 27, 2020
031f347
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Mar 5, 2020
92cdee2
correct enum handling for nvtx
Mar 5, 2020
eac8fcd
style check
Mar 5, 2020
9a37846
uncommenting special color references
Mar 5, 2020
fe4c688
addressing some of the comments on the PR
Mar 5, 2020
28207e2
style fix
Mar 5, 2020
3e72f38
fumblight through typecasting
Mar 10, 2020
264a45b
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Mar 11, 2020
a0355b6
still fumbling through Enum types for nvtx
Mar 11, 2020
c508a62
More fumbling with nvtx enums
Mar 11, 2020
cad9ea1
nvtx libcudf++ solution
Mar 11, 2020
b8c275d
style fix
Mar 11, 2020
210cecb
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Mar 11, 2020
716370e
adding custom hex support for nvtx
Mar 11, 2020
238e07f
style fix
Mar 11, 2020
a4a9540
style fix
Mar 11, 2020
39c0dcb
updated all instances of python nvtx to use libcudf++ nvtx
Mar 11, 2020
56952f1
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Mar 11, 2020
8ee8954
style fixes
Mar 11, 2020
99e6a3c
hidden legacy nvtx.range_pop
Mar 11, 2020
b895537
Update python/cudf/cudf/_libxx/nvtx.pyx
millerhooks Mar 12, 2020
90c05eb
Update python/cudf/cudf/_libxx/cpp/nvtx.pxd
millerhooks Mar 12, 2020
4beaa06
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Mar 12, 2020
4e3b0d1
moving nvtx utils
Mar 12, 2020
1876d6f
added utilities init.py.
Mar 12, 2020
91621b4
Merge branch 'branch-0.13' into fea-cython-nvtx
millerhooks Mar 12, 2020
b8c1b8e
Update python/cudf/cudf/_libxx/nvtx.pyx
millerhooks Mar 12, 2020
f4f0b4e
nvtx name encoding safety
Mar 12, 2020
b57ff3e
Merge branch 'fea-cython-nvtx' of github.com:millerhooks/cudf into fe…
Mar 12, 2020
52f34db
Merge branch 'branch-0.13' of https://github.com/rapidsai/cudf into f…
Mar 12, 2020
645e88c
style fix
Mar 12, 2020
d0b7f50
utilities directory nvtx file organization
Mar 12, 2020
242dbb9
copyright 2020
Mar 12, 2020
5091225
Update python/cudf/cudf/_libxx/cpp/utilities/nvtx_utils.pxd
millerhooks Mar 13, 2020
edfb90f
Merge branch 'branch-0.13' into fea-cython-nvtx
kkraus14 Mar 17, 2020
366ab78
fix location of underlying type definition
kkraus14 Mar 17, 2020
d36de09
style
kkraus14 Mar 17, 2020
195e544
remove unused utilities from init
kkraus14 Mar 17, 2020
5e7b079
fix bad imports
kkraus14 Mar 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions python/cudf/cudf/_libxx/cpp/nvtx.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from libc.stdint cimport uint32_t

ctypedef uint32_t underlying_type_t_color

cdef extern from "cudf/utilities/nvtx_utils.hpp" namespace "cudf::nvtx" nogil:
ctypedef enum _color 'color':
ctypedef enum color_type 'color':
GREEN 'cudf::nvtx::color::GREEN'
BLUE 'cudf::nvtx::color::BLUE'
YELLOW 'cudf::nvtx::color::YELLOW'
Expand All @@ -14,14 +16,14 @@ cdef extern from "cudf/utilities/nvtx_utils.hpp" namespace "cudf::nvtx" nogil:
DARK_GREEN 'cudf::nvtx::color::DARK_GREEN'
ORANGE 'cudf::nvtx::color::ORANGE'

_color JOIN_COLOR 'cudf::nvtx::JOIN_COLOR'
_color GROUP_COLOR 'cudf::nvtx::GROUP_COLOR'
_color BINARY_OP_COLOR 'cudf::nvtx::BINARY_OP_COLOR'
_color PARTITION_COLOR 'cudf::nvtx::PARTITION_COLOR'
_color READ_CSV_COLOR 'cudf::nvtx::READ_CSV_COLOR'
color_type JOIN_COLOR 'cudf::nvtx::JOIN_COLOR'
color_type GROUP_COLOR 'cudf::nvtx::GROUP_COLOR'
color_type BINARY_OP_COLOR 'cudf::nvtx::BINARY_OP_COLOR'
color_type PARTITION_COLOR 'cudf::nvtx::PARTITION_COLOR'
color_type READ_CSV_COLOR 'cudf::nvtx::READ_CSV_COLOR'

cdef void range_push(
const char* const name, _color color
const char* const name, color_type color
) except +

cdef void range_push_hex(
Expand Down
45 changes: 17 additions & 28 deletions python/cudf/cudf/_libxx/nvtx.pyx
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from enum import IntEnum
from libc.stdint cimport uint32_t

from cudf._libxx.cpp.nvtx cimport (
range_push as cpp_range_push,
range_push_hex as cpp_range_push_hex,
range_pop as cpp_range_pop,

_color as nvtx_color,
color_type,
underlying_type_t_color

)

class Color(IntEnum):
GREEN = <underlying_type_t_color> color_type.GREEN
BLUE = <underlying_type_t_color> color_type.BLUE
YELLOW = <underlying_type_t_color> color_type.YELLOW
PURPLE = <underlying_type_t_color> color_type.PURPLE
CYAN = <underlying_type_t_color> color_type.CYAN
RED = <underlying_type_t_color> color_type.RED
WHITE = <underlying_type_t_color> color_type.WHITE
DARK_GREEN = <underlying_type_t_color> color_type.DARK_GREEN
ORANGE = <underlying_type_t_color> color_type.ORANGE

def range_push(object name, object color='green'):
"""
Expand All @@ -25,38 +38,14 @@ def range_push(object name, object color='green'):
"""
cdef const char* _name = name
cdef uint32_t _color = color
cdef color_type _Color = Color[color]
try:
_color = int(_color, 16)
with nogil:
cpp_range_push_hex(_name, _color)
except ValueError:
if color == 'green':
with nogil:
cpp_range_push(_name, nvtx_color.GREEN)
elif color == 'blue':
with nogil:
cpp_range_push(_name, nvtx_color.BLUE)
elif color == 'yellow':
with nogil:
cpp_range_push(_name, nvtx_color.YELLOW)
elif color == 'purple':
with nogil:
cpp_range_push(_name, nvtx_color.PURPLE)
elif color == 'cyan':
with nogil:
cpp_range_push(_name, nvtx_color.CYAN)
elif color == 'red':
with nogil:
cpp_range_push(_name, nvtx_color.RED)
elif color == 'white':
with nogil:
cpp_range_push(_name, nvtx_color.WHITE)
elif color == 'darkgreen':
with nogil:
cpp_range_push(_name, nvtx_color.DARK_GREEN)
elif color == 'orange':
with nogil:
cpp_range_push(_name, nvtx_color.ORANGE)
with nogil:
cpp_range_push(_name, _Color)


def range_pop():
Expand Down