A high-performance CUDA implementation for k-mer generation from DNA sequences, optimized for whole-genome sequencing (WGS) data processing.
The k-mer kernel implements the following algorithm:
- DNA Encoding: convert each base to 2 bits
- A: 00, C: 01, G: 10, T: 11
- Sliding Window: process k-length windows across the sequence
- Parallel Processing: each GPU thread handles a different k-mer position
- Bit Packing: store k-mers as 32-bit integers
- CUDA Toolkit (tested with CUDA 12.9)
- NVIDIA GPU with compute capability 5.0+
- GCC/G++ compiler
- zlib development library
# Install dependencies (Ubuntu/Debian)
sudo apt install nvidia-cuda-toolkit g++ zlib1g-dev
# Build the project
make all# Generate k-mers from a simple sequence
./kmer# Process WGS FASTQ files
./wgs_processor 31 1000000 /path/to/wgs_data/*.fastq.gzk-mer_size: Length of k-mers (typically 31 for WGS)batch_size: Number of sequences to process per batchfastq_files: Input FASTQ files (supports .gz compression)
=== WGS K-mer Processing ===
K-mer size: 31
Batch size: 1000000 sequences
Input files: 1
Processing: /path/to/wgs_data.fastq.gz
✓ Sequences processed: 1000000
✓ K-mers generated: 50000000
✓ Processing time: 45.23 seconds
✓ Sequences/sec: 22109.4
=== Summary ===
✓ Total sequences processed: 1000000
✓ Total k-mers generated: 50000000
✓ Total processing time: 45 seconds
✓ Average sequences per second: 22109
# Build and test basic functionality
make kmer && ./kmer
# Test with WGS data
make wgs_processor && ./wgs_processor 31 1000 test.fastq.gz