Installation

Prerequisites


Alea GPU requires a CUDA-capable GPU with compute capability 2.0 or higher.

Check the web site CUDA GPU overview to find out which products support CUDA and have a compute capability 2.0 or higher. The NVIDIA Control Panel in the Windows Control Panel gives additonal details about the GPU hardware on the system.

To use Alea GPU install

For debugging and profiling install

Note that the installation of the CUDA Toolkit is not mandatory.

Download and Install from NuGet


Alea GPU consists of several assemblies, tools and resources, organized in multiple NuGet packages.

The package Alea installs the Alea GPU JIT compiler that translates IL code or F# quotations to GPU code.

PM> Install-Package Alea

The package Alea.Fody installs the developing-time tools, such as instrumentation tool for Automatic Memory Management.

PM> Install-Package Alea.Fody

Linux


To verify if your GPU qualifies as a CUDA capable GPU execute

lspci | grep -i nvidia

to list all NVIDIA devices.

Mac OS X


In general, only iMac, MacBook Pro and Mac Pro machines have CUDA-capable GPUs. Some of these models may have AMD GPUs that are not CUDA-compatible. To find out the GPU type of your Mac, go to About This MacDisplays and the GPU name will appear.

  • Mac OS X 10.8 Mountain Lion or later
  • Mono 64 bit
  • IDE Xamarin Studio

License Installation


The Alea GPU Community Edition does not require a license to be installed. However, the Alea GPU Commercial Edition requires a license, which has to be installed with the license manager tool provided in the Alea package. It is a .NET command-line tool and runs on Windows or POSIX systems with Mono.

License Repository

By default, all licenses are stored in the folder %LocalAppData%\Alea.GPU\LicenseRepository.

Install License

To install a license:

LicenseManager.exe install -l [LicenseCode]

List Licenses

To list all installed licenses:

LicenseManager.exe list

This command will list all licenses installed on the system.

>LicenseManager.exe list
LicenseManager, [WIN-DUALGPU-3], 03.10.2016 13:58:45
ef73c6092564 9gCAAN9UR3YN R1 EXP[30.09.2017 02:00:00] V2 LM1 F[CP;RT;CSM;MOB;ENP] P[] DC[RST(0)] [Valid]

This information helps us to identify license installation issues in case you face difficulties using Alea GPU.

Generate Machine Id

For off-line license activation a machine id is required. It is generated as follows:

LicenseManager.exe machineid

The output should look as follows:

>LicenseManager.exe machineid
LicenseManager, [WIN-DUALGPU-3], 03.10.2016 12:59:52
[MachineId]
1: 5823aa3a3cbfa0f5d0fe2494ccce9d3de1e7d690f6cb01877a98c07beb848aa...
2: cbfb2ff3c194b7134d08f29ad5019e29c6d16f89ec772a236ab5f27ae741a7f...

The first line lists the host name and the time. It then lists the machine id for this machine consisting of two keys. You have to generate a machine id for each of your target machines. Please return the full output to us, in case you want to order a node locked off-line activated license.

List GPUs

To list all the GPUs you have installed in your target machine:

LicenseManager.exe gpus 

It outputs the installed GPUs together with some

> LicenseManager.exe gpus
LicenseManager, [WIN-DUALGPU-3], 03.10.2016 12:59:46
-  0 [Enterprise] Tesla K40c, SM 3.5, 11519 MB RAM, 2880 Cores
*  1   [Consumer] GeForce GTX TITAN Black, SM 3.5, 6144 MB RAM, 2880 Cores

The first line lists the host name and the time. It then lists all the GPUs compatible with Alea GPU and provides the following informatons:

  • Flag identifying the default GPU, which is marked with a *
  • Device id
  • GPU classification
  • GPU name
  • Compute capability
  • GPU device memory size
  • Number of CUDA Cores

Clean License Repository

To remove all expired or invalid licenses (which might be installed using wrong machine id) execute

LicenseManager.exe clean 

Alea GPU Resources and Deployment


Alea GPU Resources

JIT compilation requires extra resources. They are embedded in several assemblies for different GPUs or host architectures and platforms. These assemblies are called resource assemblies and are shipped in the Alea package tools folder. These extra resources can be classified as:

  • Libraries for GPU devices, provided as LLVM intermediate representation (IR) module, used to link with user GPU code together to PTX code. These resources are GPU architecture dependent, where the GPU architecture is classified by the GPU compute capability. Currently, there is a library of device functions called LibDevice. The resource assembly for this library is Alea.CUDA.CT.LibDevice.dll.
  • Host native libraries and tools, such as the LLVM library and the NVVM compiler. These resources are embedded in several resource assemblies according to different host architectures, bitness and operating systems. These resource assemblies are named following the pattern Alea.CUDA.CT.Native.HOSTARCH.BITNESS.OS.dll, where HOSTARCH is the architecture, BITNESS is the bitness and OS is the operating system.

These resources must be extracted before they can be used. Alea GPU searches extracted resources in two locations:

  • Resource path: a path containing sub-folders which hold extracted resources
  • Resource assembly path: a path containing resource assemblies for different GPUs and hosts

During JIT compilation, Alea GPU uses the following work flow to find the extracted resource:

Resource finding flow

Deployment Considerations

At the installation of the Alea NuGet package, an MSBuild task is added into your project. This task is used to extract the resources into the project output folder. To deploy an application, the extracted resources for all the platforms on which the application is intended to run need to be deployed as well. Alternatively, the resources can be deployed to a shared location. The configuration of Alea GPU to find the resources at the shared location is discussed below.

Using Alea GPU to develop libraries requires some additional considerations. Assume a library uses Alea GPU and references the Alea NuGet package directly. If an application references this library and uses its functionality, the .NET compilation passes without having installed the Alea NuGet package. However, at runtime an exception is thrown telling that some resource assemblies are missing. The reason for this is that the native resources are not extracted to the output folder of the application. The problem is solved by also installing the Alea NuGet package for the application.

Instead of deploying the extracted resources is also possible to deploy the resource assemblies themselves. Copy the resource assemblies from tools folder of the Alea NuGet package to a desired resource folder. Make sure that this resource folder has write permission so that the resources can be extracted into it. Then delete the extracted resources in the project output folder. Make sure that the Alea GPU resource path is configured accordingly.

On POSIX systems, such as Linux and Mac OS X, the platform specific resources include the executable program aleanvvm. If this file is copied or deployed, the execute permissions need to be maintained.

Configuring Alea GPU Resource Paths

The resource related paths can be configured in the app.config file under Alea.Settings. The configuration definitions can contain variables such as @base, which represents the base directory of the current application, or @cwd, which represents the current working directory.

  • Resource path: set by <resource path="..."/> with a default value of @base
  • Resource assembly path: set by <resource assemblyPath="..."/> with a default value of @base

Here is an example of an app.config file to configure the resource path:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="aleaSettings" type="Alea.Settings, Alea"/>
  </configSections>
  <aleaSettings>
    <resource path="@base" assemblyPath="@base"/>
  </aleaSettings>
</configuration>