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

Static link CUDA Runtime #7954

Merged
merged 25 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift click to select a range
c3b276c
implement runtime._getCUDAMajorVersion()
kmaehashi Oct 21, 2023
0922be2
remove or replace runtime.runtimeGetVersion()
kmaehashi Oct 21, 2023
9669e60
fix unused import
kmaehashi Oct 21, 2023
4055338
static link CUDA Runtime
kmaehashi Oct 21, 2023
75465c8
merge profiler module to runtime
kmaehashi Oct 21, 2023
3d29eb4
remove use of profiler module
kmaehashi Oct 13, 2023
4cd14a6
update profile module for backward compatibility
kmaehashi Oct 13, 2023
7b4cece
update docs
kmaehashi Oct 13, 2023
1629883
static link CUDA Runtime in Jitify, cuRAND, Thrust
kmaehashi Oct 21, 2023
841af9e
lazy import Jitify
kmaehashi Oct 13, 2023
7328623
flake8
kmaehashi Oct 21, 2023
385fce3
fix libraries list
kmaehashi Oct 21, 2023
96e37c4
fix HIP translation
kmaehashi Oct 22, 2023
ca5adb8
fix jitify import
kmaehashi Oct 22, 2023
e89e35a
check CUDA header version in cupyx.jit
kmaehashi Oct 22, 2023
3220581
fix mock
kmaehashi Oct 22, 2023
c6122f5
Merge remote-tracking branch 'upstream/main' into static-link-cudart
kmaehashi Nov 8, 2023
841eff7
implement `cupy.cuda.get_local_runtime_version()`
kmaehashi Nov 8, 2023
c693e7a
update tests
kmaehashi Nov 8, 2023
7a4a4bb
Revert "check CUDA header version in cupyx.jit"
kmaehashi Nov 8, 2023
e3f5873
use _getLocalRuntimeVersion instead
kmaehashi Nov 8, 2023
c9f5090
add docs
kmaehashi Nov 8, 2023
3b7b901
fix docs
kmaehashi Nov 8, 2023
1f8f7a0
avoid using getLocalRuntimeVersion from CUDA Python
kmaehashi Nov 10, 2023
aecccf6
use softlink for runtime regardless of CUDA Python mode
kmaehashi Nov 13, 2023
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
Prev Previous commit
Next Next commit
merge profiler module to runtime
  • Loading branch information
kmaehashi committed Oct 21, 2023
commit 75465c8a48a8ebc25d5f82c49cc266fbc26b8872
7 changes: 7 additions & 0 deletions cupy_backends/cuda/api/_runtime_extern.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 152,7 @@ cdef extern from '../../cupy_backend_runtime.h' nogil:
int cudaGraphLaunch(GraphExec, driver.Stream)
int cudaGraphUpload(GraphExec, driver.Stream)

# Constants
int cudaDevAttrComputeCapabilityMajor
int cudaDevAttrComputeCapabilityMinor

Expand All @@ -161,3 162,9 @@ cdef extern from '../../cupy_backend_runtime.h' nogil:
int cudaErrorPeerAccessAlreadyEnabled
int cudaErrorContextIsDestroyed
int cudaErrorInvalidResourceHandle


cdef extern from '../../cupy_profiler.h' nogil:
# Profiler
int cudaProfilerStart()
int cudaProfilerStop()
8 changes: 8 additions & 0 deletions cupy_backends/cuda/api/runtime.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 320,11 @@ cpdef graphExecDestroy(intptr_t graphExec)
cpdef intptr_t graphInstantiate(intptr_t graph) except? 0
cpdef graphLaunch(intptr_t graphExec, intptr_t stream)
cpdef graphUpload(intptr_t graphExec, intptr_t stream)


##############################################################################
# Profiler
##############################################################################

cpdef profilerStart()
cpdef profilerStop()
28 changes: 28 additions & 0 deletions cupy_backends/cuda/api/runtime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1078,3 1078,31 @@ cpdef graphUpload(intptr_t graphExec, intptr_t stream):
with nogil:
status = cudaGraphUpload(<GraphExec>(graphExec), <driver.Stream>stream)
check_status(status)


##############################################################################
# Profiler
##############################################################################

cpdef profilerStart():
"""Enable profiling.

A user can enable CUDA profiling. When an error occurs, it raises an
exception.

See the CUDA document for detail.
"""
status = cudaProfilerStart()
check_status(status)


cpdef profilerStop():
"""Disable profiling.

A user can disable CUDA profiling. When an error occurs, it raises an
exception.

See the CUDA document for detail.
"""
status = cudaProfilerStop()
check_status(status)
11 changes: 0 additions & 11 deletions cupy_backends/cuda/cupy_cuda_profiler_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 4,4 @@
#include <cuda.h>
#include <cuda_profiler_api.h>

#if CUDA_VERSION >= 12000
// Functions removed in CUDA 12.0

enum cudaOutputMode_t {};

cudaError_t cudaProfilerInitialize(...) {
return cudaErrorUnknown;
}

#endif // #if CUDA_VERSION >= 12

#endif // #ifndef INCLUDE_GUARD_CUDA_CUPY_PROFILER_H
11 changes: 0 additions & 11 deletions cupy_backends/cuda/libs/profiler.pxd

This file was deleted.

70 changes: 0 additions & 70 deletions cupy_backends/cuda/libs/profiler.pyx

This file was deleted.

9 changes: 9 additions & 0 deletions cupy_backends/hip/cupy_hip_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 516,15 @@ cudaError_t cudaGraphUpload(...) {
return hipErrorUnknown;
}

// Profiler
cudaError_t cudaProfilerStart() {
return hipProfilerStart();
}

cudaError_t cudaProfilerStop() {
return hipProfilerStop();
}

} // extern "C"

#endif // #ifndef INCLUDE_GUARD_HIP_CUPY_RUNTIME_H
4 changes: 0 additions & 4 deletions cupy_backends/hip/cupy_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 7,6 @@ extern "C" {

typedef enum {} cudaOutputMode_t;

cudaError_t cudaProfilerInitialize(...) {
return cudaSuccess;
}

cudaError_t cudaProfilerStart() {
return hipProfilerStart();
}
Expand Down
6 changes: 0 additions & 6 deletions cupy_backends/stub/cupy_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 7,6 @@

extern "C" {

typedef enum {} cudaOutputMode_t;

cudaError_t cudaProfilerInitialize(...) {
return cudaSuccess;
}

cudaError_t cudaProfilerStart() {
return cudaSuccess;
}
Expand Down
3 changes: 0 additions & 3 deletions install/cupy_builder/_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 100,6 @@ def _from_dict(d: Dict[str, Any], ctx: Context) -> Feature:
'cupy_backends.cuda.libs.curand',
'cupy_backends.cuda.libs.cusparse',
'cupy_backends.cuda.libs.nvrtc',
'cupy_backends.cuda.libs.profiler',
'cupy_backends.cuda.stream',
'cupy_backends.cuda._softlink',
'cupy._core._accelerator',
Expand Down Expand Up @@ -462,8 461,6 @@ def __init__(self, ctx: Context):
'curand.h',
'cusparse.h',
]
# TODO(kmaehashi): Split profiler module so that dependency to
# `cudart` can be removed when using CUDA Python.
self.libraries = (
# CUDA Driver
([] if ctx.use_cuda_python else ['cuda'])
Expand Down