diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2025-07-03 13:41:36 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2025-07-03 13:49:18 -0400 |
| commit | 85c0b374fefa5bc8a5c3036ab79ba3df78fa71d2 (patch) | |
| tree | 0f0958b307d1d354ad02832a6244aa3fd3882c32 /Makefile | |
| parent | 9b4b4f71fd843c3ec97ca6f55935675e62ca31f5 (diff) | |
Support installation on Linux4Tegraecrts25-ae
- Use alternate path if nvidia-cuda-mps-control is not found.
- Work-around missing CUDA_MPS_PIPE_DIRECTORY default in L4T.
- Install to L4T-specific paths if they exist.
Note that CUDA_MPS_PIPE_DIRECTORY must be manually set by the user
on L4T systems before they can call nvidia-cuda-mps-control, or to
have to have non-nvtaskset-launched applications run with MPS.
Tested on Jetson AGX Orin with L4T 36.3.0 and cuda-compat-12-6.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 39 |
1 files changed, 26 insertions, 13 deletions
| @@ -71,22 +71,35 @@ clean: | |||
| 71 | libsmctrl_test_next_mask libsmctrl_test_next_mask_override \ | 71 | libsmctrl_test_next_mask libsmctrl_test_next_mask_override \ |
| 72 | nvtaskset libcuda.so.1 | 72 | nvtaskset libcuda.so.1 |
| 73 | 73 | ||
| 74 | # On L4T (Linux4Tegra), the paths are different, and there may be multiple copies of libcuda.so.1 | ||
| 74 | install: libcuda.so.1 | 75 | install: libcuda.so.1 |
| 75 | @# Check that CUDA is installed first | 76 | @set -e -x; \ |
| 76 | test -f /usr/lib/$(ARCH)/libcuda.so.*.* | 77 | for DIR in /usr/lib/$(ARCH) /usr/local/cuda-*.*/compat /usr/lib/$(ARCH)/nvidia; do \ |
| 77 | @# Change libcuda.so link to bypass libcuda.so.1 | 78 | if [ ! -d $$DIR ]; then continue; fi; \ |
| 78 | sudo ln -sf /usr/lib/$(ARCH)/libcuda.so.*.* /usr/lib/$(ARCH)/libcuda.so | 79 | # Check that CUDA is installed in this location \ |
| 79 | @# Remove libcuda.so.1 symlink | 80 | if [ ! -f $$DIR/libcuda.so.*.* ]; then continue; fi; \ |
| 80 | sudo rm /usr/lib/$(ARCH)/libcuda.so.1 | 81 | # Change libcuda.so link to bypass libcuda.so.1 \ |
| 81 | @# Install wrapper as libcuda.so.1 | 82 | sudo ln -sf $$DIR/libcuda.so.*.* $$DIR/libcuda.so; \ |
| 82 | sudo cp libcuda.so.1 /usr/lib/$(ARCH)/libcuda.so.1 | 83 | # Remove libcuda.so.1 symlink \ |
| 84 | sudo rm $$DIR/libcuda.so.1; \ | ||
| 85 | # Install wrapper as libcuda.so.1 \ | ||
| 86 | sudo cp libcuda.so.1 $$DIR/libcuda.so.1; \ | ||
| 87 | done \ | ||
| 88 | # Special handling for L4T \ | ||
| 89 | if [ -d /usr/lib/$(ARCH)/nvidia ]; then sudo ln -sf nvidia/libcuda.so.1 /usr/lib/$(ARCH)/libcuda.so.1; fi | ||
| 83 | 90 | ||
| 84 | remove: | 91 | remove: |
| 85 | @# Test that our library in installed first | 92 | @set -e -x; \ |
| 86 | test ! -L /usr/lib/$(ARCH)/libcuda.so.1 | 93 | for DIR in /usr/lib/$(ARCH) /usr/local/cuda-*.*/compat /usr/lib/$(ARCH)/nvidia; do \ |
| 87 | @# Overwrite install with original symlinks | 94 | if [ ! -d $$DIR ]; then continue; fi; \ |
| 88 | sudo ln -sf libcuda.so.1 /usr/lib/$(ARCH)/libcuda.so | 95 | # Check that CUDA is installed in this location \ |
| 89 | sudo ln -sf /usr/lib/$(ARCH)/libcuda.so.*.* /usr/lib/$(ARCH)/libcuda.so.1 | 96 | if [ ! -f $$DIR/libcuda.so.*.* ]; then continue; fi; \ |
| 97 | # Test that our library in installed here \ | ||
| 98 | if [ -L $$DIR/libcuda.so.1 ]; then continue; fi; \ | ||
| 99 | # Overwrite install with original symlinks \ | ||
| 100 | sudo ln -sf libcuda.so.1 $$DIR/libcuda.so; \ | ||
| 101 | sudo ln -sf $$DIR/libcuda.so.*.* $$DIR/libcuda.so.1; \ | ||
| 102 | done | ||
| 90 | 103 | ||
| 91 | run_tests: tests | 104 | run_tests: tests |
| 92 | ./libsmctrl_test_global_mask | 105 | ./libsmctrl_test_global_mask |
