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, *, monitor=False, **overrides) -> 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 rules are in
the driver, which the CPU survey also uses. The engine records the rows
that each rule reads: the rate rows for the trailing window of
rate_window checkpoints, and the (S, N, m) rows for the QD-score
rule. Thus each rule has one meaning on both engines, 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 |
monitor
|
(callable, None or False)
|
A checkpoint callback. False, the default, reports nothing. None
selects the default reporter. See :mod: |
False
|
**overrides
|
Any field of :class: |
{}
|
Returns:
| Type | Description |
|---|---|
ArchiveResult
|
The archive, its per-checkpoint history, and the halt state. |
Source code in src/hifuku/gpu_walk.py
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | |
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
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 | |