spikingjelly.configure module#
SpikingJelly package-level configuration.
中文
SpikingJelly 的库级选项通过 SJ_* 环境变量配置。环境变量在本模块首次导入时读取,
因此必须在启动 Python 前设置。未设置的选项使用下列文档中给出的默认值。
SJ_CUDA_THREADS=256 SJ_SAVE_DATASETS_COMPRESSED=0 python train.py
布尔环境变量遵循 PyTorch 的 0 / 1 风格,其中 0 表示 False,
1 表示 True。
English
SpikingJelly package-level options are configured through SJ_* environment
variables. They are read when this module is first imported, so set them before
starting Python. Unset options use the defaults documented below.
SJ_CUDA_THREADS=256 SJ_SAVE_DATASETS_COMPRESSED=0 python train.py
Boolean environment variables follow PyTorch's 0 / 1 convention:
0 means False and 1 means True.
- spikingjelly.configure.max_threads_number_for_datasets_preprocess = 16#
数据集预处理使用的最大线程数,由
SJ_MAX_THREADS_NUMBER_FOR_DATASETS_PREPROCESS配置,默认值为16。Maximum number of threads used for dataset preprocessing, configured by
SJ_MAX_THREADS_NUMBER_FOR_DATASETS_PREPROCESS. The default is16.
- spikingjelly.configure.cuda_threads = 512#
CUDA kernel 默认使用的线程数,由
SJ_CUDA_THREADS配置,默认值为512。 建议使用 2 的幂。Default number of threads used by CUDA kernels, configured by
SJ_CUDA_THREADS. The default is512; a power of two is recommended.
- spikingjelly.configure.cuda_compiler_options = ('-use_fast_math',)#
传递给 NVRTC 或 NVCC 的编译选项,由
SJ_CUDA_COMPILER_OPTIONS以逗号分隔的 形式配置,默认值为("-use_fast_math",)。空字符串表示不传递选项。Compiler options passed to NVRTC or NVCC, configured as a comma-separated value in
SJ_CUDA_COMPILER_OPTIONS. The default is("-use_fast_math",); an empty value produces an empty tuple.
- spikingjelly.configure.cuda_compiler_backend = 'nvrtc'#
CuPy CUDA 编译后端,由
SJ_CUDA_COMPILER_BACKEND配置,允许nvrtc或nvcc,默认值为nvrtc。CuPy CUDA compiler backend, configured by
SJ_CUDA_COMPILER_BACKEND. Valid values arenvrtcandnvcc; the default isnvrtc.
- spikingjelly.configure.save_datasets_compressed = True#
是否以压缩 NPZ 格式保存事件和帧,由
SJ_SAVE_DATASETS_COMPRESSED配置, 默认值为1。压缩格式占用更少磁盘空间,但读取更慢。Whether to save events and frames as compressed NPZ files, configured by
SJ_SAVE_DATASETS_COMPRESSED. The default is1. Compression uses less disk space but takes longer to read.
- spikingjelly.configure.save_spike_as_bool_in_neuron_kernel = False#
是否在神经元的 CuPy kernel 中以布尔形式保存反向传播所需的脉冲,由
SJ_SAVE_SPIKE_AS_BOOL_IN_NEURON_KERNEL配置,默认值为0。Whether CuPy neuron kernels save spikes for backward as booleans, configured by
SJ_SAVE_SPIKE_AS_BOOL_IN_NEURON_KERNEL. The default is0.
- spikingjelly.configure.save_bool_spike_level = 0#
布尔脉冲保存级别,由
SJ_SAVE_BOOL_SPIKE_LEVEL配置,默认值为0。0使用逐元素布尔值,1将每 8 个脉冲打包到一个 uint8 中。Boolean spike storage level, configured by
SJ_SAVE_BOOL_SPIKE_LEVEL. The default is0. Level0stores element-wise booleans; level1packs eight spikes into each uint8.
- spikingjelly.configure.triton_neuron_kernel_static_range_max_T = 64#
Triton 多步神经元 kernel 使用
tl.static_range的最大序列长度,由SJ_TRITON_NEURON_KERNEL_STATIC_RANGE_MAX_T配置,默认值为64。超过该值时 使用tl.range,以降低长序列的编译开销。Maximum sequence length for which Triton multi-step neuron kernels use
tl.static_range, configured bySJ_TRITON_NEURON_KERNEL_STATIC_RANGE_MAX_T. The default is64. Larger sequences usetl.rangeto reduce compilation overhead.