Show HN: ΩID – Faster Integrated Information Decomposition (ΦID) with CUDA

4 months ago 7

ΩID is a Python package for calculating the integrated information decomposition (ΦID) of time series data. It is designed for high-performance computing, with optional GPU acceleration via CuPy.

To install OmegaID with GPU support, you need to have a CUDA-enabled GPU and the CUDA toolkit installed. Then, you can install the package using pip:

pip install "omegaid[gpu]"

If you don't have a GPU or don't want to use it, you can install the CPU-only version:

To use the GPU-accelerated version, you need to set the CUPY_ENABLED environment variable to true:

Then, you can use the high-performance calc_phiid_ccs function as follows:

import numpy as np from omegaid.core.phiid import calc_phiid_ccs, calc_phiid_mmi # Generate some random data src = np.random.randn(1000) trg = np.random.randn(1000) # Calculate PhiID using the high-performance CCS method atoms_res, _ = calc_phiid_ccs(src, trg, tau=1) print("CCS Results:", atoms_res) # For theoretical comparison, you can use the MMI method # Note: This method is designed to run on CPU for performance predictability. atoms_res_mmi, _ = calc_phiid_mmi(src, trg, tau=1) print("MMI Results:", atoms_res_mmi)

Benchmarks (Smart Backend Strategy)

The library employs a smart backend strategy for optimal performance:

  • calc_phiid_ccs: This function leverages the globally configured backend (xp), which can be CuPy for GPU acceleration, offering significant speedups for parallelizable computations.
  • calc_phiid_mmi: This function is designed to run on the CPU (NumPy) by default, regardless of CuPy availability. This ensures predictable performance for MMI's inherently sequential global reduction operations, avoiding costly GPU-to-CPU data transfers at high dimensions.

Test Parameters: 50,000 samples, float32 data type.

Dims Redundancy NumPy Time (s) NumPy Mem (MB) CuPy Time (s) CuPy Mem (MB) CuPy GPU Mem (MB) Perf Ratio
16 MMI 0.4647 47.50 N/A N/A N/A N/A
16 CCS 0.1542 0.68 0.3264 278.66 126.00 0.47x
64 MMI 0.2362 8.25 N/A N/A N/A N/A
64 CCS 0.2598 -0.43 0.0252 0.03 197.62 10.30x
256 MMI 0.8283 2.79 N/A N/A N/A N/A
256 CCS 0.8251 -1.43 0.0268 0.00 784.00 30.74x
512 MMI 2.0243 3.00 N/A N/A N/A N/A
512 CCS 2.4208 -0.48 0.0279 0.00 1296.00 86.84x
1024 MMI 6.1629 2.50 N/A N/A N/A N/A
1024 CCS 6.1674 0.45 0.0346 0.00 1294.00 178.19x

Conclusion: For maximum performance and efficiency, calc_phiid_ccs is the recommended function, leveraging GPU acceleration. calc_phiid_mmi is provided for its theoretical value and is optimized for CPU execution.

Read Entire Article