Beispiel #1
0
    def test1(self):
        # remove the output directory
        if os.path.exists(outputdir):
            shutil.rmtree(outputdir)
        
        # build the command to ru
        cmd = ['python E_monitor_TestCase_app2.py']
        if usempi():
            cmd.append('--%s.nodes=2' % launcher)
        cmd = ' '.join(cmd)
        
        # run command
        if os.system(cmd):
            raise RuntimeError, "%s failed" % cmd

        # checks
        import time
        ctime = time.time()

        #check output directory exists
        self.assert_( os.path.exists( outputdir ) )
        
        # make sure that the final histogram is identical to the 
        # sum of all the final histograms in different nodes
        from histogram.hdf import load
        from histogram.hdf.utils import getOnlyEntry
        p = os.path.join(outputdir, 'IE.h5')
        h = load(p, getOnlyEntry(p))
        
        self.assertEqual(h.I.sum(), 1)
        return
Beispiel #2
0
    def test1(self):
        # remove the output directory
        if os.path.exists(outputdir):
            shutil.rmtree(outputdir)
        
        # build the command to ru
        cmd = ['python E_monitor_TestCase_app.py']
        if usempi():
            cmd.append('--%s.nodes=2' % launcher)
        cmd = ' '.join(cmd)

        # run command
        if os.system(cmd):
            raise RuntimeError, "%s failed" % cmd

        # checks
        import time
        ctime = time.time()

        #check output directory exists
        self.assert_( os.path.exists( outputdir ) )
        
        # make sure that the final histogram is identical to the 
        # sum of all the final histograms in different nodes
        from mcni.components.HistogramBasedMonitorMixin import hist_mcs_sum
        h, n = hist_mcs_sum(outputdir, 'IE.h5')
        self.assertEqual(n, ncount)
        h.I/=n; h.E2/=n*n
        
        from histogram.hdf import load
        from histogram.hdf.utils import getOnlyEntry
        p = os.path.join(outputdir, 'IE.h5')
        ha = load(p, getOnlyEntry(p))
        
        self.assert_((h.I == ha.I).all())
        self.assert_((h.E2 == ha.E2).all())
        
        return