Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ sdist.include = [
"src/gpubackendtools/cutils/gbt_global.h",
"src/gpubackendtools/cutils/pybind11_cuda_array_interface.hpp",
"src/gpubackendtools/cutils/cmake_functions.cmake",
"src/gpubackendtools/cutils/gbt_binding.hpp"
]
sdist.exclude = [
".devcontainer/",
Expand Down
3 changes: 2 additions & 1 deletion src/gpubackendtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
from .parallelbase import ParallelModuleBase

from .globals import Globals
from .cutils import GBTCpuBackend, GBTCuda11xBackend, GBTCuda12xBackend
from .cutils import GBTCpuBackend, GBTCuda11xBackend, GBTCuda12xBackend, GBTCuda13xBackend

add_backends = {
"gbt_cpu": GBTCpuBackend,
"gbt_cuda11x": GBTCuda11xBackend,
"gbt_cuda12x": GBTCuda12xBackend,
"gbt_cuda13x": GBTCuda13xBackend,
}

Globals().backends_manager.add_backends(add_backends)
Expand Down
35 changes: 34 additions & 1 deletion src/gpubackendtools/cutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import abc
from typing import Optional, Sequence, TypeVar, Union

from ..gpubackendtools import BackendMethods, CpuBackend, Cuda11xBackend, Cuda12xBackend
from ..gpubackendtools import BackendMethods, CpuBackend, Cuda11xBackend, Cuda12xBackend, Cuda13xBackend
from ..exceptions import *

@dataclasses.dataclass
Expand Down Expand Up @@ -126,6 +126,39 @@ def cuda12x_module_loader():
CubicSpline=gbt_backend_cuda12x.interp.CubicSplineGPU,
xp=cupy,
)

class GBTCuda13xBackend(Cuda13xBackend, GBTBackend):
"""Implementation of CUDA 13.x backend"""
_backend_name : str = "gbt_backend_cuda13x"
_name = "gbt_cuda13x"

def __init__(self, *args, **kwargs):
Cuda13xBackend.__init__(self, *args, **kwargs)
GBTBackend.__init__(self, self.cuda13x_module_loader())

@staticmethod
def cuda13x_module_loader():
try:
import gbt_backend_cuda13x.interp

except (ModuleNotFoundError, ImportError) as e:
raise BackendUnavailableException(
"'cuda13x' backend could not be imported."
) from e

try:
import cupy
except (ModuleNotFoundError, ImportError) as e:
raise MissingDependencies(
"'cuda13x' backend requires cupy", pip_deps=["cupy-cuda13x"]
) from e

return GBTBackendMethods(
interpolate_wrap=gbt_backend_cuda13x.interp.interpolate_wrap,
CubicSplineWrap=gbt_backend_cuda13x.interp.CubicSplineWrapGPU,
CubicSpline=gbt_backend_cuda13x.interp.CubicSplineGPU,
xp=cupy,
)

"""List of existing backends, per default order of preference."""
# TODO: __all__ ?
Expand Down