GithubHelp home page GithubHelp logo

Comments (1)

jeffhammond avatar jeffhammond commented on June 30, 2024

You might be interested in reusing my stencil code generator.

The OpenCL one - https://github.com/ParRes/Kernels/blob/master/Cxx11/generate-opencl-stencil.py - is straightforward and easy to adapt to C89.

The C++ one is more complicated because it generates seven different types of loop syntax (one for each programming model it supports): https://github.com/ParRes/Kernels/blob/master/Cxx11/generate-cxx-stencil.py

Note that the code is explicitly instantiated for every case (e.g. https://github.com/ParRes/Kernels/blob/master/Cxx11/stencil_seq.hpp) and the driver needs to branch into them (e.g. https://github.com/ParRes/Kernels/blob/master/Cxx11/stencil-vector.cc#L177). One could of course replace the default case with a generic implementation, but I figure that limiting the user to radius=9 by default isn't a bad thing.

For OpenCL, I generated the code on the fly because the OpenCL programming model is happy with that, whereas C++ codes have to include the header. Including the header with 2x9 stencil kernels (~90KB of code) increases compilation time significantly (a few seconds with an optimizing compiler like ICC). One could easily reduce compile-time by reducing the default maximum radius to something like 5.

I have thought about using JiT for C++, but that entails invoking the compiler, generating a shared library, then dlopen-ing the shared library, which seems like a pain. It's also not viable in a variety of scenarios, e.g. Cray machines.

from kernels.

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.