Documentation

This page describes how to install Ikra as well as its basic usage.

Prerequisites

Before installing Ikra using one of the following two ways, make sure that the following prerequisites are installed on your system.

Before proceeding with the installation, make sure that you have the nvcc and the include directories required by Ikra: NVIDIA_CUDA-*.*_Samples/common/inc and cuda-*.*/extras/CUPTI/include. Ikra will attempt to figure out the paths automatically, but you can also specify them manually later.

Installation via RubyGems

If you are interested in using Ikra, this is the easiest way to install it. Follow these steps.

  1. Install Ikra gem: gem install ikra
  2. Give it a try and see if it works. Run the following code in irb.
    
    require "ikra"
    
    test_array = Array.pnew(100) do |i|
        i + 1000
    end
    
    puts test_array[0]
            

Installation via GitHub

This guide describes how to install the current Ikra version from GitHub. First, make sure that the prerequisites are installed.

Ikra should also work on Mac and Windows, but some modifications in the source code might be necessary. The generated C++/CUDA source code occasionally uses non-standard statement expressions which are only supported by the GNU C compiler.

Follow the these steps.

  1. Get Ruby source code: git clone https://github.com/prg-titech/ikra-ruby.git
  2. Download submodules: git submodule init, then git submodule update
  3. Install Bundler (Ruby dependency management): gem install bundler
  4. Install Ikra dependencies: bundle install
  5. (Optional) Run tests: rake test

Manual Path Setup

If Ikra's autoconfiguration fails, you can set up the nvcc and include paths manually.


require "ikra"

# Set paths before using Ikra
Ikra::Configuration.auto_config = false
Ikra::Configuration.cuda_manual_nvcc = "/usr/local/cuda-8.0/bin/nvcc"
Ikra::Configuration.cuda_manual_common_include = "/home/matthias/NVIDIA_CUDA-7.5_Samples/common/inc"
Ikra::Configuration.cuda_manual_cupti_include = "/usr/local/cuda-7.5/extras/CUPTI/include"

test_array = Array.pnew(100) do |i|
    i + 1000
end

# If you want to change paths later, you have to call `Ikra::Configuration.reinitialize!`
puts test_array[0]