GPU

Usage

use GPU;

or

import GPU;

Supports utility functions for operating with GPUs.

Warning

This module is unstable and its interface is subject to change in the future.

GPU support is a relatively new feature to Chapel and is under active development.

For the most up-to-date information about GPU support see the technical note about it.

proc gpuWrite(const args ...?k)

This function is intended to be called from within a GPU kernel and is useful for debugging purposes.

Currently using write to send output to stdout will make a loop ineligible for GPU execution; use gpuWrite instead.

Currently this function will only work if values of type c_string are passed.

On NVIDIA GPUs the written values will be flushed to the terminal after the kernel has finished executing. Note that there is a 1MB limit on the size of this buffer.

proc gpuWriteln(const args ...?k)

Pass arguments to gpuWrite and follow with a newline.

proc assertOnGpu()

Will halt execution at runtime if called from outside a GPU. If used on first line in foreach or forall loop will also do a compile time check that the loop is eligible for execution on a GPU.

proc gpuClock(): uint

Returns value of a per-multiprocessor counter that increments every clock cycle. This function is meant to be called to time sections of code within a GPU enabled loop.

proc gpuClocksPerSec(devNum: int)

Returns the number of clock cycles per second of a GPU multiprocessor. Note: currently we don’t support calling this function from within a kernel.