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.6.tar.gz (16.6 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.6-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartpool_examples-0.1.6.tar.gz
  • Upload date:
  • Size: 16.6 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.6.tar.gz
Algorithm Hash digest
SHA256 8b543f8e151ed092c30947af42ec584eb3cda50da6537c3092e0e38aeda0119c
MD5 2e4756abf7593905cd9fe6297fb961ee
BLAKE2b-256 bfc4595dd64222be177856ba85b303620ce23e3a47a59a2a41890c9b69cbf5cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smartpool_examples-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c4bfd61eb87d6093336bd75539aa1531be359e37394e4a1fd0791167628304b9
MD5 9faf98fb648cb673b637c6a75d61234e
BLAKE2b-256 0a0a39f7d7de819bc55830823ba34c91fd06a3d622832b0413bd9d44370fe02b

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