Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (NOT SKBUILD)
in your environment once and use the following command that avoids
a costly creation of a new virtual environment at every compilation:
=====================================================================
pip install nanobind scikit-build-core[pyproject]
pip install 'nanobind>=3.0.1,<4' scikit-build-core[pyproject]
pip install --no-build-isolation -ve .
=====================================================================
You may optionally add -Ceditable.rebuild=true to auto-rebuild when
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ install-python-dep: ## Installs the Python dependencies
compile: check-system-dep ## Compiles the CUDA extension with nanobind
@echo "Compiling CUDA extension with nanobind..."
@echo "If you get an scikit-build-core error, you may need to 'uv cache clean' and 'trash build/'"
uv pip install scikit-build-core nanobind ninja cmake
uv pip install scikit-build-core 'nanobind>=3.0.1,<4' ninja cmake
uv sync --group build
# Not sure if the pip command is also needed
uv pip install -ve . --no-build-isolation
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["scikit-build-core>=0.10", "nanobind>=2.7"]
requires = ["scikit-build-core>=0.10", "nanobind>=3.0.1,<4"]
build-backend = "scikit_build_core.build"

[project]
Expand Down Expand Up @@ -89,7 +89,7 @@ profile = [
]
build = [
"scikit-build-core>=0.10",
"nanobind>=2.7",
"nanobind>=3.0.1,<4",
"cmake >=3.26.4",
"ninja >=1.11.1",
]
Expand Down Expand Up @@ -212,6 +212,7 @@ preview = true
[tool.pytest.ini_options]
filterwarnings = [
"error", # make warnings errors
"ignore:.*No NVIDIA driver was found.*:RuntimeWarning",
"ignore:.*This will add latency due to CPU<->GPU memory transfers.*:UserWarning",
# vbeam warnings
"ignore:point_position will be overwritten by the scan.:UserWarning",
Expand All @@ -236,7 +237,7 @@ build = [
# build-requires explicitly.
# because cibuildwheel uses Docker, we also need to use --system
before-build = [
"uv pip install --system scikit-build-core>=0.10 nanobind>=2.7 ninja"
"uv pip install --system 'scikit-build-core>=0.10' 'nanobind>=3.0.1,<4' ninja"
]
# Need --no-isolation to find nvcc
build-frontend = { name = "build[uv]", args = ["--no-isolation"] }
Expand Down
22 changes: 16 additions & 6 deletions src/mach/kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,20 @@ static __device__ __forceinline__ float tukey_apod_weight(float r_norm, float al
* @brief Check CUDA driver compatibility and warn if incompatible
*
* This function checks if the installed CUDA driver is compatible with the
* NVCC version used to compile this module. Issues a warning if incompatible.
* NVCC version used to compile this module. Issues a warning if no driver is
* found or if the driver is incompatible.
*/
static void checkCudaDriverCompatibility() {
int driverVersion = 0;

// Get driver version - if this fails, let later CUDA operations handle the error
if (cudaDriverGetVersion(&driverVersion) != cudaSuccess) {
PyErr_WarnEx(PyExc_RuntimeWarning, "Could not get CUDA driver version", 1);
if (cudaDriverGetVersion(&driverVersion) != cudaSuccess || driverVersion == 0) {
// cudaDriverGetVersion reports 0 when no driver is installed
if (PyErr_WarnEx(
PyExc_RuntimeWarning,
"[mach] No NVIDIA driver was found. CUDA beamforming is unavailable.",
1) < 0) {
throw nb::python_error();
}
return;
}

Expand All @@ -384,7 +390,9 @@ static void checkCudaDriverCompatibility() {
"→ Please update your NVIDIA driver to version " +
std::to_string(nvccMajor) + "." + std::to_string(nvccMinor) + " or newer.";

PyErr_WarnEx(PyExc_RuntimeWarning, warning_msg.c_str(), 1);
if (PyErr_WarnEx(PyExc_RuntimeWarning, warning_msg.c_str(), 1) < 0) {
throw nb::python_error();
}
}

/**
Expand Down Expand Up @@ -418,7 +426,9 @@ static void checkComputeCapability() {
std::to_string(MIN_CC_MAJOR) + "." + std::to_string(MIN_CC_MINOR) +
". Kernels may fail to load.";

PyErr_WarnEx(PyExc_RuntimeWarning, warning_msg.c_str(), 1);
if (PyErr_WarnEx(PyExc_RuntimeWarning, warning_msg.c_str(), 1) < 0) {
throw nb::python_error();
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading