Giter VIP home page Giter VIP logo

pyomp's Introduction

PyOMP

OpenMP for Python in Numba

Building

Run build.sh.

Using

Import Numba and add the njit decorator to the function in which you want to use OpenMP. Add with contexts for each OpenMP region you want to have where the with context is openmp_context from the numba.openmp module.

Example

from numba import njit
from numba.openmp import openmp_context as openmp

@njit
def test_pi_loop():
    num_steps = 100000
    step = 1.0 / num_steps

    the_sum = 0.0
    omp_set_num_threads(4)

    with openmp("parallel"):
        with openmp("for reduction(+:the_sum) schedule(static)"):
            for j in range(num_steps):
                c = step
                x = ((j-1) - 0.5) * step
                the_sum += 4.0 / (1.0 + x * x)

    pi = step * the_sum
    return pi

pyomp's People

Contributors

lattner avatar topperc avatar rksimon avatar espindola avatar tkremenek avatar ddunbar avatar douggregor avatar rotateright avatar sklam avatar arsenm avatar d0k avatar rui314 avatar zygoloid avatar chandlerc avatar isanbard avatar echristo avatar rnk avatar dwblaikie avatar chapuni avatar nico avatar pitrou avatar maskray avatar akyrtzi avatar stoklund avatar stuartarchibald avatar eefriedman avatar tobiasgrosser avatar resistor avatar labath avatar ericwf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.