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] Add GPU and CUDA validations #4692

Merged
merged 31 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5961872
add GPU support, runtime & driver checks
galipremsagar Mar 25, 2020
e92c6b5
Update python/cudf/cudf/__init__.py
galipremsagar Mar 25, 2020
91baa1c
Merge remote-tracking branch 'upstream/branch-0.14' into init_check
galipremsagar Mar 25, 2020
9617fb9
change error message to provide driver versions and url to compatibil…
galipremsagar Mar 25, 2020
0709532
modify error text
galipremsagar Mar 25, 2020
a61ab8e
Update python/cudf/cudf/__init__.py
galipremsagar Mar 25, 2020
d1f1717
add cpp apis and cython/python bridge
galipremsagar Mar 26, 2020
44de100
Merge branch 'init_check' of https://github.com/galipremsagar/cudf in…
galipremsagar Mar 26, 2020
bc55a75
Update CHANGELOG.md
galipremsagar Mar 26, 2020
2be6ea3
Merge branch 'branch-0.14' into init_check
galipremsagar Mar 26, 2020
8d1482b
Update python/cudf/cudf/utils/gpu_utils.py
galipremsagar Mar 26, 2020
2e05d96
create a new module _cuda to keep all cuda related apis
galipremsagar Mar 27, 2020
e4c3288
remove cpp file
galipremsagar Mar 27, 2020
fe75c23
Merge remote-tracking branch 'upstream/branch-0.14' into init_check
galipremsagar Mar 31, 2020
7272afc
Apply suggestions from code review
galipremsagar Mar 31, 2020
04826a1
Merge branch 'init_check' of https://github.com/galipremsagar/cudf in…
galipremsagar Mar 31, 2020
0d9c6bb
Merge branch 'branch-0.14' into init_check
galipremsagar Mar 31, 2020
e6add1e
Merge branch 'init_check' of https://github.com/galipremsagar/cudf in…
galipremsagar Mar 31, 2020
7c8cb5b
remove except + for c apis
galipremsagar Mar 31, 2020
6818152
add param types in docs
galipremsagar Apr 1, 2020
6ac3a93
add getDeviceProperties api
galipremsagar Apr 1, 2020
5171b0e
do inline skip of isort
galipremsagar Apr 1, 2020
7d6dcc8
Merge remote-tracking branch 'upstream/branch-0.14' into init_check
galipremsagar Apr 1, 2020
79854f4
Merge remote-tracking branch 'upstream/branch-0.14' into init_check
galipremsagar Apr 1, 2020
0643e71
add error handling
galipremsagar Apr 1, 2020
3a7ab8c
add docs
galipremsagar Apr 1, 2020
012a6de
print the detected cuda runtime version
galipremsagar Apr 1, 2020
6032e64
Apply suggestions from code review
galipremsagar Apr 2, 2020
b0bb113
fetching only the properties required instead of queries all props of…
galipremsagar Apr 2, 2020
8f8fd5c
Merge branch 'init_check' of https://github.com/galipremsagar/cudf in…
galipremsagar Apr 2, 2020
2e23210
Update python/cudf/cudf/_cuda/gpu.pxd
galipremsagar Apr 2, 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
1 change: 1 addition & 0 deletions python/cudf/cudf/_cuda/gpu.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,6 @@ cdef extern from "cuda_runtime_api.h" nogil:

const char* cudaGetErrorName(cudaError_t error)
const char* cudaGetErrorString(cudaError_t error)
int cuDeviceGetName(char* name, int len, int device)
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

ctypedef int underlying_type_attribute
24 changes: 23 additions & 1 deletion python/cudf/cudf/_cuda/gpu.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ from cudf._cuda.gpu cimport (
cudaDeviceProp,
cudaGetErrorName,
cudaGetErrorString,
cudaError_t
cudaError_t,
cuDeviceGetName
)
from enum import IntEnum
from libc.stdlib cimport malloc
from cudf._cuda.gpu cimport underlying_type_attribute as c_attr


Expand Down Expand Up @@ -323,3 +325,23 @@ def getDeviceProperties(int device):
if status != 0:
raise CUDARuntimeError(status)
return prop


def deviceGetName(int device):
"""
Returns an identifer string for the device.

Parameters
----------
device : int
Device number to query

This function automatically raises CUDARuntimeError with error message
and status code.
"""

cdef char* device_name = <char*> malloc(256 * sizeof(char))
status = cuDeviceGetName(device_name, 256, device)
if status != 0:
raise CUDARuntimeError(status)
return device_name
13 changes: 8 additions & 5 deletions python/cudf/cudf/utils/gpu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def validate_setup():
runtimeGetVersion,
getDeviceAttribute,
CudaDeviceAttr,
getDeviceProperties,
CUDARuntimeError,
deviceGetName,
)
import warnings

Expand Down Expand Up @@ -37,15 +37,18 @@ def validate_setup():
# Fermi 2.x
pass
else:
device_props = getDeviceProperties(0)
device_name = deviceGetName(0)
minor_version = getDeviceAttribute(
CudaDeviceAttr.cudaDevAttrComputeCapabilityMinor, 0
)
warnings.warn(
"You will need a GPU with NVIDIA Pascal™ architecture or \
better\n"
"Detected GPU 0 : " + str(device_props["name"].decode()) + "\n"
"Detected GPU 0 : " + str(device_name.decode()) + "\n"
"Detected Compute Capability : "
+ str(device_props["major"])
+ str(major_version)
+ "."
+ str(device_props["minor"])
+ str(minor_version)
)

cuda_runtime_version = runtimeGetVersion()
Expand Down