Skip to main content

A native implementation of OpenMP in Python.

Project description

Native OpenMP for Python

This library is a native OpenMP implementation in python.

The barrier, critical, for, parallel, parallel for and single directives are supported, as well as the reduction, private, schedule and nowait clauses.

Here is an example program that uses the library.

#!/usr/bin/env python3
import omp
from omp import OpenMP

from functools import reduce

N = 20


@omp.enable
def main():
    acc = 0
    acc2 = 1
    with OpenMP("parallel"):
        with OpenMP("for reduction(+:acc) reduction(*:acc2)"):
            for i in range(1, N):
                acc += i
                acc2 *= i
    print("Actual result:", acc, acc2)
    print("Expected result:", sum(range(1, N)), reduce((lambda a, b: a*b), range(1, N), 1))


if __name__ == '__main__':
    main()

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

openmpy-0.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

openmpy-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file openmpy-0.1.0.tar.gz.

File metadata

  • Download URL: openmpy-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for openmpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 598bc2a7b276fa1e282e1bad57725d802c10a3ff3a1c6d27602294f5d57c3f68
MD5 88f09867df116383a6452df433e0c1dc
BLAKE2b-256 f5f2264f966accde5e3ac057421b6b62e9de9bec2ff6ffa96815595343b47172

See more details on using hashes here.

File details

Details for the file openmpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: openmpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for openmpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82c873390b15d5f150826c629efc8735f79ce333a6f3bdd9c110b047327596b2
MD5 3d139ec52fd1b3f3a30fa248e77df74d
BLAKE2b-256 9e40c7dc29b69cde727a22ab9b6e0c5e50fa9ac16b1068286d4b2f48bb224e91

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