Пример #1
0
    def test_log_verbose(self):
        target_cmd = [ './ci_test_basic' ]

        env = { 'CALI_LOG_VERBOSITY' : '3', 
                'CALI_LOG_LOGFILE'   : 'stdout' 
        } 

        report_out = cat.run_test(target_cmd, env)
        
        lines = report_out.decode().splitlines()

        log_targets = [
            'CALI_LOG_VERBOSITY=3',
            '== CALIPER: Releasing process scope',
            '== CALIPER: Releasing thread scope',
            'Blackboard buffer',
            'Metadata tree',
            'Metadata memory pool'
        ]

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #2
0
    def test_hatchetcontroller(self):
        """ Test hatchet-region-profile controller """

        target_cmd = [
            './ci_test_macros', '0',
            'hatchet-region-profile,use.mpi=false,output=stdout'
        ]

        caliper_config = {'CALI_LOG_VERBOSITY': '0'}

        obj = json.loads(cat.run_test(target_cmd, caliper_config)[0])

        self.assertTrue({'data', 'columns', 'column_metadata',
                         'nodes'}.issubset(set(obj.keys())))

        columns = obj['columns']

        self.assertEqual({'path', 'time'}, set(columns))

        data = obj['data']

        self.assertEqual(len(data), 8)
        self.assertEqual(len(data[0]), 2)

        meta = obj['column_metadata']

        self.assertEqual(len(meta), 2)

        time_idx = columns.index('time')
        path_idx = columns.index('path')

        self.assertTrue(meta[time_idx]['is_value'])
        self.assertEqual(meta[time_idx]['attribute.unit'], 'sec')
        self.assertFalse(meta[path_idx]['is_value'])
Пример #3
0
    def test_report_nested_key(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,trace,report',
            'CALI_REPORT_CONFIG':
            'select *,count() group by prop:nested,iteration#mainloop format expand',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output, _ = cat.run_test(target_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'function': 'main/foo',
                    'loop': 'mainloop',
                    'annotation': 'pre-loop',
                    'statement': 'foo.init',
                    'iteration#mainloop': '2',
                    'count': '1'
                }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'function': 'main/foo',
                    'loop': 'mainloop/fooloop',
                    'iteration#mainloop': '3',
                    'count': '9'
                }))
Пример #4
0
    def test_report_tree_formatter(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,trace,report',
            'CALI_REPORT_CONFIG':
            'select *,count() as Count group by prop:nested where cali.event.end format tree',
            'CALI_LOG_VERBOSITY': '0'
        }

        report_targets = [
            'Path             Count', 'main                 1',
            '  mainloop           5', '    foo              4',
            '      fooloop       20', '      pre-loop       4',
            '        foo.init     4', '  before_loop        1'
        ]

        report_output, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_output.decode().splitlines()

        for target in report_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in report' % target)
Пример #5
0
    def test_loopmonitor_target_loop(self):
        target_cmd = ['./ci_test_macros', '0', 'none', '10']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'loop_monitor,trace,report',
            'CALI_LOOP_MONITOR_ITERATION_INTERVAL': '5',
            'CALI_LOOP_MONITOR_TARGET_LOOPS': 'fooloop',
            'CALI_REPORT_CONFIG':
            'select * where iteration#fooloop format expand',
            'CALI_REPORT_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test(target_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output[0])

        self.assertEqual(len(snapshots), 20)
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'iteration#mainloop': '3',
                    'iteration#fooloop': '4',
                    'loop.iterations': '5',
                    'loop': 'mainloop/fooloop'
                }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'iteration#mainloop': '7',
                    'iteration#fooloop': '9',
                    'loop.iterations': '5',
                    'loop': 'mainloop/fooloop'
                }))
Пример #6
0
    def test_loopreport_timeseries(self):
        target_cmd = [
            './ci_test_macros', '0',
            'loop-report,timeseries=true,summary=false,iteration_interval=15,output=stdout',
            '75'
        ]

        caliper_config = {
            'CALI_LOG_VERBOSITY': '0',
        }

        log_targets = [
            'Iteration summary (mainloop):', 'Block Iterations Time (s)',
            '    0         15', '   30         15', '   60         15'
        ]

        report_out, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #7
0
    def test_regionmonitor_time_interval(self):
        target_cmd = ['./ci_test_macros', '5000', 'none', '5']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'region_monitor,trace,report',
            'CALI_REGION_MONITOR_TIME_INTERVAL': '0.01',
            'CALI_REPORT_CONFIG': 'select * format expand',
            'CALI_REPORT_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test(target_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output[0])

        self.assertTrue(len(snapshots) == 4)
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'loop': 'mainloop/fooloop',
                'function': 'main/foo'
            }))
        self.assertFalse(
            cat.has_snapshot_with_attributes(snapshots,
                                             {'annotation': 'pre-loop'}))
        self.assertFalse(
            cat.has_snapshot_with_attributes(snapshots,
                                             {'annotation': 'before_loop'}))
Пример #8
0
    def test_report_aggregate(self):
        """ Test reader lib's CSV export via report service """

        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,aggregate,report',
            'CALI_REPORT_CONFIG':
            'select function,count(),inclusive_sum(count) group by function format expand',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output, _ = cat.run_test(target_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'function': 'main',
                'count': '17',
                'inclusive#count': '77'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'function': 'main/foo',
                'count': '60',
                'inclusive#count': '60'
            }))
Пример #9
0
    def test_loopreport_target_loop_selection(self):
        target_cmd = [ './ci_test_macros', '0', 'loop-report,target_loops=fooloop,timeseries=true,summary=true,iteration_interval=5,output=stdout,timeseries.maxrows=0', '20' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'      : '0',
        }

        log_targets = [
            'Iteration summary (fooloop):',
            'mainloop/fooloop        400',
            'Block Iterations Time (s)',
            '    0        100',
            '    5        100',
            '   10        100'
        ]

        report_out,_ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #10
0
    def test_textlog_with_iteration_event(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'loop_monitor,textlog',
            'CALI_LOOP_MONITOR_ITERATION_INTERVAL': '1',
            'CALI_TEXTLOG_TRIGGER': 'loop.start_iteration',
            'CALI_TEXTLOG_FORMATSTRING':
            '%function% iteration: %[2]loop.start_iteration%',
            'CALI_LOG_VERBOSITY': '0',
        }

        log_targets = [
            'main iteration:  0', 'main iteration:  1', 'main iteration:  2',
            'main iteration:  3'
        ]

        report_out, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #11
0
    def test_textlog_with_end_event(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,textlog',
            'CALI_TEXTLOG_TRIGGER': 'iteration#main\ loop',
            'CALI_TEXTLOG_FORMATSTRING':
            '%function% iteration: %[2]iteration#main loop%',
            'CALI_LOG_VERBOSITY': '0',
        }

        log_targets = [
            'main iteration:  0', 'main iteration:  1', 'main iteration:  2',
            'main iteration:  3'
        ]

        report_out, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #12
0
    def test_log_silent(self):
        target_cmd = ['./ci_test_basic']

        env = {'CALI_LOG_VERBOSITY': '0', 'CALI_LOG_LOGFILE': 'stdout'}

        report_out, _ = cat.run_test(target_cmd, env)
        lines = report_out.decode().splitlines()

        self.assertTrue(len(lines) == 0)
Пример #13
0
    def test_hatchet_sample_profile_lookup(self):
        target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(use.mpi=false,output=stdout,sample.callpath=false,lookup.sourceloc=true,lookup.module=true)' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY' : '0'
        }

        obj = json.loads( cat.run_test(target_cmd, caliper_config)[0] )

        self.assertEqual(set(obj['columns']), { 'count', 'sourceloc#cali.sampler.pc', 'module#cali.sampler.pc', 'path' } )
Пример #14
0
    def test_mem_highwatermark_option(self):
        target_cmd = [ './ci_test_macros', '10', 'hatchet-region-profile,use.mpi=false,output=stdout,output.format=json,mem.highwatermark' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'     : '0'
        }

        obj = json.loads( cat.run_test(target_cmd, caliper_config)[0] )

        self.assertEqual(obj[1]['path'], 'main')
        self.assertTrue(float(obj[1]['Allocated MB']) > 0.0)
Пример #15
0
    def test_report(self):
        target_cmd = [ './ci_test_report' ]
        # create some distraction: read-from-env should be disabled
        env = { 'CALI_SERVICES_ENABLE' : 'debug' } 

        report_out = cat.run_test(target_cmd, env)
        
        lines = report_out.decode().splitlines()

        self.assertEqual(lines[0].rstrip(), 'function annotation count')
        self.assertEqual(lines[1].rstrip(), 'main     my phase       2')
Пример #16
0
    def test_report(self):
        target_cmd = [ './ci_test_report' ]
        # create some distraction: read-from-env should be disabled
        env = { 'CALI_SERVICES_ENABLE' : 'debug' } 

        report_out = cat.run_test(target_cmd, env)
        
        lines = report_out.decode().splitlines()

        self.assertEqual(lines[0].rstrip(), 'function annotation count')
        self.assertEqual(lines[1].rstrip(), 'main     my phase       2')
Пример #17
0
    def test_hatchet_profile_ioservice(self):
        # Test the I/O bytes metric in the
        target_cmd = [ './ci_test_io', 'hatchet-region-profile,output=stdout,output.format=json,io.bytes.read=true' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'     : '0'
        }

        obj = json.loads( cat.run_test(target_cmd, caliper_config)[0] )

        self.assertEqual(obj[1]['path'], 'main')
        self.assertEqual(int(obj[1]['Bytes read']), 16)
Пример #18
0
    def test_tau(self):
        target_cmd = ['./ci_test_mpi_before_cali']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'tau',
            'CALI_LOG_VERBOSITY': '0',
            'TAU_PROFILE': '0',
            'TAU_TRACE': '0'
        }

        #query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        query_output = cat.run_test(target_cmd, caliper_config)
Пример #19
0
    def test_loopreport_display_all_rows(self):
        target_cmd = [ './ci_test_macros', '0', 'loop-report,timeseries.maxrows=0,timeseries=true,summary=false,iteration_interval=2,output=stdout', '80' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'      : '0',
        }

        report_out,_ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        self.assertGreater(len(lines), 40)
        self.assertLess(len(lines), 48)
Пример #20
0
    def test_createdir(self):
        target_cmd = [ './ci_test_macros', '0', 'hatchet-region-profile,output.format=json,output=foo/bar/test.json' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'     : '0'
        }

        if os.path.exists('foo/bar/test.json'):
            os.remove('foo/bar/test.json')
        if os.path.exists('foo/bar'):
            os.removedirs('foo/bar')

        self.assertFalse(os.path.exists('foo/bar'))

        cat.run_test(target_cmd, caliper_config)

        self.assertTrue(os.path.isdir('foo/bar'))
        self.assertTrue(os.path.isfile('foo/bar/test.json'))

        if os.path.exists('foo/bar/test.json'):
            os.remove('foo/bar/test.json')
        if os.path.exists('foo/bar'):
            os.removedirs('foo/bar')
Пример #21
0
    def test_tau(self):
        target_cmd = ['./ci_test_tau_service']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '-q',
            'SELECT count(),iteration#fooloop WHERE loop=fooloop GROUP BY iteration#fooloop FORMAT expand'
        ]

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,trace,report,tau',
            'CALI_REPORT_CONFIG': 'format cali',
            'CALI_LOG_VERBOSITY': '0'
        }

        #query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        query_output = cat.run_test(target_cmd, caliper_config)
Пример #22
0
    def test_report_attribute_aliases(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,trace,report',
            'CALI_REPORT_CONFIG':
            'select function as my\\ function\\ alias,count() group by function format expand',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output, _ = cat.run_test(target_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots,
                                       {'my function alias', 'count'}))
Пример #23
0
    def test_openmpreport_regions(self):
        target_cmd = ['./ci_test_openmp', 'openmp-report,output=stdout']

        caliper_config = {'CALI_LOG_VERBOSITY': '0'}

        report_targets = [
            'Path #Threads Time (thread) Time (total) Work %   Barrier % Time (work) Time (barrier)'
        ]

        report_output, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_output.decode().splitlines()

        for target in report_targets:
            for line in lines:
                if target in line:
                    break
Пример #24
0
    def test_ioservice(self):
        target_cmd = [
            './ci_test_openmp',
            'hatchet-region-profile,openmp.times,output=stdout'
        ]

        caliper_config = {'CALI_LOG_VERBOSITY': '0'}

        obj = json.loads(cat.run_test(target_cmd, caliper_config)[0])

        self.assertTrue({'data', 'columns', 'column_metadata',
                         'nodes'}.issubset(set(obj.keys())))

        expected = {'path', 'time', 'Time (barrier)', 'Time (work)'}

        self.assertTrue(expected.issubset(set(obj['columns'])))
Пример #25
0
    def test_caliquery_list_services(self):
        target_cmd = [ '../../src/tools/cali-query/cali-query', '--help=services' ]

        env = { 
            'CALI_LOG_VERBOSITY' : '0',
        }

        service_targets = [
            'aggregate', 'event', 'recorder', 'report', 'timestamp', 'trace'
        ]

        report_out,_ = cat.run_test(target_cmd, env)
        res = report_out.decode().split(',')

        for target in service_targets:
            if not target in res:
                self.fail('%s not found in log' % target)
Пример #26
0
    def test_report_aggregate(self):
        """ Test reader lib's CSV export via report service """
        
        target_cmd = [ './ci_test_macros' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'event,aggregate,report',
            'CALI_REPORT_CONFIG'     : 'select function,count(),inclusive_sum(count) group by function format expand',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test(target_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function': 'main', 'count': '12', 'inclusive#count': '27' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function': 'main/foo', 'count': '15', 'inclusive#count': '15' }))
Пример #27
0
    def test_collective_output_channel(self):
        target_cmd = ['./ci_test_collective_output_channel', 'mpi-report']

        caliper_config = {
            'PATH': '/usr/bin',  # for ssh/rsh
            'CALI_LOG_VERBOSITY': '0',
        }

        log_targets = ['Function', 'MPI_Barrier']

        report_out, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #28
0
    def test_textlog_autostring(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,textlog,timestamp',
            'CALI_TEXTLOG_TRIGGER': 'loop',
            'CALI_LOG_VERBOSITY': '0',
        }

        log_targets = ['loop=main loop/fooloop']

        report_out, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #29
0
    def test_validator_pass_macros(self):
        target_cmd = ['./ci_test_macros', '0']

        env = {
            'CALI_LOG_VERBOSITY': '1',
            'CALI_LOG_LOGFILE': 'stdout',
            'CALI_SERVICES_ENABLE': 'validator'
        }

        log_targets = ['validator: No annotation nesting errors found']

        report_out, _ = cat.run_test(target_cmd, env)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #30
0
    def test_sample_report_nompi(self):
        target_cmd = [
            './ci_test_macros', '5000', 'callpath-sample-report,output=stdout'
        ]

        caliper_config = {
            'CALI_LOG_VERBOSITY': '0',
        }

        log_targets = ['Path', 'main', '  foo']

        report_out, _ = cat.run_test(target_cmd, caliper_config)
        lines = report_out.decode().splitlines()

        for target in log_targets:
            for line in lines:
                if target in line:
                    break
            else:
                self.fail('%s not found in log' % target)
Пример #31
0
    def test_report_table_formatter(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,trace,report',
            'CALI_REPORT_CONFIG':
            'select *,count() group by loop where event.end#loop format table order by count desc',
            'CALI_LOG_VERBOSITY': '0'
        }

        report_targets = [
            'loop             count', 'mainloop/fooloop     4',
            'mainloop             1'
        ]

        report_output, _ = cat.run_test(target_cmd, caliper_config)
        output_lines = report_output.decode().splitlines()

        for lineno in [0, 1, 2]:
            self.assertEqual(report_targets[lineno],
                             output_lines[lineno].rstrip())
Пример #32
0
    def test_loopmonitor_time_interval(self):
        target_cmd = ['./ci_test_macros', '2000', 'none', '10']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'loop_monitor,trace,report',
            'CALI_LOOP_MONITOR_TIME_INTERVAL': '0.05',
            'CALI_REPORT_CONFIG':
            'select count(),sum(loop.iterations) where loop format json',
            'CALI_REPORT_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test(target_cmd, caliper_config)
        obj = json.loads(query_output[0])

        self.assertTrue(len(obj) == 1)

        count = int(obj[0]['count'])
        sum = int(obj[0]['sum#loop.iterations'])

        self.assertTrue(count > 2 and count < 8)
        self.assertEqual(sum, 10)