Coder Social home page Coder Social logo

Comments (3)

tomdeakin avatar tomdeakin commented on September 9, 2024

Python isn't really built for number crunching, due to a few reasons which are explained pretty well in http://www.python.org/doc/essays/comparisons/. This example does the full serial integration in python.
As it says in the link, Python is good as a 'glue' language which is why it's nice to work with to call OpenCL.

Ultimately, it probably comes down to C being compiled with optimisations on, and Python being interpreted and run-time type checking.

We can either reduce the number of iterations down for the Python version or we have to pick a different way to work out pi, which would mean the serial code wouldn't be the same approach as the kernels.

from exercises-solutions.

tomdeakin avatar tomdeakin commented on September 9, 2024

Just thought I would check, you were you referring to the code in Exercises/Exercise08/Python? This is plain serial code with no OpenCL. I think the Solutions/Exercise08 versions run in similar times which are the OpenCL versions so any difference should be in the pyopencl wrapping of OpenCL calls.

from exercises-solutions.

simonmcs avatar simonmcs commented on September 9, 2024

Yes I was talking about the plain C and Python on the host. I know it's down to C being compiled and Python interpreted, but with such a big difference in run-times between the two, a typical user might assume the Python version has hung and give up (I nearly did!).

Perhaps we should reduce the iterations on the Python side, or at least print a warning that this will take minutes etc?

from exercises-solutions.

Related Issues (20)

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.