/par-tree

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

par-tree

The aim of the project is to implement the method from The key to a data parallel compiler in Haskell and research it. The expected result of the research is a library that enables one to implement a parallel compiler without bothering of parallelizing computations on AST by themselves.

Dependencies

See the Dependancies section.

LLVM 9 must be installed

Installing LLVM 9 on Mac

Accelerate has its own brew formula to install LLVM 9 properly. It should be used to install llvm:

brew tap llvm-hs/llvm
brew install llvm-hs/llvm/llvm-9

It will take some time to build and install LLVM 9 this way.

Pop OS

When using Pop OS cuda can be installed with the following command:

sudo apt install system76-cuda-latest
# Or, even better, first install apt-fast which will speed up your download and use it
apt-fast -y install system76-cuda-latest

The installation might not set the links to the needed files, so the build of this project will fail. This can be fixed by:

  1. Add /use/lib/cuda/bin to your PATH in your .bashrc/.zshrc/etc.:
export PATH=$PATH:/usr/lib/cuda/bin
  1. Put symbolic link to libnvvm to the location where it can be found by a linker:
sudo ln -s /usr/lib/cuda/nvvm/lib64/libnvvm.so.4 /usr/lib/
sudo ldconfig

Building the project and running it

The proejct can be built to run either using a CPU or GPU backend.

Using CPU backend

  1. Build the project without gpu flag:

    stack build --flag par-tree:-gpu
    # Or just
    stack build  # since gpu flag is set to false by default
  2. Run the built executable:

    stack exec par-tree-exe

Using GPU backend

  1. Build the project with gpu flag:

    stack build --flag par-tree:gpu
  2. Run the built executable:

    stack exec par-tree-exe