New-style Xeon Phi build
authorDavid Cock <david.cock@inf.ethz.ch>
Thu, 27 Aug 2015 14:49:02 +0000 (16:49 +0200)
committerDavid Cock <david.cock@inf.ethz.ch>
Thu, 27 Aug 2015 14:49:02 +0000 (16:49 +0200)
Signed-off-by: David Cock <david.cock@inf.ethz.ch>

hake/Config.hs.ubuntu
hake/Hakefile
hake/symbolic_targets.mk
platforms/Hakefile
tools/weever/Hakefile

index 9dc4e33..40431ba 100644 (file)
@@ -18,28 +18,37 @@ import HakeTypes
 import Data.Char
 import qualified Args
 import Data.List
+import System.FilePath
 
 --
 -- Toolchain definitions.  By default, these rely on $PATH 
 --
-arm_gcc_path = ""
-arm_gcc_prefix = "arm-linux-gnueabi-"
-arm_cc       = arm_gcc_path ++ arm_gcc_prefix ++ "gcc"
-arm_objcopy  = arm_gcc_path ++ arm_gcc_prefix ++ "objcopy"
-arm_objdump  = arm_gcc_path ++ arm_gcc_prefix ++ "objdump"
-arm_ar       = arm_gcc_path ++ arm_gcc_prefix ++ "ar"
-arm_ranlib   = arm_gcc_path ++ arm_gcc_prefix ++ "ranlib"
-arm_cxx      = arm_gcc_path ++ arm_gcc_prefix ++ "g++"
+findTool path prefix tool = path </> (prefix ++ tool)
+
+arm_gnu_path = ""
+arm_gnu_prefix = "arm-linux-gnueabi-"
+arm_gnu_tool = findTool arm_gnu_path arm_gnu_prefix
+
+arm_cc       = arm_gnu_tool "gcc"
+arm_objcopy  = arm_gnu_tool "objcopy"
+arm_objdump  = arm_gnu_tool "objdump"
+arm_ar       = arm_gnu_tool "ar"
+arm_ranlib   = arm_gnu_tool "ranlib"
+arm_cxx      = arm_gnu_tool "g++"
 
 x86_cc       = "gcc"
 x86_cxx      = "g++"
 
-k1om_cc      = "k1om-mpss-linux-gcc"
-k1om_objcopy = "k1om-mpss-linux-objcopy"
-k1om_objdump = "k1om-mpss-linux-objdump"
-k1om_ar      = "k1om-mpss-linux-ar"
-k1om_ranlib  = "k1om-mpss-linux-anlib"
-k1om_cxx     = "k1om-mpss-linux-g++"
+k1om_gnu_path = ""
+k1om_gnu_prefix = "k1om-mpss-linux-"
+k1om_gnu_tool = findTool k1om_gnu_path k1om_gnu_prefix
+
+k1om_cc      = k1om_gnu_tool "gcc"
+k1om_objcopy = k1om_gnu_tool "objcopy"
+k1om_objdump = k1om_gnu_tool "objdump"
+k1om_ar      = k1om_gnu_tool "ar"
+k1om_ranlib  = k1om_gnu_tool "ranlib"
+k1om_cxx     = k1om_gnu_tool "g++"
 
 gem5         = "gem5.fast"
 runghc      = "runghc"    -- run GHC interactively
@@ -47,7 +56,6 @@ circo      = "circo"     -- from graphviz
 dot          = "dot"       --   "    "
 inkscape     = "inkscape"
 
-
 -- path to source and install directories; these are automatically set by hake.sh at setup time 
 source_dir :: String
 -- source_dir = undefined -- (set by hake.sh, see end of file)
index b118019..ea5beee 100644 (file)
 let
   hsInDir af tf dir = inDir af tf dir ".hs"
   hakesrc = find hsInDir "."
+  hake_rtsopts = "-H128M -A4M -N4"
 in
-[ Rule ([ Str "ghc -O --make -XDeriveDataTypeable",
+[ Rule ([ Str "ghc -O --make",
+          Str "-XDeriveDataTypeable",
+          Str "-XStandaloneDeriving",
           Str "-package ghc",
+          Str "-package ghc-mtl",
           Str "-package ghc-paths",
-          Str "-rtsopts=all",
-          --Str "-with-rtsopts=\"-K32m\"",
-          Str "-with-rtsopts=\"-T\"",
+          Str "-package bytestring-trie",
           Str "-o", Out "hake" "/hake",
           Str "-outputdir", NoDep BuildTree "hake" "/",
           NStr "-i", NoDep SrcTree "src" "",
           NStr "-i", NoDep BuildTree "hake" "/",
+          Str "-rtsopts=all",
+          Str ("-with-rtsopts=\"" ++ hake_rtsopts ++ "\""),
+          Str "-threaded",
           In SrcTree "src" "Main.hs",
           Dep InstallTree "" "Config.hs",
           Str "$(LDFLAGS)"
index 9f0db70..20521b8 100644 (file)
@@ -142,6 +142,13 @@ TESTS_x86_64= \
        sbin/xcorecap \
        sbin/xcorecapserv
 
+TESTS_k1om= \
+       $(TESTS_x86) \
+       sbin/tests/dma_test \
+       sbin/tests/xeon_phi_inter \
+       sbin/tests/xeon_phi_test \
+       sbin/tests/xphi_nameservice_test
+
 # All benchmark domains
 BENCH_COMMON= \
        sbin/channel_cost_bench \
@@ -207,7 +214,6 @@ BENCH_k1om=\
        sbin/benchmarks/xphi_ump_bench \
        sbin/benchmarks/xphi_xump_bench 
 
-
 # Default list of modules to build/install for all enabled architectures
 MODULES_COMMON= \
        sbin/init \
@@ -283,7 +289,8 @@ MODULES_k1om= \
        sbin/weever \
        sbin/cpu \
        sbin/xeon_phi \
-       sbin/corectrl 
+       sbin/corectrl \
+       xeon_phi_multiboot
 
 # the following are broken in the newidc system
 MODULES_x86_64_broken= \
@@ -455,64 +462,8 @@ doxygen: Doxyfile
 #
 ######################################################################
 
-TESTS_k1om= \
-       $(TESTS_x86) \
-       sbin/tests/dma_test \
-       sbin/tests/xeon_phi_inter \
-       sbin/tests/xeon_phi_test \
-       sbin/tests/xphi_nameservice_test
-
-BENCH_k1om=\
-       $(BENCH_x86) \
-       sbin/benchmarks/bomp_mm \
-       sbin/benchmarks/dma_bench \
-       sbin/benchmarks/xomp_share \
-       sbin/benchmarks/xomp_spawn \
-       sbin/benchmarks/xomp_work \
-       sbin/benchmarks/xphi_ump_bench \
-       sbin/benchmarks/xphi_xump_bench
-
-MODULES_k1om= \
-       sbin/weever \
-       sbin/cpu \
-       sbin/xeon_phi \
-       sbin/corectrl \
-       xeon_phi_multiboot \
-
-# Objcopy utility from the Xeon Phi development tools
-K1OM_OBJCOPY?=k1om-mpss-linux-objcopy
-
-# we have to filter out the moduels that are generated below
-MODULES_k1om_filtered = $(filter-out xeon_phi_multiboot, \
-                                               $(filter-out sbin/weever,$(MODULES_k1om)))
-
-# Intel Xeon Phi-specific modules
-XEON_PHI_MODULES =\
-       $(foreach m,$(MODULES_COMMON),k1om/$(m)) \
-       $(foreach m,$(MODULES_k1om_filtered),k1om/$(m)) \
-       $(foreach m,$(BENCH_COMMON),k1om/$(m)) \
-       $(foreach m,$(TESTS_COMMON),k1om/$(m)) \
-       $(foreach m,$(BENCH_k1om),k1om/$(m)) \
-       $(foreach m,$(TESTS_k1om),k1om/$(m))
-
-menu.lst.k1om: $(SRCDIR)/hake/menu.lst.k1om
-       cp $< $@
-
-k1om/tools/weever/mbi.c: tools/bin/weever_multiboot \
-                                                k1om/xeon_phi_multiboot \
-                                                k1om/tools/weever/.marker
-       tools/bin/weever_multiboot k1om/multiboot.menu.lst.k1om k1om/tools/weever/mbi.c
-
-k1om/sbin/weever: k1om/sbin/weever.bin tools/bin/weever_creator
-       tools/bin/weever_creator ./k1om/sbin/weever.bin > ./k1om/sbin/weever
-
-k1om/sbin/weever.bin: k1om/sbin/weever_elf
-       $(K1OM_OBJCOPY) -O binary -R .note -R .comment -S k1om/sbin/weever_elf ./k1om/sbin/weever.bin
-
-k1om/xeon_phi_multiboot: $(XEON_PHI_MODULES) menu.lst.k1om
-       $(SRCDIR)/tools/weever/multiboot/build_data_files.sh menu.lst.k1om k1om
-
-
+#k1om/sbin/weever: k1om/sbin/weever_elf
+#      $(K1OM_OBJCOPY) -O binary -R .note -R .comment -S k1om/sbin/weever_elf ./k1om/sbin/weever
 
 ################################################################################
 #
index 936f49b..1e7102e 100644 (file)
 --------------------------------------------------------------------------
 
 let bin_rcce_lu = [ "/sbin/" ++ f | f <- [ 
-       "rcce_lu_A1",
-       "rcce_lu_A2",
-       "rcce_lu_A4",
-       "rcce_lu_A8",
-       "rcce_lu_A16",
-       "rcce_lu_A32",
-       "rcce_lu_A64" ]]
+                        "rcce_lu_A1",
+                        "rcce_lu_A2",
+                        "rcce_lu_A4",
+                        "rcce_lu_A8",
+                        "rcce_lu_A16",
+                        "rcce_lu_A32",
+                        "rcce_lu_A64" ]]
 
     bin_rcce_bt = [ "/sbin/" ++ f | f <- [ 
-       "rcce_bt_A1",
-       "rcce_bt_A4",
-       "rcce_bt_A9",
-       "rcce_bt_A16",
-       "rcce_bt_A25",
-        "rcce_bt_A36" ]]
+                        "rcce_bt_A1",
+                        "rcce_bt_A4",
+                        "rcce_bt_A9",
+                        "rcce_bt_A16",
+                        "rcce_bt_A25",
+                        "rcce_bt_A36" ]]
 
     tests_common = [ "/sbin/" ++ f | f <- [
                         "fputest",
@@ -39,8 +39,8 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
                         "yield_test" ] ]
 
     tests_x86 = [ "/sbin/" ++ f | f <- [ 
-                    "tests/luatest",
-                    "tests/numatest" ] ]
+                        "tests/luatest",
+                        "tests/numatest" ] ]
 
     tests_x86_64 = [ "/sbin/" ++ f | f <- [ 
                         "arrakis_hellotest",
@@ -80,12 +80,18 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
 
     tests_x86_32 = tests_x86
 
+    tests_k1om = [ "/sbin/" ++ f | f <- [
+                        "tests/dma_test",
+                        "tests/xeon_phi_inter",
+                        "tests/xeon_phi_test",
+                        "tests/xphi_nameservice_test" ] ] ++ tests_x86
+
     bench_common = [ "/sbin/" ++ f | f <- [ 
-                       "channel_cost_bench",
-                       "flounder_stubs_buffer_bench",
-                       "flounder_stubs_empty_bench",
-                       "flounder_stubs_payload_bench",
-                       "xcorecapbench" ]]
+                        "channel_cost_bench",
+                        "flounder_stubs_buffer_bench",
+                        "flounder_stubs_empty_bench",
+                        "flounder_stubs_payload_bench",
+                        "xcorecapbench" ]]
 
     bench_x86 =  [ "/sbin/" ++ f | f <- [ 
                       "multihop_latency_bench",
@@ -134,6 +140,14 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
 
     bench_x86_32 = bench_x86 ++ bin_rcce_bt ++ bin_rcce_lu
 
+    bench_k1om = [ "/sbin/" ++ f | f <- [ 
+                        "benchmarks/bomp_mm",
+                        "benchmarks/dma_bench",
+                        "benchmarks/xomp_share",
+                        "benchmarks/xomp_spawn",
+                        "benchmarks/xomp_work",
+                        "benchmarks/xphi_ump_bench",
+                        "benchmarks/xphi_xump_bench" ] ] ++ bench_x86
 
     -- Default list of modules to build/install for all enabled architectures
     modules_common = [ "/sbin/" ++ f | f <- [ 
@@ -238,6 +252,12 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
                            "sshd",
                            "corectrl" ]] ++ bin_rcce_bt ++ bin_rcce_lu
 
+    modules_k1om = [ "/sbin/" ++ f | f <- [
+                        "weever",
+                        "cpu",
+                        "xeon_phi",
+                        "corectrl" ] ]
+
     -- ARMv7-a Pandaboard modules
     pandaModules = [ "/sbin/" ++ f | f <- [
                         "cpu_omap44xx",
@@ -290,8 +310,6 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
                        ] ]
   in
  [
-
-
    --
    -- Rules to build assorted platforms
    --
@@ -332,6 +350,24 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
        [ ("",       f) | f <- modules_generic])
       "32-bit x86 PC build with benchmarks and test suites",
 
+    platform "K1OM_Basic" [ "k1om" ]
+      ([ ("k1om", f) | f <- modules_k1om ]
+       ++
+       [ ("",       f) | f <- modules_generic])
+      "Basic Xeon Phi build",
+
+    platform "K1OM_Benchmarks" [ "k1om" ]
+      ([ ("k1om", f) | f <- modules_k1om ++ bench_k1om]
+       ++
+       [ ("",       f) | f <- modules_generic])
+      "Xeon Phi build with benchmarks",
+
+    platform "K1OM_Full" [ "k1om" ]
+      ([ ("k1om", f) | f <- modules_k1om ++ bench_k1om ++ tests_k1om ]
+       ++
+       [ ("",       f) | f <- modules_generic])
+      "Xeon Phi build with benchmarks and test suites",
+
     platform "PandaboardES" [ "armv7" ]
     ([ ("armv7", f) | f <- pandaModules ] ++ [ ("root", "/pandaboard_image") ])
     "Standard Pandaboard ES build image and modules",
@@ -504,4 +540,3 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
     "Boot QEMU as an ARM11MPCore-based Realview board"
     
  ]
-     
index 0134241..0784afb 100644 (file)
@@ -83,6 +83,12 @@ let arch = "k1om"
 in 
   [ compileCFiles opts [ "loader.c", "lib.c", "elf64.c" ],
     assembleSFiles opts [ "boot.S" ],
-    link opts objs [] "weever_elf"
+    link opts objs [] "weever_elf",
+    Rule [ Str Config.k1om_objcopy,
+           Str "-O binary",
+           Str "-R .note",
+           Str "-R .comment",
+           In BuildTree "k1om" "/sbin/weever_elf",
+           Out "k1om" "/sbin/weever" ]
   ]