forked from princeton-vl/DPVO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·46 lines (38 loc) · 1.53 KB
/
install.sh
File metadata and controls
executable file
·46 lines (38 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -euo pipefail
if [[ "${1:-}" == "--force" ]]; then
FORCE_REBUILD=1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Auto-detect GPU architecture and compile only for current GPU.
CUDA_ARCH=$(python -c "import torch; cc = torch.cuda.get_device_capability(); print(f'{cc[0]}.{cc[1]}')" 2>/dev/null) || {
echo "Error: Failed to detect GPU architecture. Ensure CUDA is available."
exit 1
}
export TORCH_CUDA_ARCH_LIST="$CUDA_ARCH"
echo "Compiling for GPU architecture: $CUDA_ARCH"
LIETORCH_PATH="$SCRIPT_DIR/../DROID_SLAM/thirdparty/lietorch"
if python -c "import dpvslam" 2>/dev/null && [[ "${FORCE_REBUILD:-0}" != "1" ]]; then
echo "[DPV_SLAM] Already installed, skipping. Use --force to reinstall."
exit 0
fi
# Install standalone lietorch shared with other baselines
if ! python -c "import lietorch" 2>/dev/null; then
if [ ! -d "$LIETORCH_PATH" ]; then
echo "Error: lietorch was not found at $LIETORCH_PATH"
echo "Initialize submodules and run setup again."
exit 1
fi
echo "Installing lietorch from $LIETORCH_PATH..."
pip install -v "$LIETORCH_PATH" --no-build-isolation
else
echo "lietorch already installed, skipping..."
fi
EIGEN3_INCLUDE_DIR="${EIGEN3_INCLUDE_DIR:-/usr/include/eigen3}"
if [ ! -d "$EIGEN3_INCLUDE_DIR" ]; then
echo "Error: system Eigen3 include dir not found at '$EIGEN3_INCLUDE_DIR'."
echo "Install Eigen3 (e.g. apt install libeigen3-dev) or set EIGEN3_INCLUDE_DIR."
exit 1
fi
cd "$SCRIPT_DIR"
pip install -v -e . --no-build-isolation