Skip to content

Using BOAST for generating kernels

Daniel Peter edited this page Nov 9, 2022 · 3 revisions

Using BOAST for generating kernels

To generate CUDA and OpenCL kernels, we use BOAST as a source-to-source code generation tool. The informations here below are for developers who wish to modify the BOAST kernels written in ruby and generate updated kernels.

Note that we do provide all generated CUDA and OpenCL kernels in src/gpu/kernels.gen to be able to compile the code as is with CUDA and OpenCL support.

BOAST informations

  • github repository:
    https://github.com/Nanosim-LIG/boast

  • publication:
    BOAST: A metaprogramming framework to produce portable and efficient computing kernels for HPC applications
    Brice Videau, Kevin Pouget, Luigi Genovese, Thierry Deutsch, Dimitri Komatitsch, Frederic Desprez, Jean-Francois Mehaut
    The International Journal of High Performance Computing Applications. 2018;32(1):28-44.
    doi:10.1177/1094342017718068

Installing BOAST

  1. installation requires ruby, see:
    https://www.ruby-lang.org/en/documentation/installation/

  2. install BOAST:

    $ sudo gem install BOAST

  3. if needed, update BOAST:

    $ sudo gem update BOAST

Kernel generation

The ruby source code files of our BOAST kernels are all here:
src/gpu/boast

To generate new CUDA and OpenCL kernels:

$ cd SPECFEM3D_GLOBE/
$ make boast_kernels

This will create the new kernels in directory src/gpu/kernels.gen/.
Alternatively, you can also create them by:

$ cd SPECFEM3D_GLOBE/src/gpu/boast
$ ruby kernels.rb -o ../kernels.gen

ruby test

To test if ruby has BOAST installed, you can run with interactive ruby:

$ irb

and type something like:

irb(main):003:0> require 'BOAST'
irb(main):003:0> a = BOAST::Int "a"

to exit ruby again, use:

irb(main):003:0> <ctrl-D>