Skip to content

Commit 6cb2147

Browse files
fix: NVCC 11.4.0 - 11.8.0 host bug workaround (#4220)
* Work-Around: NVCC 11.4.0 - 11.8.0 Adds a targeted NVCC work around for limited number of CUDA releases. Fixed in NVCC development. * style: pre-commit fixes * CI: Bump CTK Version 11.2 -> 11.7 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 864ed11 commit 6cb2147

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ jobs:
324324
# Testing NVCC; forces sources to behave like .cu files
325325
cuda:
326326
runs-on: ubuntu-latest
327-
name: "🐍 3.8 • CUDA 11.2 • Ubuntu 20.04"
328-
container: nvidia/cuda:11.2.2-devel-ubuntu20.04
327+
name: "🐍 3.10 • CUDA 11.7 • Ubuntu 22.04"
328+
container: nvidia/cuda:11.7.0-devel-ubuntu22.04
329329

330330
steps:
331331
- uses: actions/checkout@v3

include/pybind11/pybind11.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,22 @@ class class_ : public detail::generic_type {
15781578
return *this;
15791579
}
15801580

1581+
// Nvidia's NVCC is broken between 11.4.0 and 11.8.0
1582+
// https://github.com/pybind/pybind11/issues/4193
1583+
#if defined(__CUDACC__) && (__CUDACC_VER_MAJOR__ == 11) && (__CUDACC_VER_MINOR__ >= 4) \
1584+
&& (__CUDACC_VER_MINOR__ <= 8)
1585+
template <typename T, typename... Extra>
1586+
class_ &def(const T &op, const Extra &...extra) {
1587+
op.execute(*this, extra...);
1588+
return *this;
1589+
}
1590+
1591+
template <typename T, typename... Extra>
1592+
class_ &def_cast(const T &op, const Extra &...extra) {
1593+
op.execute_cast(*this, extra...);
1594+
return *this;
1595+
}
1596+
#else
15811597
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
15821598
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
15831599
op.execute(*this, extra...);
@@ -1589,6 +1605,7 @@ class class_ : public detail::generic_type {
15891605
op.execute_cast(*this, extra...);
15901606
return *this;
15911607
}
1608+
#endif
15921609

15931610
template <typename... Args, typename... Extra>
15941611
class_ &def(const detail::initimpl::constructor<Args...> &init, const Extra &...extra) {

0 commit comments

Comments
 (0)