Skip to main content

SmartPool Examples

This package contains practical examples demonstrating the capabilities of SmartPool for various computational tasks.

Examples Overview

1. Prime Number Counting (count_prime)

Count the number of prime numbers below 10000 using smartpool.ProcessPool. Demonstrates basic usage of smartpool.ProcessPool.

Running the Example

python -m smartpool_examples.count_prime

2. Cross-Validation for Deep Learning models (cross_validation)

Demonstrates SmartPool's capabilities for machine learning workloads with GPU resource management.

Running the Example

# Using ProcessPool  
python -m smartpool_examples.cross_validation --pool smartpool.ProcessPool

# Using ThreadPool
python -m smartpool_examples.cross_validation --pool smartpool.ThreadPool

# Using multiprocessing.Pool
python -m smartpool_examples.cross_validation --pool multiprocessing.Pool

# Using concurrent.futures.ProcessPoolExecutor
python -m smartpool_examples.cross_validation --pool concurrent.futures.ProcessPoolExecutor

# Using concurrent.futures.ThreadPoolExecutor
python -m smartpool_examples.cross_validation --pool concurrent.futures.ThreadPoolExecutor

# Using joblib.Parallel(backend='loky')
python -m smartpool_examples.cross_validation --pool joblib.Parallel(backend='loky')

# Using joblib.Parallel(backend='threading')
python -m smartpool_examples.cross_validation --pool joblib.Parallel(backend='threading')

# Using Ray
python -m smartpool_examples.cross_validation --pool ray

What it Demonstrates

  • GPU memory management and core allocation
  • Automatic device selection (CPU vs GPU)
  • Cross-validation pipeline parallelization
  • Resource monitoring during training
  • Performance comparison with external frameworks

3. ONNX Inference (onnx_infer)

Runs batched ONNX model inference using InferSessionPool for concurrent GPU/CPU execution. Automatically manages inference sessions across worker threads.

Running the Example

python -m smartpool_examples.onnx_infer --max-workers 4

What it Demonstrates

  • InferSessionPool creation and session lifecycle management
  • Multi-threaded inference with automatic device placement
  • COCO-format image preprocessing (resize, normalize, letterbox)
  • Softmax + top-5 postprocessing
  • Progress bars for downloads and inference steps

License

MIT License - see main smartpool repository for details

Release files for smartpool-examples 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartpool-examples 0.1.7
File Size Uploaded
smartpool_examples-0.1.7.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smartpool-examples 0.1.7
File Interpreter ABI Platform
smartpool_examples-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 41.3 kB

Release files / smartpool_examples-0.1.7.tar.gz

Download URL smartpool_examples-0.1.7.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
596b9f8ae9988629138f9796c30bcc57afc320f8b5debc9a631d762a68ebaa19
BLAKE2b-256 checksum
How to use checksums
b2420b89fe35fb2909c93e31b1205e3ebb85dd4bcc0cb8601dbb072a7ec06b95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / smartpool_examples-0.1.7-py3-none-any.whl

Download URL smartpool_examples-0.1.7-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d79b62fafd4524d79d59445152d4aa0817a698c40c7dc2814c35097f4471ec
BLAKE2b-256 checksum
How to use checksums
fe079ec037c5f3e612351a1c2c0f72b45255a86e117c8a5924eac27f434669c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.3

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page