sampling_coordinator
#
Coordinate non-resumable, molecule-level sampling on one node.
Functions:
-
sampling_devices–Return the CUDA_VISIBLE_DEVICES entry each worker should claim, or "cpu".
-
sample_ligands–Sample every ligand, process it in the parent, and save it.
_WORKER_DEVICE
module-attribute
#
The torch device this worker samples on, set once it has claimed a GPU. The parent never reads it.
_WORKER_LOGS
module-attribute
#
Records logged while sampling one molecule, replayed by the parent in order. Stays empty in the parent, where logging reaches the real sinks directly.
_WARMED_POTENTIALS
module-attribute
#
Potentials this process has already pulled weights for; see _warm_ml_potential.
sampling_devices
#
Return the CUDA_VISIBLE_DEVICES entry each worker should claim, or "cpu".
Source code in presto/sampling_coordinator.py
_capture_log
#
_init_worker
#
Claim one device for this worker and buffer its logs for the parent.
Source code in presto/sampling_coordinator.py
_sample_worker
#
_sample_worker(
molecule_json: str,
molecule_index: int,
offxml_path: str,
device: str | None,
sampling_settings: SamplingSettings,
output_paths: dict[OutputType, Path],
) -> tuple[Dataset, list[tuple[str, str]]]
Sample one molecule, naming its side outputs with its workflow index.
Returns the dataset and any log records buffered by _init_worker. The
buffer is empty in the parent, where logging reaches the real sinks directly.
Source code in presto/sampling_coordinator.py
sample_ligands
#
sample_ligands(
*,
mols: list[Molecule],
offxml_path: Path,
device_type: str,
sampling_settings: SamplingSettings,
output_paths: dict[OutputType, Path],
dataset_output_paths: list[Path],
n_processes: int,
process_dataset: (
Callable[[int, Dataset], Dataset] | None
) = None
) -> list[Dataset]
Sample every ligand, process it in the parent, and save it.
Generated sampling is an internal, non-resumable workflow operation: the workflow rejects non-clean output before calling it, so destinations are absent.
Source code in presto/sampling_coordinator.py
_track_ligands
#
Yield items behind a bar counting completed ligands as x/N.
Source code in presto/sampling_coordinator.py
_warm_ml_potential
#
_warm_ml_potential(
mol: Molecule,
sampling_settings: SamplingSettings,
device_type: str,
) -> None
Cache the reference potential's weights before any worker exists.
Backends download straight to their final path (aimnet creates the file
before fetching it, mace uses urlretrieve), so workers racing a
first-time download read each other's partial files. Building one system
here means every worker finds a complete cache.
Source code in presto/sampling_coordinator.py
_sample_every_ligand
#
_sample_every_ligand(
*,
mols: list[Molecule],
offxml_path: Path,
device_type: str,
sampling_settings: SamplingSettings,
output_paths: dict[OutputType, Path],
n_processes: int
) -> list[Dataset]
Sample every molecule, reporting all per-ligand failures together.
Source code in presto/sampling_coordinator.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |