Skip to content

Commit

Permalink
Add wrappers.durations/timestamps namespace to pylibcudf
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Oct 8, 2024
1 parent 2d02bdc commit 5c2fac8
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 6 deletions.
4 changes: 2 additions & 2 deletions python/cudf/cudf/_lib/scalar.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ from pylibcudf.libcudf.scalar.scalar cimport (
struct_scalar,
timestamp_scalar,
)
from pylibcudf.libcudf.wrappers.durations cimport (
from pylibcudf.wrappers.durations cimport (
duration_ms,
duration_ns,
duration_s,
duration_us,
)
from pylibcudf.libcudf.wrappers.timestamps cimport (
from pylibcudf.wrappers.timestamps cimport (
timestamp_ms,
timestamp_ns,
timestamp_s,
Expand Down
1 change: 1 addition & 0 deletions python/pylibcudf/pylibcudf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ add_subdirectory(libcudf)
add_subdirectory(strings)
add_subdirectory(io)
add_subdirectory(nvtext)
add_subdirectory(wrappers)
2 changes: 2 additions & 0 deletions python/pylibcudf/pylibcudf/__init__.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ from . cimport (
transpose,
types,
unary,
wrappers,
)
from .column cimport Column
from .gpumemoryview cimport gpumemoryview
Expand Down Expand Up @@ -79,5 +80,6 @@ __all__ = [
"transpose",
"types",
"unary",
"wrappers",
"nvtext",
]
7 changes: 5 additions & 2 deletions python/pylibcudf/pylibcudf/libcudf/wrappers/durations.pxd
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Copyright (c) 2020, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

from libc.stdint cimport int64_t
from libc.stdint cimport int32_t, int64_t


cdef extern from "cudf/wrappers/durations.hpp" namespace "cudf" nogil:
ctypedef int32_t duration_D
ctypedef int32_t duration_h
ctypedef int32_t duration_m
ctypedef int64_t duration_s
ctypedef int64_t duration_ms
ctypedef int64_t duration_us
Expand Down
7 changes: 5 additions & 2 deletions python/pylibcudf/pylibcudf/libcudf/wrappers/timestamps.pxd
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Copyright (c) 2020, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

from libc.stdint cimport int64_t
from libc.stdint cimport int32_t, int64_t


cdef extern from "cudf/wrappers/timestamps.hpp" namespace "cudf" nogil:
ctypedef int32_t timestamp_D
ctypedef int32_t timestamp_h
ctypedef int32_t timestamp_m
ctypedef int64_t timestamp_s
ctypedef int64_t timestamp_ms
ctypedef int64_t timestamp_us
Expand Down
22 changes: 22 additions & 0 deletions python/pylibcudf/pylibcudf/wrappers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# =============================================================================
# Copyright (c) 2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
# =============================================================================

set(cython_sources)

set(linked_libraries cudf::cudf)
rapids_cython_create_modules(
CXX
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" MODULE_PREFIX pylibcudf_wrappers_ ASSOCIATED_TARGETS cudf
)
3 changes: 3 additions & 0 deletions python/pylibcudf/pylibcudf/wrappers/__init__.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

from . cimport timestamps
1 change: 1 addition & 0 deletions python/pylibcudf/pylibcudf/wrappers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Copyright (c) 2024, NVIDIA CORPORATION.
11 changes: 11 additions & 0 deletions python/pylibcudf/pylibcudf/wrappers/durations.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

from pylibcudf.libcudf.wrappers.durations cimport (
duration_D,
duration_h,
duration_m,
duration_ms,
duration_ns,
duration_s,
duration_us,
)
11 changes: 11 additions & 0 deletions python/pylibcudf/pylibcudf/wrappers/timestamps.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

from pylibcudf.libcudf.wrappers.timestamps cimport (
timestamp_D,
timestamp_h,
timestamp_m,
timestamp_ms,
timestamp_ns,
timestamp_s,
timestamp_us,
)

0 comments on commit 5c2fac8

Please sign in to comment.