Skip to main content

Examples for smartpool.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smartpool_examples-0.1.7.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smartpool_examples-0.1.7-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file smartpool_examples-0.1.7.tar.gz.

File metadata

  • Download URL: smartpool_examples-0.1.7.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for smartpool_examples-0.1.7.tar.gz
Algorithm Hash digest
SHA256 596b9f8ae9988629138f9796c30bcc57afc320f8b5debc9a631d762a68ebaa19
MD5 5d0b44a0d0f29e4446d17f74541b296f
BLAKE2b-256 b2420b89fe35fb2909c93e31b1205e3ebb85dd4bcc0cb8601dbb072a7ec06b95

See more details on using hashes here.

File details

Details for the file smartpool_examples-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for smartpool_examples-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 70d79b62fafd4524d79d59445152d4aa0817a698c40c7dc2814c35097f4471ec
MD5 d558c7b3ef7045ebdbdcb53ab76260e1
BLAKE2b-256 fe079ec037c5f3e612351a1c2c0f72b45255a86e117c8a5924eac27f434669c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page