Ejemplo n.º 1
0
    def test_model_job(self):
        """
        n.b. We don't test the time series in detail (that is the following test), but we check that they are
             translated correctly into the ModelJob
        """
        # TODO: Is there a required version of IPM for the parsing we are doing?

        task1 = IPMTaskInfo("2.0.2", 99, 88, 77, 55, 66)
        task1.mpi_pairwise_bytes_send = 123 * 1024
        task1.mpi_pairwise_count_send = 12
        job = IPMIngestedJob(label="a-label", tasks=[task1])

        m = job.model_job()

        self.assertEqual(m.label, "a-label")
        for s in self.expected_series:
            self.assertIsNotNone(m.timesignals.get(s, None))
            self.assertEqual(len(m.timesignals[s].xvalues), 1)
            self.assertEqual(len(m.timesignals[s].yvalues), 1)
        self.assertEqual(m.timesignals['kb_pairwise'].sum, 123 / float(99))
        self.assertEqual(m.timesignals['n_pairwise'].sum, int(12 / float(99)))

        self.assertEqual(m.duration, 11)
        self.assertEqual(m.time_start, 55)
        self.assertEqual(m.ncpus, 99)
        self.assertEqual(m.nnodes, 88)
Ejemplo n.º 2
0
    def test_aggregation_different_jobs(self):
        """
        We should only be able to aggregate two job records that correspond to the same job
        """
        job1 = IPMIngestedJob(tasks=[1, 2, 3], label='label1')
        job2 = IPMIngestedJob(tasks=[4, 5, 6], label='label2')

        self.assertRaises(AssertionError, job1.aggregate, job2)
Ejemplo n.º 3
0
    def test_aggregation(self):
        """
        The lists of profiled tasks should be aggregated. For now, that is all that is being returned by IPM, but
        clearly the global data will need to be checked (and ensure that there aren't conflicts...).
        """
        job1 = IPMIngestedJob(tasks=[1, 2, 3], label='label1')
        job2 = IPMIngestedJob(tasks=[4, 5, 6], label='label1')

        # If jobs can be aggregated, their task lists should be combined
        job1.aggregate(job2)
        for t in range(1, 7):
            self.assertIn(t, job1.tasks)
Ejemplo n.º 4
0
    def test_model_job_minmax(self):
        """
        What happens if the tasks don't agree on some of the metrics? Sometimes we need the min, sometimes the max.
        """
        task1 = IPMTaskInfo("2.0.2", 99, 88, 0, 44, 66)
        task2 = IPMTaskInfo("2.0.2", 101, 91, 1, 55, 77)
        job = IPMIngestedJob(label="a-label", tasks=[task1, task2])

        m = job.model_job()

        # n.b. Subtracted a global 9 seconds off the start time for the global start time
        self.assertEqual(m.time_start, 44)
        self.assertEqual(m.duration, 33)
        self.assertEqual(m.ncpus, 101)
        self.assertEqual(m.nnodes, 91)
Ejemplo n.º 5
0
    def test_initialisation(self):

        # Check defaults
        job = IPMIngestedJob()
        self.assertEqual(job.tasks, [])
        self.assertIsNone(job.label)
        self.assertIsNone(job.filename)

        # Check that the defaults can be correctly overridden
        job = IPMIngestedJob(tasks=[1, 2, 3],
                             label="a-label",
                             filename="a-filename")
        self.assertEqual(job.tasks, [1, 2, 3])
        self.assertEqual(job.label, "a-label")
        self.assertEqual(job.filename, "a-filename")
Ejemplo n.º 6
0
    def test_start_time(self):
        """
        The property time_start should return the earliest start time of any of the tasks
        """
        task1 = IPMTaskInfo("2.0.2", 99, 88, 0, 44, 66)
        task2 = IPMTaskInfo("2.0.2", 101, 91, 1, 55, 77)
        job = IPMIngestedJob(label="a-label", tasks=[task1, task2])

        self.assertEqual(job.time_start, 44)
Ejemplo n.º 7
0
    def test_model_time_series(self):
        """
        For now, we only consider the totals, and consider them to be offset by "zero" from the start.
        """
        # With no data, we should end up with empty time series
        job = IPMIngestedJob()
        series = job.model_time_series()

        self.assertEqual(set(self.expected_series), set(series.keys()))
        for s in series.values():
            self.assertEqual(s.sum, 0)
            self.assertEqual(len(s.xvalues), 1)
            self.assertEqual(len(s.yvalues), 1)
            self.assertEqual(s.xvalues[0], 0.0)
            self.assertEqual(s.yvalues[0], 0.0)

        # Otherwise, there should be time-series created with the correct totals
        # N.B. The MPI pairwise RECV data is ignored (as it duplicates some/most of the SEND data).

        task1 = IPMTaskInfo("2.0.2", 99, 88, 77, 55, 66)
        task1.mpi_pairwise_bytes_send = 123 * 1024
        task1.mpi_pairwise_bytes_recv = 456 * 1024
        task1.mpi_collective_bytes = 789 * 1024
        task1.bytes_read = 12 * 1024
        task1.bytes_written = 345 * 1024

        task1.mpi_pairwise_count_send = 12
        task1.mpi_pairwise_count_recv = 34
        task1.mpi_collective_count = 56
        task1.open_count = 78
        task1.read_count = 90
        task1.write_count = 12

        task2 = IPMTaskInfo("2.0.2", 99, 88, 77, 55, 66)
        task2.mpi_pairwise_bytes_send = 345 * 1024
        task2.mpi_pairwise_bytes_recv = 678 * 1024
        task2.mpi_collective_bytes = 901 * 1024
        task2.bytes_read = 234 * 1024
        task2.bytes_written = 567 * 1024

        task2.mpi_pairwise_count_send = 89
        task2.mpi_pairwise_count_recv = 1
        task2.mpi_collective_count = 23
        task2.open_count = 45
        task2.read_count = 67
        task2.write_count = 89

        job = IPMIngestedJob(tasks=[task1, task2])
        series = job.model_time_series()

        totals = {
            'n_collective': int(79 / float(99)),
            'kb_collective': 1690 / float(99),
            'n_pairwise': int(101 / float(99)),
            'kb_pairwise': 468 / float(99),
            'kb_read': 246,
            'kb_write': 912,
            'n_read': 157,
            'n_write': 101
        }

        self.assertEqual(set(self.expected_series), set(series.keys()))
        for nm, s in series.items():
            self.assertEqual(s.sum, totals[nm])
            self.assertEqual(len(s.xvalues), 1)
            self.assertEqual(len(s.yvalues), 1)
            self.assertEqual(s.xvalues[0], 0.0)
            self.assertEqual(s.yvalues[0], totals[nm])