Alea GPU Tutorial
This project contains tutorial and samples of Alea GPU compiler. It uses literal programming with F# Formatting to code samples and then generates the documentation directly from the source code. The generated documentation can be found here: Alea GPU Tutorial.
How to build
Before building the solution, please make sure you have a proper JIT license installed.
If you have one and only one GeForce GPU device attached to your host, then you can follow these steps to verify and install a free community license:
- go to your solution folder and restore packages:
- in your solution folder, run the following command to verify an installed license for the current user:
- verify the output, you need a valid compilation license which supports GeForce GPUs
- if you don't have a community license, follow these steps to install one for free:
- go to QuantAlea website, sign in or sign up for an account
- then go to My Licenses page, to get your free community license code
- in your solution folder, run the following command to install your community license:
packages\Alea.CUDA\tools\LicenseManager.exe install -l %your_license_code%
- verify the installed license again via:
For more details on licensing, please reference:
This project uses Paket for package management.
To build on Windows, open a command prompt and navigate to your solution folder. Now simply run
build.bat (on Linux and OsX run
build.sh) and the script will execute the following steps:
- download the latest version of
paket.exe restoreto restore the packages listed in the
- build projects;
- run tests;
- generate documentation (only on Windows);
The build script accepts the arguments NoTests and NoDocs which can be used like so:
build.bat NoTeststo skip running the tests;
build.bat NoDocsto skip documentation generation;
build.bat NoTests NoDocsto only build the projects;
Running the tests and generating the documentation are both fairly lengthly processes (especially running the tests). Usually you will want to use
build.bat NoTests NoDocs for your general troubleshooting and save the full build for doing a final verification of your work.
Once you have all of the projects built you can:
docs\output\index.htmlfor the generated documentation;
release\Tutorial.FS.exe <name>to run example
<name>written in F#.
release\Tutorial.CS.exe <name>to run example
<name>written in C#.
release\Tutorial.VB.exe <name>to run example
<name>written in VB.
release\Tutorial.VB.exeto see more examples.
- Explore the source code with Visual Studio and run unit tests.
Before building within Visual Studio, it is recommended that you restore the packages prior to opening the solution. This is due to a known issue of using Fody with F# projects. You can find further details about this issue in the installation manual (especially the Remarks section)).
To build within Visual Studio, please follow following steps:
- navigate to your solution folder and restore packages:
- open then solution with Visual Studio and then build it using the
- set the debug argument to one example, such as
- run/debug the tutorial program
How to collaborate
We use the light git-flow workflow for collaboration. Using the light git-flow means that the main development branch is
master (as opposed to develop), and that all feature branches should be rebased along with the creation of a merge commit onto the
master branch. This can also be done by a GitHub pull request.
How to upgrade packages
To upgrade packages, follow these steps:
- edit the
paket.dependenciesfile by changing the packages or their versions; alternatively, you can use
paket install(see here)
paket update --redirects(see here)
package add nuget <name> -ito add the
<name>package to your project (see here)
- commit your changed files (
paket.dependencies) and your modified project files.
If you rebase your branch onto the master branch and the packages have been upgraded, follow these steps:
- shutdown Visual Studio if the project is opened in Visual Studio
- do rebasing on your branch
.paket\paket.exe restoreor simply run
- open the Visual Studio again
The reason why we need to close Visual Studio is because AleaGPU uses the Fody plugin. Fody is a build plugin and Visual Studio will use it in the build process; if the Fody package has been upgraded, it cannot be written to the