SCALE Example Programs#
These example programs are simple CUDA programs demonstrating the capabilities of SCALE.
SCALE is capable of much more, but these small demonstrations serve as a proof of concept of CUDA compatibility, as well as a starting point for users wishing to get into GPGPU programming.
List of examples#
Here is the list of examples that are currently available:
Example | What it is about |
---|---|
Basic | Usage in its simplest form |
PTX | Using PTX Assembly |
BLAS | Using BLAS maths wrapper |
Accessing the examples#
The examples are hosted in the public github repository with the rest of this manual.
git clone https://github.com/spectral-compute/scale-docs.git
cd scale-docs/examples
Using the examples#
To build an example: - Install SCALE - Decide on a GPU target - Build the example using cmake
The example repository includes a helper script, example.sh
that can fully
automate the process. Pass your SCALE target directory as the first argument,
and the example you want to build/run as the second:
# You should be in the `examples` directory of the `scale-docs` repository
./example.sh /opt/scale/targets/gfx1030 basic
For the specified example, this will:
- Remove its build directory if it already exists.
- Configure CMake for that example in a freshly-created build directory.
- Build the example in that directory using Make.
- Set the
SCALE_EXCEPTIONS=1
environment variable for better error reporting. - Run the example.