viiccwen commented on code in PR #943: URL: https://github.com/apache/mahout/pull/943#discussion_r2725610231
########## Makefile: ########## @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Detect NVIDIA GPU +HAS_NVIDIA := $(shell command -v nvidia-smi >/dev/null 2>&1 && echo yes || echo no) Review Comment: Checking only for `nvidia-smi` in `PATH` can give false positives in CI/containers. Consider also verifying that nvidia-smi can actually enumerate GPUs (e.g. via `nvidia-smi -L`). ########## Makefile: ########## @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Detect NVIDIA GPU +HAS_NVIDIA := $(shell command -v nvidia-smi >/dev/null 2>&1 && echo yes || echo no) + +test_rust: +ifeq ($(HAS_NVIDIA),yes) + cd qdp && cargo test +else + @echo "No NVIDIA GPU detected, skipping test_rust" +endif + +test_python: + uv sync --group dev +ifeq ($(HAS_NVIDIA),yes) + unset CONDA_PREFIX && uv run --active maturin develop --manifest-path qdp/qdp-python/Cargo.toml +else + @echo "No NVIDIA GPU detected, skipping maturin develop" Review Comment: Add prefix would be better. ```bash @echo "[SKIP] No NVIDIA GPU detected, skipping maturin develop" ``` ########## Makefile: ########## Review Comment: may need to add `.PHONY` ```makefile .PHONY: test_rust test_python tests pre-commit ``` ########## Makefile: ########## @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Detect NVIDIA GPU +HAS_NVIDIA := $(shell command -v nvidia-smi >/dev/null 2>&1 && echo yes || echo no) + +test_rust: +ifeq ($(HAS_NVIDIA),yes) + cd qdp && cargo test +else + @echo "No NVIDIA GPU detected, skipping test_rust" Review Comment: Add prefix would be better. ```bash @echo "[SKIP] No NVIDIA GPU detected, skipping test_rust" ``` ########## Makefile: ########## @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Detect NVIDIA GPU +HAS_NVIDIA := $(shell command -v nvidia-smi >/dev/null 2>&1 && echo yes || echo no) + +test_rust: +ifeq ($(HAS_NVIDIA),yes) + cd qdp && cargo test +else + @echo "No NVIDIA GPU detected, skipping test_rust" +endif + +test_python: + uv sync --group dev Review Comment: separate `uv sync --group dev` into single cmd `setup`, then call it in `test_python`, `pre-commit`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
