Skip to content

Tips, Examples, and Troubleshooting

bbuhrow edited this page Jun 19, 2026 · 2 revisions

Tips, Examples, and Troubleshooting

Worked examples from docfile.txt

A canonical factor() test case (uses many of YAFU's algorithms):

yafu "factor(2056802480868100646375721251575555494408897387375737955882170045672576386016591560879707933101909539325829251496440620798637813)"

A neat ECM example:

yafu "ecm(140870298550359924914704160737419905257747544866892632000062896476968602578482966342704)"

Common patterns

Factor with multiple threads

yafu "factor(rsa(200))" -threads 8 -v

Pretest only, capped at t40

yafu "factor(<n>)" -pretest 40

Deep pretest before NFS

yafu "factor(<n>)" -plan deep -threads 8 -v

Resume an interrupted SIQS job

Just call siqs again with the same input — YAFU reads siqs.dat (or whatever you set with qssave) and continues.

yafu "siqs(<same n as before>)" -threads 4

Resume an interrupted NFS job

# Resume sieving
yafu "nfs(<n>)" -v -R -ns

# Or resume in-progress linear algebra
yafu "nfs(<n>)" -v -R -ncr

Run a polynomial search across a custom leading-coefficient range

yafu "nfs(<n>)" -np 10000,20000 -v -threads 4

Trial-sieve a list of polys

yafu "nfs(<n>)" -nt poly1.job,poly2.job,poly3.job

YAFU sieves each in turn, reports which is fastest, then exits.

Run a long job on a linux terminal, expecting a disconnect: use nohup

nohup yafu ... > nohup.out&"

Drive a list of inputs from a file

# in.bat contains one number per line
yafu "factor(@)" -batchfile in.bat -threads 8

Lines are removed from in.bat as they complete, so the file acts as a work queue.

Choosing instruction-set flags for a custom build

CPU generation Flags
Sandy Bridge → Haswell USE_SSE41=1 USE_AVX2=1 USE_BMI2=1 (BMI2 from Haswell on)
Skylake-X / Cascade Lake add SKYLAKEX=1
Ice Lake / Tiger Lake / newer add ICELAKE=1

If your CPU has AVX-512, YAFU will also pick AVX-ECM as the default ECM backend (built into the project).

See Building YAFU for the full build recipe.

Things that surprise people

  • SIQS savefiles get overwritten when you start a different input. Back up siqs.dat if you're switching jobs and want to come back.
  • NFS savefiles get overwritten the same way. Set -o and -job per project, or work in separate directories.
  • -nc2 starts the linear algebra from scratch. To resume an in-progress LA, use -ncr.
  • tune_info= lines in yafu.ini are written by the tune() function. You don't need to add them by hand. They're per-CPU, so if you run YAFU on a different machine you'll want to re-tune.
  • GGNFS binaries are required for NFS. YAFU ships them under factor/lasieve5_64/bin/, but you have to point at them with ggnfs_dir=.
  • APR-CL hard limit is 6021 digits. Above that, aprcl() falls back to BPSW.
  • SQUFOF is capped at 62-bit inputs.

Where to get help

Reporting issues

Bug reports and feature requests live on the GitHub issues page. If you build a faster binary for a particular CPU than the one shipped, the maintainer would like to hear about it.

Clone this wiki locally