Skip to content

HIPERFIT/nikola

 
 

Repository files navigation

Building

Nikola currently supports GHC version 7.4 and version 4.2 or above of the CUDA SDK.

The configure script will pick up nvcc if it is in your path. Make sure it matches the nvcc used by the cuda Haskell package. You can manually specify the path to nvcc during cabal configure using an argument like this:

--configure-option="--with-nvcc=/usr/local/cuda/4.2/cuda/bin/nvcc"

nvcc requires gcc 4.6 or lower. If your default system compiler is gcc 4.7 or higher, you must manually specify the path to a compatible version of gcc for nvcc to use. You can do this using the --with-nvcc-cc configure option, e.g., give the following argument to cabal configure

--configure-option="--with-nvcc-cc=/usr/bin/gcc-4.5"

I configure Nikola like this under Ubuntu 12.04 LTS x86_64 with the CUDA 4.2 SDK:

cabal configure --disable-library-profiling --enable-tests --flags="examples optimize"

Known Issues

Versions of the cuda package prior to version 5, which is not yet on hackage, can corrupt device memory pointers in some cases. If you experience CUDA errors, please install the cuda package directly from github.

Examples

Benchmarking

When benchmarking numerical code, it is recommended to use GHC's LLVM back-end. Ben Lippmeier recommend the following flags:

-fllvm -optlo-O3

He also suggests using these additional options:

-fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000

Note that these flags will improve Data.Vector performance, allowing for better comparisons with Nikola. They do not affect the speed of Nikola functions. You can build the examples with these optimization flags using cabal if you pass the additional flag --flags=optimize to cabal configure.

Black-Scholes

This version of Black-Scholes option evaluation appeared as a benchmark in Nikola: Embedding Compiled GPU Functions in Haskell. The old version of Nikola supported calling quoted CUDA code and included the CUDA SDK version of option evaluation. This is no longer supported, so the current blackscholes program only includes Nikola and vector versions.

However, Nikola now supports the generation of stand-alone functions that are callable from C. Although not built by cabal, the blackscholes-openmp and blackscholes-cuda Makefile targets are stand-alone programs that utilize Nikola-generated kernels.

American Option Evaluation

This is a Nikola implementation of Ken Friis Larsen's Haskell code for pricing American options. The original version is available on github. Thanks to Ken for the vector version and permission to distribute this as a Nikola example.

Mandelbrot

The mandelbrot example is adapted from Simon Marlow's par tutorial code and the Accelerate mandelbrot example. This version has a Repa back-end, which is the default, and a Nikola back-end, which is invoked by passing the --backend=nikola flag to the mandel program.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 80.8%
  • Shell 17.7%
  • C++ 1.5%