photon_mosaic.snakemake_utils#

Snakemake utility functions for photon-mosaic.

This module provides utility functions used in Snakemake workflows, including path handling, GPU/CUDA checks, and workflow configuration.

Functions

cross_platform_path(path)

Convert path to string format appropriate for the current platform.

get_snakefile_path()

Get the path to the Snakemake workflow file.

log_cuda_availability()

Log CUDA availability as a sanity check for GPU jobs.

photon_mosaic.snakemake_utils.get_snakefile_path()[source]#

Get the path to the Snakemake workflow file.

Returns:

Path to the Snakefile in the photon_mosaic package.

Return type:

Path

photon_mosaic.snakemake_utils.cross_platform_path(path)[source]#

Convert path to string format appropriate for the current platform.

On Windows, uses forward slashes (as_posix()) for Snakemake compatibility. On Unix-like systems, uses native path separators (str()).

Parameters:

path (Path) – Path object to convert

Returns:

String representation of the path appropriate for the platform

Return type:

str

photon_mosaic.snakemake_utils.log_cuda_availability()[source]#

Log CUDA availability as a sanity check for GPU jobs.

This function checks if CUDA is available and logs relevant GPU information. Useful for verifying that GPU resources are properly allocated in SLURM jobs.

Returns:

True if CUDA is available, False otherwise

Return type:

bool