Skip to content

Commit

Permalink
[DOC] Document environment variable for failing on fallback in `cudf.…
Browse files Browse the repository at this point in the history
…pandas` (#16932)

This PR documents the environment variable `CUDF_PANDAS_FAIL_ON_FALLBACK` which causes `cudf.pandas` to raise an error when fallback occurs.

Authors:
  - Matthew Murray (https://github.com/Matt711)

Approvers:
  - Lawrence Mitchell (https://github.com/wence-)

URL: #16932
  • Loading branch information
Matt711 committed Sep 30, 2024
1 parent 9b2f892 commit 04baa22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions docs/cudf/source/developer_guide/cudf_pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,21 @@ Arrays are not almost equal to 7 decimals
ACTUAL: 1.0
DESIRED: 2.0.
```

Setting the environment variable `CUDF_PANDAS_FAIL_ON_FALLBACK` causes `cudf.pandas` to fail when falling back from cuDF to Pandas.
For example,
```python
import cudf.pandas
cudf.pandas.install()
import pandas as pd
import numpy as np

df = pd.DataFrame({
'complex_col': [1 + 2j, 3 + 4j, 5 + 6j]
})

print(df)
```
```
ProxyFallbackError: The operation failed with cuDF, the reason was <class 'NotImplementedError'>: Series with Complex128DType is not supported.
```
2 changes: 1 addition & 1 deletion python/cudf/cudf/pandas/fast_slow_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ def _fast_slow_function_call(
except Exception as err:
if _env_get_bool("CUDF_PANDAS_FAIL_ON_FALLBACK", False):
raise ProxyFallbackError(
f"The operation failed with cuDF, the reason was {type(err)}: {err}."
f"The operation failed with cuDF, the reason was {type(err)}: {err}"
) from err
with nvtx.annotate(
"EXECUTE_SLOW",
Expand Down

0 comments on commit 04baa22

Please sign in to comment.