Changes between Version 1 and Version 2 of Flow/Building


Ignore:
Timestamp:
Jan 27, 2014, 8:54:51 AM (11 years ago)
Author:
Ben Lippmeier
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Flow/Building

    v1 v2  
    11= Building the Repa Plugin =
     2
     3== Install LLVM and GHC head ==
     4Start with GHC head and LLVM 3.4 in your `$PATH`.
     5
     6LLVM 3.1 also works (and probably other versions).
     7
     8Leave the GHC head build in-place, soft link `$GHC/inplace/bin/ghc-stage2` to `$GHC/inplace/bin/ghc` and then put the whole `$GHC/inplace/bin` directory in your `$PATH`. This way you also get `ghc-pkg` and other tools in your `$PATH`.
     9
     10{{{
     11 $ ghc --version
     12 The Glorious Glasgow Haskell Compilation System, version 7.7.20140126
     13
     14 $ ghc-pkg --version
     15 GHC package manager version 7.7.20140126
     16
     17 $ opt --version
     18 LLVM version 3.4
     19 ...
     20}}}
     21
     22==  Update the cabal database ==
     23Update your cabal database so you don't inadvertently install old library versions.
     24{{{
     25$ cabal update
     26}}}
     27
     28
     29== Download and build the DDC head ==
     30Clone the DDC head repo.
     31
     32{{{
     33$ git clone https://github.com/DDCSF/ddc
     34}}}
     35
     36Install external dependencies for DDC.
     37
     38{{{
     39$ cd ddc
     40$ cabal install `make show-pkgs` --enable-shared
     41}}}
     42
     43The DDC `make show-pkgs` target lists what external Hackage packages DDC needs.
     44We need to use `--enable-shared` to build shared libraries that will work with the Repa plugin.
     45
     46Now build the DDC packages and register them with Cabal.
     47{{{
     48$ make packages
     49}}}
     50
     51Note that just using `make` here will build DDC locally, but we won't get Cabal packages registered with the GHC development build. We need these when building the Repa plugin.
     52
     53
     54
     55== Download and build the Repa head ==
     56
     57Clone the Repa head repo.
     58
     59{{{
     60$ cd ..
     61$ git clone https://github.com/DDCSF/repa
     62}}}
     63
     64Install the Repa packages.
     65
     66{{{
     67$ cd repa
     68$ make plugin
     69}}}
     70
     71Doing this should also install the `QuickCheck` and `bmp` packages as dependencies. After this step you should have the following cabal libraries installed, on top of the ones that come with the GHC development build.
     72
     73{{{
     74$ ghc-pkg list
     75...
     76  QuickCheck-2.6
     77  bmp-1.2.5.2
     78  buildbox-2.1.3.1
     79  ddc-base-0.3.3.0
     80  ddc-build-0.3.3.0
     81  ddc-code-0.3.3.0
     82  ddc-core-0.3.3.0
     83  ddc-core-eval-0.3.3.0
     84  ddc-core-flow-0.3.3.0
     85  ddc-core-llvm-0.3.3.0
     86  ddc-core-salt-0.3.3.0
     87  ddc-core-simpl-0.3.3.0
     88  ddc-core-tetra-0.3.3.0
     89  ddc-driver-0.3.3.0
     90  ddc-interface-0.3.3.0
     91  ddc-source-tetra-0.3.3.0
     92  mtl-2.1.2
     93  parsec-3.1.5
     94  repa-3.2.3.4
     95  repa-io-3.2.3.4
     96  repa-plugin-1.0.1.0
     97  repa-series-1.0.1.0
     98  stm-2.4.2
     99  text-1.1.0.0
     100  wl-pprint-1.1
     101}}}
     102
     103== Using the repa-plugin ==
     104
     105Compile one of the tests using the Repa plugin:
     106
     107{{{
     108 $ cd repa-plugin/test/90-Benchmarks/repa/FilterMax
     109 $ ghc -fforce-recomp -O2 -fllvm -optlo-O3 \
     110    --make Main.hs \
     111    -fplugin=Data.Array.Repa.Plugin \
     112    -fplugin-opt=Data.Array.Repa.Plugin:dump
     113}}}
     114
     115The ':dump' flag tells the plugin to drop the intermediate code at several points along the compilation pipeline. You should get a stack of `dump.*` files in the current directory.
     116
     117
     118== Run the repa-plugin test ==
     119
     120Run the version using flow fusion.
     121
     122{{{
     123$ ./Main flow 100000000
     124elapsedTimeMS   = 281
     125cpuTimeMS       = 280
     126}}}
     127
     128Run the version using stream fusion.
     129
     130{{{
     131$ ./Main vector 100000000
     132elapsedTimeMS   = 319
     133cpuTimeMS       = 320
     134}}}
     135
     136
     137== Running DDC Flow Fusion tests ==
     138
     139Although the repa-plugin is invoked via GHC, the actual flow fusion transforms are done on the DDC Core language. There are tests for the low-level transforms in the DDC repo.
     140
     141Go back to the root of the DDC build.
     142
     143{{{
     144$ cd $DDC
     145}}}
     146
     147Set the number of threads for a parallel build (substitute 8 => whatever)
     148
     149{{{
     150$ echo THREADS=8 > make/config-override.mk
     151}}}
     152
     153Build DDC locally and run all the regression tests.
     154
     155{{{
     156$ make war
     157}}}
     158
     159The flow fusion tests are in `$DDC/test/ddc-main/60-CoreFlow`
     160
     161{{{
     162$ cat test/ddc-main/60-CoreFlow/30-Scalar/20-Map/Test.dcx
     163$ cat test/ddc-main/60-CoreFlow/30-Scalar/20-Map/Test.stdout.check
     164}}}
     165
     166We can also run individual tests manually.
     167
     168{{{
     169$ bin/ddci-core test/ddc-main/60-CoreFlow/30-Scalar/20-Map/Test.dcx
     170}}}
     171