Nikola currently supports GHC versions 7.4 and 7.6 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"
Some versions of nvcc
require specific C compilers. You can manually specify
the path to a compatible C compiler 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 5.0.35 SDK:
autoconf && cabal configure --disable-library-profiling --enable-tests --flags="examples optimize"
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
.
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.
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.
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.