{"id":16009558,"url":"https://github.com/fwcd/hpc-smith-waterman","last_synced_at":"2026-03-03T09:08:31.679Z","repository":{"id":98824946,"uuid":"459763051","full_name":"fwcd/hpc-smith-waterman","owner":"fwcd","description":"GPU-accelerated Smith-Waterman algorithm implementation in Rust","archived":false,"fork":false,"pushed_at":"2022-02-21T17:11:09.000Z","size":130,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-15T16:40:19.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fwcd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-02-15T21:56:56.000Z","updated_at":"2025-02-19T19:29:41.000Z","dependencies_parsed_at":"2023-05-25T16:00:28.494Z","dependency_job_id":null,"html_url":"https://github.com/fwcd/hpc-smith-waterman","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fwcd/hpc-smith-waterman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fhpc-smith-waterman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fhpc-smith-waterman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fhpc-smith-waterman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fhpc-smith-waterman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fwcd","download_url":"https://codeload.github.com/fwcd/hpc-smith-waterman/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fhpc-smith-waterman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30038671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T06:58:30.252Z","status":"ssl_error","status_checked_at":"2026-03-03T06:58:15.329Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T13:02:55.123Z","updated_at":"2026-03-03T09:08:31.674Z","avatar_url":"https://github.com/fwcd.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smith Waterman in Rust for HPC\n\nA GPU-accelerated implementation of the Smith-Waterman algorithm for finding optimal local sequence aligments in Rust.\n\n## Usage\n\n\u003e Note: If you want to build the program from source rather than use a prebuilt binary, substitute `cargo run --release --` for every occurrence of `hpc-smith-waterman` in the following commands. Prebuilt binaries for x86-64 Linux (using OpenCL ICD) and arm64 Darwin/macOS can be found in `bin`.\n\nThe program includes two main modes: `run` and `bench`.\n\n### Run Mode\n\nIn the first mode, the program will run every engine on a single database/query pair. E.g.\n\n```\nhpc-smith-waterman run\n```\n\nwill run the algorithm on the default pair of sequences (`TGTTACGG` and `GGTTGACTA`). You can, however, also specify a custom pair of sequences\n\n```\nhpc-smith-waterman run GATT ATBTAG\n```\n\nwill run the algorithm on the given pair (`GATT` and `ATBAG`).\n\n### Bench Mode\n\n\u003e Note: To use bench mode, you need to either make sure that a dataset exists at `data/uniprot_sprot.fasta` from your cwd (you can download this dataset with the script `scripts/download-dataset`) or point to a custom FASTA-dataset with `--path`.\n\nIn the second mode, the program will read a dataset and then compare the first sequence to all of the remaining sequences, again using each engine. During this, the elapsed time and the Giga-CUPS (Cell Operations Per Second) will be recorded.\n\nThe simplest way to invoke this mode is to not pass any arguments:\n\n```\nhpc-smith-waterman bench\n```\n\nThis will use the aforementioned dataset (`data/unipro_sprot.fasta`) and run every engine. If you only wish to run a subset of engines, you can pass the engines you wish to run as arguments. The following engines are supported:\n\n| Flag | Description |\n| ---- | ----------- |\n| `--naive` | A naive CPU engine |\n| `--diagonal` | A CPU engine that parallelizes over diagonals |\n| `--opencl-diagonal` | A GPU engine that parallelizes over diagonals |\n| `--opencl-diagonal` | A GPU engine that parallelizes over diagonals |\n| `--optimized-diagonal` | A CPU engine that parallelizes over diagonals and uses a cache-optimized (diagonal-major) matrix layout |\n| `--optimized-opencl-diagonal` | A GPU engine that parallelizes over diagonals and uses a cache-optimized (diagonal-major) matrix layout |\n\nFor example, if you wish to bench the naive engine and the OpenCL diagonal engine, you could invoke the program as follows:\n\n```\nhpc-smith-waterman bench --naive --opencl-diagonal\n```\n\nYou can customize the maximum number of query sequenced benchmarked against using `--number` aka. `-n`:\n\n```\nhpc-smith-waterman bench -n 2000\n```\n\nIf you wish, you can also let each query sequence benchmarked against be repeated/cycled a certain number of times using `--repeat` aka. `-r` to make it longer (useful for benchmarking the performance of very long sequences). For example, to bench against 50 sequences, each repeated/cycled 10 times in length, run\n\n```\nhpc-smith-waterman bench -n 50 -r 10\n```\n\nIf you have multiple GPUs installed, you can choose the GPU for OpenCL using `--gpu-index` (the default is 0), e.g. like this:\n\n```\nhpc-smith-waterman --gpu-index 1 bench --opencl-diagonal\n```\n\n## Performance Considerations\n\nWhile the benchmarks already parallelize over the examples using CPU threads, there are some observations to keep in mind:\n\n- The GPU engines generally only outperform the CPU engines on large sequences (since those let us parallelize the kernel well due to lots of diagonals)\n- Additionally, there is overhead to using OpenCL (e.g. configuring kernels, queueing them, etc.), which makes the CPU variants often faster when benchmarking lots of short sequences\n- The naive CPU variant is already pretty fast due to good cache coherency (we iterate the matrix in a natural way, the inner loop visits adjacent elements)\n\n## Example Results\n\nExample benchmark results on the Apple M1 Pro:\n\n### Lots of short-ish sequences\n\n```\n$ hpc-smith-waterman bench -n 10000\n┌──────────────────────────┐\n│ Naive (CPU) (sequential) │\n└──────────────────────────┘\nElapsed: 9.79s\nGiga-CUPS: 0.38\nPairs: 10000\n┌────────────────────────┐\n│ Naive (CPU) (parallel) │\n└────────────────────────┘\nElapsed: 1.59s\nGiga-CUPS: 2.34\nPairs: 10000\n┌───────────────────────────┐\n│ Diagonal (CPU) (parallel) │\n└───────────────────────────┘\nElapsed: 4.79s\nGiga-CUPS: 0.78\nPairs: 10000\n┌─────────────────────────────────────┐\n│ Optimized Diagonal (CPU) (parallel) │\n└─────────────────────────────────────┘\nElapsed: 3.38s\nGiga-CUPS: 1.10\nPairs: 10000\n┌────────────────────────────────────────────────┐\n│ OpenCL Diagonal (GPU: Apple M1 Pro) (parallel) │\n└────────────────────────────────────────────────┘\nElapsed: 14.75s\nGiga-CUPS: 0.25\nPairs: 10000\n┌──────────────────────────────────────────────────────────┐\n│ Optimized OpenCL Diagonal (GPU: Apple M1 Pro) (parallel) │\n└──────────────────────────────────────────────────────────┘\nElapsed: 19.68s\nGiga-CUPS: 0.19\nPairs: 10000\n```\n\nObservation: CPU variants outperform GPU variants by quite a bit.\n\n### Few, very large sequences\n\n\u003e We exclude the naive engine since it's too slow.\n\n```\n$ hpc-smith-waterman bench --diagonal --opencl-diagonal --optimized-diagonal --optimized-opencl-diagonal -n 5 -r 36\n┌───────────────────────────┐\n│ Diagonal (CPU) (parallel) │\n└───────────────────────────┘\nElapsed: 10.71s\nGiga-CUPS: 0.18\nPairs: 5\n┌─────────────────────────────────────┐\n│ Optimized Diagonal (CPU) (parallel) │\n└─────────────────────────────────────┘\nElapsed: 4.90s\nGiga-CUPS: 0.39\nPairs: 5\n┌────────────────────────────────────────────────┐\n│ OpenCL Diagonal (GPU: Apple M1 Pro) (parallel) │\n└────────────────────────────────────────────────┘\nElapsed: 7.46s\nGiga-CUPS: 0.25\nPairs: 5\n┌──────────────────────────────────────────────────────────┐\n│ Optimized OpenCL Diagonal (GPU: Apple M1 Pro) (parallel) │\n└──────────────────────────────────────────────────────────┘\nElapsed: 2.14s\nGiga-CUPS: 0.89\nPairs: 5\n```\n\nObservation: The GPU is good at crunching large matrices with lots of diagonals in parallel.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwcd%2Fhpc-smith-waterman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffwcd%2Fhpc-smith-waterman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwcd%2Fhpc-smith-waterman/lists"}