Elite Archive (GPU)¶
The device elite-archive survey: an unconditional K-step walk per block, merged into the device archive by winner-take-all placement. The CPU archive is the reference for parity.
run_archive_gpu
¶
run_archive_gpu(r1, r2, r3, alignment, model, start_trees, triangle, taxon_table, cell: float = ARCHIVE_CELL, origin: float = 0.0, extent: float = ARCHIVE_GPU_EXTENT, n_iters: int = ARCHIVE_N_ITERS, seed: int = 0, sigma_slide: float = DEFAULT_SIGMA_SLIDE, scale_width: float = DEFAULT_SCALE_WIDTH, n_walkers: int = ARCHIVE_WALK_M, walk_steps: int = ARCHIVE_WALK_K, checkpoint_every: int = ARCHIVE_CHECKPOINT_EVERY, converge: bool = True, force_full_run: bool = False, gate_window: int = ARCHIVE_GATE_WINDOW, coverage_eps: float = ARCHIVE_COVERAGE_EPS, precision_eps: float = ARCHIVE_PRECISION_EPS, logl_margin: float | None = ARCHIVE_LOGL_MARGIN, logl_floor: float | None = None, monitor=False) -> ArchiveResult
Run the GPU elite-archive survey for one alignment.
The device runs n_walkers blocks per pass. Each block walks
walk_steps moves from an assigned niche and writes one candidate per
move. A batched place then merges every candidate. The archive is seeded
from the anchors and the start trees.
This function builds a :class:~hifuku.gpu_backend.CudaBackend and gives it
to :func:~hifuku.driver.run_survey. The loop and the halt rule are in the
driver, which the CPU survey also uses, so both engines halt on the trailing
window of gate_window checkpoints and the CPU survey serves as the parity
oracle for this one.
The returned EliteArchive and history match the CPU survey's shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r1
|
HifukuTree
|
Anchor trees that fix the chart. |
required |
r2
|
HifukuTree
|
Anchor trees that fix the chart. |
required |
r3
|
HifukuTree
|
Anchor trees that fix the chart. |
required |
alignment
|
The alignment surveyed and its substitution model. |
required | |
model
|
The alignment surveyed and its substitution model. |
required | |
start_trees
|
list[HifukuTree]
|
Extra seed trees, normally the anchor tree for the surveyed gene. |
required |
triangle
|
AnchorTriangle
|
Anchor geometry. It carries the chart metric. |
required |
taxon_table
|
TaxonTable
|
Shared namespace. |
required |
cell
|
float
|
Niche side and grid origin in barycentric units. |
ARCHIVE_CELL
|
origin
|
float
|
Niche side and grid origin in barycentric units. |
ARCHIVE_CELL
|
extent
|
float
|
Half-extent of the device niche allocation. A memory bound, not a limit on the chart domain. |
ARCHIVE_GPU_EXTENT
|
n_iters
|
int
|
The survey budget cap in variations. |
ARCHIVE_N_ITERS
|
seed
|
int
|
RNG seed. |
0
|
sigma_slide
|
float
|
Proposal widths for the branch moves. |
DEFAULT_SIGMA_SLIDE
|
scale_width
|
float
|
Proposal widths for the branch moves. |
DEFAULT_SIGMA_SLIDE
|
n_walkers
|
int
|
Blocks per pass, and moves per block per pass. |
ARCHIVE_WALK_M
|
walk_steps
|
int
|
Blocks per pass, and moves per block per pass. |
ARCHIVE_WALK_M
|
converge
|
bool
|
Halt on discovery saturation when set. |
True
|
force_full_run
|
bool
|
Run the full budget and ignore the halt. |
False
|
gate_window
|
int
|
Trailing window in checkpoints for the halt rates. |
ARCHIVE_GATE_WINDOW
|
coverage_eps
|
float
|
Halt thresholds on the windowed coverage and precision rates. |
ARCHIVE_COVERAGE_EPS
|
precision_eps
|
float
|
Halt thresholds on the windowed coverage and precision rates. |
ARCHIVE_COVERAGE_EPS
|
logl_margin
|
float
|
Relative log-likelihood gate in nats below the best tree found. The driver reads the floor once per checkpoint. Pass None for a survey that only the budget limits. |
ARCHIVE_LOGL_MARGIN
|
logl_floor
|
float
|
Absolute log-likelihood gate. Not permitted with |
None
|
monitor
|
(callable, None or False)
|
A checkpoint callback. False, the default, reports nothing. None
selects the default reporter. See :mod: |
False
|
Returns:
| Type | Description |
|---|---|
ArchiveResult
|
The archive, its per-checkpoint history, and the halt state. |
Source code in src/hifuku/gpu_walk.py
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | |
evaluate_gpu
¶
evaluate_gpu(trees, r1, r2, r3, alignment, model, triangle, taxon_table, cell: float = ARCHIVE_CELL, origin: float = 0.0, extent: float = ARCHIVE_GPU_EXTENT)
Evaluate each tree's log-likelihood and niche on the device.
Flattens the trees into archive state, then runs the seed-eval kernel, which
unflattens and peels with no move. Isolates the device unflatten and
Felsenstein path so it can be checked against the CPU oracle. Returns
(logL, ij) where ij is an (M, 2) array of archive niche indices;
a tree outside the device allocation gets the sentinel INT_MIN niche.
Source code in src/hifuku/gpu_walk.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | |