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
178 changes: 8 additions & 170 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,179 +33,17 @@ This repository includes external repositories as Git submodules, so, unless you
git submodule update --init --recursive
```

### Create a Conda Environment
GTSfM supports two installation methods. Choose the one that best fits your workflow:

To run GTSfM, first, we need to create a conda environment with the required dependencies.
### Option 1: Conda Setup (Recommended for most users)

[Install MiniConda](https://www.anaconda.com/docs/getting-started/miniconda/install) if needed, then:
For detailed Conda installation instructions, see **[conda-setup.md](docs/setup/conda-setup.md)**

On **Linux**, with CUDA support, run:
```bash
conda env create -f environment_linux.yml
conda activate gtsfm-v1 # you may need "source activate gtsfm-v1" depending upon your bash and conda set-up
```
Check your cuda version then install `torch_scatter` from pre-built wheels

For example, for CUDA 12.1 → use cu121
```bash
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.1+cu121.html
```

To use PACE, use the same linux installation `environment_linux.yml`

Then add `dask-cuda`
```bash
conda install -c rapidsai -c conda-forge dask-cuda
```


On **macOS**, there is no CUDA support, so run:

```bash
conda env create -f environment_mac.yml
conda activate gtsfm-v1
```

### Install `gtsfm` as a module

Now, install `gtsfm` as a module:

```bash
pip install -e .
```

Make sure that you can run `python -c "import gtsfm; import gtsam; print('hello world')"` in python, and you are good to go!


#### Set Up GTSfM with UV

**Basic Installation:**
Navigate to the GTSfM directory:

```bash
cd path/to/gtsfm

# Clean existing environment (if any)
rm -rf .venv

# Install on Linux for CPU only and macOS
uv sync --python 3.10

# Install on Linux with CUDA GPU
uv sync --python 3.10 --extra complete

# Install torch-scatter (platform-specific)
# For Linux (CUDA 12.1):
uv pip install torch-scatter --find-links https://data.pyg.org/whl/torch-2.5.1+cu121.html

```

**Multi-GPU Installation (For Distributed Computing):**

If you have multiple GPUs on the same machine and want to use Dask for distributed GPU computing:

```bash
# Multiple GPUs per node (e.g., 4x or 8x A100)
uv sync --python 3.10 --extra complete --extra multi-gpu
```

This adds `dask-cuda` for GPU-aware distributed scheduling.

**When do you need `--extra multi-gpu`?**
- You have multiple GPUs on the same machine
- You want to use Dask to distribute work across GPUs
- You're running on a GPU cluster node

**When you DON'T need it:**
- Single GPU workstation
- Laptop with one GPU
- CPU-only machines
- Multiple machines (handled differently)
### Option 2: UV Setup (Fast alternative package manager)

**Add System Level Package**
```bash
# Linux
sudo apt-get install nodejs npm
sudo apt-get install graphviz
# macOS
brew install node
brew install graphviz
```

**Verify installation**
```bash
uv run python -c "import gtsfm; import pydegensac; import torch; import torch_scatter; print('✅ Success!')"
```

#### Go to test using UV
```bash
uv run ./run --dataset_dir tests/data/set1_lund_door \
--config_name unified_binary.yaml \
--loader olsson \
--num_workers 2 graph_partitioner.max_depth=1
```

```bash
uv run .github/scripts/execute_single_benchmark.sh skydio-8 lightglue 15 colmap-loader 760 true
```

#### Managing Packages with UV

**Adding a new package:**
```bash
uv add <package-name>
# Example: uv add numpy
```

**Adding a development dependency:**
```bash
uv add --dev <package-name>
# Example: uv add --dev pytest
```

**Removing a package:**
```bash
uv remove <package-name>
# Example: uv remove numpy
```

**Installing a package without adding to dependencies:**
```bash
uv pip install <package-name>
```

#### When to Use `uv lock`

The `uv lock` command updates the lock file (`uv.lock`) without installing packages. Use it when:

- **After manually editing `pyproject.toml`:** When you directly modify dependencies in the configuration file
- **To update dependencies:** When you want to resolve and lock new versions without installing
- **In CI/CD pipelines:** To ensure reproducible builds by generating a lock file
- **Before committing changes:** To update the lock file for team members

```bash
# Update lock file after editing pyproject.toml
uv lock

# Update lock file and install packages
uv lock && uv sync
```

> **Note:** `uv add` and `uv remove` automatically update the lock file, so you typically don't need to run `uv lock` manually after these commands.

#### Running Commands with UV

Once set up, prefix Python commands with `uv run`:

```bash
# Run GTSfM
uv run python -m gtsfm.runner --config_name deep_front_end.yaml

# Or use the run script
uv run ./run --dataset_dir tests/data/set1_lund_door --config_name deep_front_end.yaml
```
For detailed UV installation instructions, see **[uv-setup.md](docs/setup/uv-setup.md)**

Make sure that you can run `python -c "import gtsfm; import gtsam; print('hello world')"` in python, and you are good to go!
Both methods will allow you to run GTSfM successfully.

## Try It on Google Colab

Expand Down Expand Up @@ -320,7 +158,7 @@ Refer to the detailed guide:
### Running GTSFM on a Multi-Machine Cluster

For users who want to run GTSFM on a **cluster of multiple machines**, follow the setup instructions here:
📄 [CLUSTER.md](https://github.com/borglab/gtsfm/tree/master/CLUSTER.md)
📄 [CLUSTER.md](https://github.com/borglab/gtsfm/tree/master/docs/deployment/CLUSTER.md)

### Where Are the Results Stored?

Expand Down Expand Up @@ -422,7 +260,7 @@ GTSfM is designed in a modular way. Each module can be swapped out with a new on

## Contributing

Contributions are always welcome! Please be aware of our [contribution guidelines for this project](CONTRIBUTING.md).
Contributions are always welcome! Please be aware of our [contribution guidelines for this project](docs/CONTRIBUTING.md).

## Citing this work

Expand Down
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions docs/setup/conda-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Conda Setup Guide

This guide covers installation of GTSfM using Conda package manager.

## Prerequisites

- [MiniConda](https://www.anaconda.com/docs/getting-started/miniconda/install) installed on your system

## Create a Conda Environment

To run GTSfM, first, we need to create a conda environment with the required dependencies.

### Linux (with CUDA support)

```bash
conda env create -f environment_linux.yml
conda activate gtsfm-v1 # you may need "source activate gtsfm-v1" depending upon your bash and conda set-up
```

Check your cuda version then install `torch_scatter` from pre-built wheels

For example, for CUDA 12.1, use cu121
```bash
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.1+cu121.html
```

For CUDA 13, use cu128
```bash
pip install torch-scatter --find-links https://data.pyg.org/whl/torch-2.7.0+cu128.html
```

### macOS (no CUDA support)

```bash
conda env create -f environment_mac.yml
conda activate gtsfm-v1
```

## Install `gtsfm` as a module

Now, install `gtsfm` as a module:

```bash
pip install -e .
```

## Verify Installation


Make sure that you can run `python -c "import gtsfm; import gtsam; print('hello world')"` in python, and you are good to go!

Loading