harness: adding test for xeon phi boot
authorReto Achermann <reto.achermann@inf.ethz.ch>
Mon, 22 Jun 2015 09:28:08 +0000 (11:28 +0200)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Mon, 22 Jun 2015 09:28:08 +0000 (11:28 +0200)
Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

tools/harness/barrelfish.py
tools/harness/builds.py
tools/harness/machines/eth.py
tools/harness/machines/eth_machinedata.py
tools/harness/tests/xeonphi.py [new file with mode: 0644]

index 19118c8..2f0d2c7 100644 (file)
@@ -9,6 +9,7 @@
 
 import os.path
 import builds
+import re
 
 class BootModules(object):
     """Modules to boot (ie. the menu.lst file)"""
@@ -129,20 +130,27 @@ def default_bootmodules(build, machine):
     if a == "x86_64" or a == "x86_32":
         m.add_module("%s/sbin/acpi" % a, ["boot"])
         m.add_module("/skb_ramfs.cpio.gz", ["nospawn"])
-        m.add_module("%s/sbin/kaluga" % a, ["boot"])
         m.add_module("%s/sbin/routing_setup" %a, ["boot"])
         m.add_module("%s/sbin/corectrl" % a, ["auto"])
 
+        is_babybel = 0
+        if re.search("babybel[1-4]|xeon_phi_[1-4]", machine.name) :
+            is_babybel = 1
+
         if machine.name == "sbrinz1" or machine.name == "sbrinz2" \
         or machine.name == "tomme1" or machine.name == "tomme2" \
-        or machine.name == "babybel1" or machine.name == "babybel2" \
-        or machine.name == "babybel3" :
+        or is_babybel == 1 :
             # PCI allocation broken, use BIOS plan
             m.add_module("%s/sbin/pci" % a, ["auto",
                                              "skb_bridge_program=bridge_bios"])
         else:
             m.add_module("%s/sbin/pci" % a, ["auto"])
 
+        if is_babybel :
+            m.add_module("%s/sbin/kaluga" % a, ["boot", "eth0=4:0:0"])
+        else :
+            m.add_module("%s/sbin/kaluga" % a, ["boot"])
+
     if a == "armv7":
        if machine.get_ncores() == 2:
                m.add_module("corectrl", ["boot", "1"])
index 80e19ee..c42eb2c 100644 (file)
@@ -10,6 +10,8 @@
 import sys, os, errno, re
 import debug
 
+MPSS_LINUX_PATH=':/opt/mpss/3.4/sysroots/x86_64-mpsssdk-linux/usr/bin:/opt/mpss/3.4/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux'
+
 
 class Build(object):
     name = None # should be overriden by a subclass
@@ -104,6 +106,8 @@ class HakeBuildBase(Build):
 
     def configure(self, checkout, archs):
         srcdir = checkout.get_base_dir()
+        if "k1om" in archs :
+            os.environ['PATH'] = os.environ['PATH'] + MPSS_LINUX_PATH
         self._make_build_dir()
         self._write_hake_conf(srcdir, archs)
         self._run_hake(srcdir, archs)
index 7e275b0..d038ea8 100644 (file)
@@ -38,12 +38,24 @@ class ETHMachine(Machine):
     def get_ncores(self):
         return self._eth_machines[self.name]['ncores']
 
+    def get_host_ncores(self):
+        if 'host_ncores' in self._eth_machines[self.name] :
+            return self._eth_machines[self.name]['host_ncores']
+        else :
+            return self._eth_machines[self.name]['ncores']
+
     def get_cores_per_socket(self):
         return self._eth_machines[self.name]['cores_per_socket']
 
     def get_tickrate(self):
         return self._eth_machines[self.name]['tickrate']
 
+    def get_host_tickrate(self):
+        if 'host_tickrate' in self._eth_machines[self.name] :
+            return self._eth_machines[self.name]['host_tickrate']
+        else :
+            return self._eth_machines[self.name]['tickrate']
+
     def get_perfcount_type(self):
         return self._eth_machines[self.name]['perfcount_type']
 
index 308a1e3..1aff589 100644 (file)
@@ -289,7 +289,51 @@ machines = dict({
                    'perfcount_type'  : 'intel',
                    'tickrate'        : 2500,
                    'boot_timeout'    : 360},
-
+    'xeon_phi_1': {'ncores'          : 64,
+                   'nphi'            : 2,
+                   'host_ncores'     : 20,
+                   'machine_name'    : 'babybel1',
+                   'bootarch'        : 'x86_64',
+                   'buildarchs'      : ['k1om', 'x86_64'],
+                   'cores_per_socket': 10,
+                   'perfcount_type'  : 'intel',
+                   'tickrate'        : 1140,
+                   'host_tickrate'   : 2500,
+                   'boot_timeout'    : 360}, 
+    'xeon_phi_2': {'ncores'          : 64,
+                   'nphi'            : 2,
+                   'host_ncores'     : 20,
+                   'machine_name'    : 'babybel2',
+                   'bootarch'        : 'x86_64',
+                   'buildarchs'      : ['k1om', 'x86_64'],
+                   'cores_per_socket': 10,
+                   'perfcount_type'  : 'intel',
+                   'tickrate'        : 1140,
+                   'host_tickrate'   : 2500,
+                   'boot_timeout'    : 360},
+    'xeon_phi_3': {'ncores'          : 64,
+                   'nphi'            : 2,
+                   'host_ncores'     : 20,
+                   'machine_name'    : 'babybel3',
+                   'bootarch'        : 'x86_64',
+                   'buildarchs'      : ['k1om', 'x86_64'],
+                   'cores_per_socket': 10,
+                   'perfcount_type'  : 'intel',
+                   'tickrate'        : 1140,
+                   'host_tickrate'   : 2500,
+                   'boot_timeout'    : 360},
+    'xeon_phi_4': {'ncores'          : 64,
+                   'nphi'            : 2,
+                   'host_ncores'     : 20,
+                   'machine_name'    : 'babybel4',
+                   'bootarch'        : 'x86_64',
+                   'buildarchs'      : ['k1om', 'x86_64'],
+                   'cores_per_socket': 10,
+                   'perfcount_type'  : 'intel',
+                   'tickrate'        : 1140,
+                   'host_tickrate'   : 2500,
+                   'boot_timeout'    : 360},
+                   
     # SK: For Python 2.7
     # }.items() + { 
     #     'brie%s' % b: {
diff --git a/tools/harness/tests/xeonphi.py b/tools/harness/tests/xeonphi.py
new file mode 100644 (file)
index 0000000..3624823
--- /dev/null
@@ -0,0 +1,119 @@
+##########################################################################
+# Copyright (c) 2009, ETH Zurich.
+# All rights reserved.
+#
+# This file is distributed under the terms in the attached LICENSE file.
+# If you do not find this file, copies can be found by writing to:
+# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
+##########################################################################
+
+# MAKEOPTS=-j12 ./scalebench.py -m xeon_phi_1 -B /mnt/local/acreto/barrelfish/build -t xeon_phi_spawn /mnt/local/acreto/barrelfish/ /mnt/local/acreto/harness-results/ -v
+
+
+import re, os, sys, debug, shutil, datetime
+
+import tests
+from common import TestCommon
+from barrelfish import BootModules
+from results import PassFailResult
+
+XEON_PHI_IMAGE_NFS="nfs://10.110.4.4/mnt/local/nfs/barrelfish/xeon_phi/"
+XEON_PHI_IMAGE_LOCATION="/mnt/local/nfs/barrelfish/xeon_phi/"
+#module /acreto/x86_64/sbin/xeon_phi_mgr
+
+@tests.add_test
+class XeonPhi_Spawn_test(TestCommon):
+    '''Xeon Phi Spawn test'''
+    name = "xeon_phi_spawn"
+
+    image_dir=XEON_PHI_IMAGE_NFS
+    nfs_dir=XEON_PHI_IMAGE_LOCATION
+    nphi = 2
+
+    def set_xeon_phi_bootmodules(self, build_dir, machine):
+        fullpath = os.path.join(build_dir, 'menu.lst.k1om')
+        f = open(fullpath, 'a')
+        f.write("\n")
+        # put additional modules here
+        f.close()
+
+
+    def setup(self, build, machine, testdir) :
+       
+        # setup xeon phi nfs directory
+
+        timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
+        run_name = "harness_" + str(timestamp)
+        self.image_dir = os.path.join(XEON_PHI_IMAGE_LOCATION, run_name)
+        self.nfs_dir=os.path.join(XEON_PHI_IMAGE_NFS, run_name)
+
+        debug.verbose('creating image directory' + self.image_dir)
+        os.makedirs(self.image_dir)
+
+        # setup menu.lst.k1om
+        menulst = os.path.join(build.build_dir, "menu.lst.k1om")
+        if (os.path.isfile(menulst)) :
+            os.remove(menulst)
+        debug.checkcmd(["make", "menu.lst.k1om"], cwd=build.build_dir)
+        self.set_xeon_phi_bootmodules(build.build_dir, machine)
+
+        debug.checkcmd(["make", "k1om/sbin/weever"], cwd=build.build_dir)
+
+        super(XeonPhi_Spawn_test, self).setup(build, machine, testdir)
+
+    def run(self, build, machine, testdir):
+        xphi_img = os.path.join(build.build_dir, 'k1om/xeon_phi_multiboot')
+
+        debug.verbose('copying xeon phi <' + xphi_img + '>image to ' + self.image_dir)
+        shutil.copy(xphi_img, self.image_dir)
+
+        xphi_img = os.path.join(build.build_dir, 'k1om/sbin/weever')
+
+        debug.verbose('copying xeon phi <' + xphi_img + '>image to ' + self.image_dir)
+        shutil.copy(xphi_img, self.image_dir)
+        
+        return super(XeonPhi_Spawn_test, self).run(build, machine, testdir)
+
+    def cleanup(self, machine):
+        # remove the xeon phi image directory
+        debug.verbose('removing ' + self.image_dir)
+        shutil.rmtree(self.image_dir, ignore_errors=True)
+        super(XeonPhi_Spawn_test, self).cleanup(machine)        
+
+    def get_modules(self, build, machine):
+        modules = super(XeonPhi_Spawn_test, self).get_modules(build, machine)
+        modules.add_module("xeon_phi_mgr", [""])
+        modules.add_module("xeon_phi", ["auto", 
+                                        "--nfs=" + self.nfs_dir])
+        modules.add_module("e1000n", ["auto", "noirq"])
+        modules.add_module("NGD_mng", ["auto"])
+        modules.add_module("netd", ["auto"])
+        modules.add_module("dma_mgr", [""])
+
+        return modules
+
+    def is_finished(self, line):
+        #m = re.search("Xeon Phi operational: xeon_phi.([0-9]).ready", line)
+        m = re.search("Xeon Phi operational: xeon_phi.1.ready", line)
+        if m :
+            return True
+        else :
+            return False        
+
+    def get_finish_string(self):
+        return "Xeon Phi operational: xeon_phi.([0-9]).ready"
+
+    def boot(self, *args):
+        super(XeonPhi_Spawn_test, self).boot(*args)
+#        self.set_timeout(NFS_TIMEOUT)
+
+    def process_data(self, testdir, rawiter):
+        # the test passed iff the last line is the finish string
+        lastline = ''
+        passed = False;
+        for line in rawiter:
+            m = re.search("Xeon Phi operational: xeon_phi.1.ready", line)
+            if m :
+                passed = True
+               
+        return PassFailResult(passed)