Exemple #1
0
    def test_aggregate_value_key(self):
        target_cmd = ['./ci_test_aggregate']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'aggregate:event:recorder',
            'CALI_AGGREGATE_KEY': 'iteration',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'iteration': '1',
                'count': '8'
            }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'iteration': '3',
                'count': '3'
            }))
        self.assertFalse(
            calitest.has_snapshot_with_keys(snapshots,
                                            ['function', 'loop.id']))
Exemple #2
0
    def test_macros(self):
        target_cmd = [ './ci_test_macros' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main',
                'loop'       : 'mainloop',
                'iteration#mainloop' : '3' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main/foo',
                'annotation' : 'pre-loop',
                'statement'  : 'foo.init' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main/foo',
                'loop'       : 'mainloop/fooloop',
                'iteration#fooloop' : '3' }))
Exemple #3
0
    def test_aggregate_default(self):
        target_cmd = ['./ci_test_aggregate']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'aggregate:event:recorder:timestamp',
            'CALI_TIMER_SNAPSHOT_DURATION': 'true',
            'CALI_TIMER_INCLUSIVE_DURATION': 'true',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(
            calitest.has_snapshot_with_keys(snapshots, [
                'loop.id', 'function', 'sum#time.inclusive.duration',
                'min#time.inclusive.duration', 'max#time.inclusive.duration',
                'sum#time.duration', 'count'
            ]))

        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'event.end#function': 'foo',
                'loop.id': 'A',
                'count': '6'
            }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'event.end#function': 'foo',
                'loop.id': 'B',
                'count': '4'
            }))
Exemple #4
0
    def test_default_scope_switch(self):
        target_cmd = ['./ci_test_basic']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '--list-attributes', '-e',
            '--print-attributes',
            'cali.attribute.name,meta.int,cali.attribute.prop'
        ]

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_CALIPER_ATTRIBUTE_DEFAULT_SCOPE': 'process',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots,
                {
                    'cali.attribute.name': 'phase',
                    'meta.int': '42',
                    'cali.attribute.prop': '12'  # CALI_ATTR_SCOPE_PROCESS
                }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots,
                {
                    'cali.attribute.name': 'iteration',
                    'cali.attribute.prop':
                    '13'  # CALI_ATTR_SCOPE_PROCESS | CALI_ATTR_ASVALUE
                }))
Exemple #5
0
    def test_aggregate_nested(self):
        target_cmd = ['./ci_test_aggregate']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'aggregate:event:recorder',
            'CALI_AGGREGATE_KEY': 'prop:nested',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'loop.id': 'A',
                'function': 'foo',
                'count': '6'
            }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'loop.id': 'B',
                'function': 'foo',
                'count': '4'
            }))
Exemple #6
0
    def test_c_ann_trace(self):
        target_cmd = [ './ci_test_c_ann' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 10)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'event.end#phase': 'loop', 'phase': 'loop'}))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'event.end#iteration': '3', 'iteration': '3', 'phase': 'loop'}))
        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'attr.int', 'attr.dbl', 'attr.str', 'ci_test_c_ann.setbyname' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'attr.int' : '20', 'attr.str' : 'fidibus' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'test-attr-with-metadata' : 'abracadabra' }))
Exemple #7
0
    def test_mpi_msg_trace(self):
        target_cmd = [ './ci_test_mpi_before_cali' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'PATH'                    : '/usr/bin', # for ssh/rsh
            'CALI_LOG_VERBOSITY'      : '0',
            'CALI_SERVICES_ENABLE'    : 'event,mpi,recorder,trace',
            'CALI_MPI_MSG_TRACING'    : 'true',
            'CALI_MPI_WHITELIST'      : 'all',
            'CALI_RECORDER_FILENAME'  : 'stdout'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function'          : 'main',
                         'mpi.function'      : 'MPI_Barrier',
                         'mpi.coll.type'     : '1',
                         'mpi.comm.is_world' : 'true'
            }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function'          : 'main',
                         'mpi.function'      : 'MPI_Bcast',
                         'mpi.coll.type'     : '3',
                         'mpi.coll.root'     : '0',
                         'mpi.comm.is_world' : 'true'
            }))
        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'function', 'mpi.function', 'mpi.coll.type', 'mpi.call.id'
            }))
Exemple #8
0
    def test_thread(self):
        target_cmd = [ './ci_test_thread' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'thread-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 20)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, {'local', 'global', 'function'}))
        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, {'pthread.id', 'my_thread_id', 'global', 'event.end#function'}))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'my_thread_id' : '49', 
                        'function'     : 'thread_proc', 
                        'global'       : '999' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'function'    : 'main',
                         'local'       : '99' }))
Exemple #9
0
    def test_cali_before_mpi(self):
        target_cmd = [ './ci_test_cali_before_mpi' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'PATH'                    : '/usr/bin', # for ssh/rsh
            'CALI_LOG_VERBOSITY'      : '0',
            'CALI_SERVICES_ENABLE'    : 'event,mpi,mpireport,trace',
            'CALI_MPI_WHITELIST'      : 'all',
            'CALI_MPIREPORT_FILENAME' : 'stdout',
            'CALI_MPIREPORT_CONFIG'   : 'select count() group by function,mpi.function,mpi.rank format cali'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function'       : 'main',
                         'mpi.function'   : 'MPI_Barrier',
                         'count'          : '2',
                         'mpi.rank'       : '0'
            }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function' : 'main', 'mpi.function' : 'MPI_Bcast',   'count' : '1' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function' : 'main', 'mpi.function' : 'MPI_Reduce',  'count' : '1' }))
    def test_macros(self):
        target_cmd = [ './ci_test_macros' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main',
                'loop'       : 'mainloop',
                'iteration#mainloop' : '3' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main/foo',
                'annotation' : 'pre-loop',
                'statement'  : 'foo.init' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main/foo',
                'loop'       : 'mainloop/fooloop',
                'iteration#fooloop' : '3' }))
Exemple #11
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'
                }))
Exemple #12
0
    def test_c_ann_metadata(self):
        target_cmd = ['./ci_test_c_ann']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '-e', '--list-attributes'
        ]

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'cali.attribute.name': 'meta-attr',
                'cali.attribute.type': 'int'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'cali.attribute.name': 'test-attr-with-metadata',
                    'cali.attribute.type': 'string',
                    'meta-attr': '47'
                }))
    def test_aggregate_default(self):
        target_cmd = [ './ci_test_aggregate' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'aggregate:event:recorder:timestamp',
            'CALI_TIMER_SNAPSHOT_DURATION' : 'true',
            'CALI_TIMER_INCLUSIVE_DURATION' : 'true',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, [ 'loop.id', 'function', 
                         'sum#time.inclusive.duration',
                         'min#time.inclusive.duration',
                         'max#time.inclusive.duration',
                         'sum#time.duration',
                         'count' ] ))

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {
                'event.end#function': 'foo', 
                'loop.id': 'A',
                'count': '6' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {
                'event.end#function': 'foo', 
                'loop.id': 'B',
                'count': '4' }))
Exemple #14
0
    def test_basic_trace(self):
        target_cmd = ['./ci_test_basic']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(
            calitest.has_snapshot_with_keys(
                snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'event.end#phase': 'initialization',
                'phase': 'initialization'
            }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'event.end#iteration': '3',
                'iteration': '3',
                'phase': 'loop'
            }))
Exemple #15
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'
                }))
Exemple #16
0
    def test_macros(self):
        # Use ConfigManager API here
        target_cmd = [ './ci_test_macros', '0', 'event-trace,output=stdout' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main',
                'loop'       : 'mainloop',
                'iteration#mainloop' : '3' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main/foo',
                'annotation' : 'pre-loop',
                'statement'  : 'foo.init' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main',
                'annotation' : 'before_loop' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'function'   : 'main/foo',
                'loop'       : 'mainloop/fooloop',
                'iteration#fooloop' : '3' }))
Exemple #17
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'
            }))
Exemple #18
0
    def test_multichannel_trace(self):
        target_cmd = [ './ci_test_multichannel' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_CHANNEL_SNAPSHOT_SCOPES' : 'process,thread,channel',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 205)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'chn.id'       : '1', 
                        'thread'       : 'true' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'chn.id'       : '1', 
                        'main'         : 'true' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'chn.id'       : '42', 
                        'thread'       : 'true' }))
Exemple #19
0
    def test_usec_unit_selection(self):
        target_cmd = ['./ci_test_basic']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '--list-attributes', '-e',
            '--print-attributes', 'cali.attribute.name,time.unit'
        ]

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_TIMER_SNAPSHOT_DURATION': 'true',
            'CALI_TIMER_UNIT': 'usec',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0',
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'cali.attribute.name': 'time.duration',
                'time.unit': 'usec'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'cali.attribute.name': 'time.inclusive.duration',
                    'time.unit': 'usec'
                }))
    def test_property_override(self):
        target_cmd = [ './ci_test_macros' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e', '--list-attributes' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0',
            'CALI_CALIPER_ATTRIBUTE_PROPERTIES' : 'annotation=process_scope'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'cali.attribute.name' : 'function',
                'cali.attribute.prop' : '276',
                'cali.attribute.type' : 'string' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'cali.attribute.name' : 'annotation',
                'cali.attribute.prop' : '12',
                'cali.attribute.type' : 'string' }))
Exemple #21
0
    def test_property_override(self):
        target_cmd = ['./ci_test_macros']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '-e', '--list-attributes'
        ]

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0',
            'CALI_CALIPER_ATTRIBUTE_PROPERTIES': 'annotation=process_scope'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(
            calitest.has_snapshot_with_attributes(
                snapshots, {
                    'cali.attribute.name': 'function',
                    'cali.attribute.prop': '20',
                    'cali.attribute.type': 'string'
                }))

        self.assertTrue(
            calitest.has_snapshot_with_attributes(
                snapshots, {
                    'cali.attribute.name': 'annotation',
                    'cali.attribute.prop': '12',
                    'cali.attribute.type': 'string',
                    'class.nested': 'true'
                }))
Exemple #22
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'}))
Exemple #23
0
    def test_cali_config(self):
        # Test the builtin ConfigManager (CALI_CONFIG env var)

        target_cmd = ['./ci_test_basic']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_LOG_VERBOSITY': '0',
            'CALI_CONFIG': 'event-trace,output=stdout'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#phase': 'initialization',
                'phase': 'initialization'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#iteration': '3',
                'iteration': '3',
                'phase': 'loop'
            }))
    def test_alloc(self):
        target_cmd = [ './ci_test_alloc' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'        : 'alloc:recorder:trace',
            'CALI_ALLOC_RESOLVE_ADDRESSES': 'true',
            'CALI_RECORDER_FILENAME'      : 'stdout',
            'CALI_LOG_VERBOSITY'          : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 5)

        # test allocated.0

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.0' : 'true',
                        'alloc.uid#ptr_in'       : '1',
                        'alloc.index#ptr_in'     : '0',
                        'alloc.label#ptr_in'     : 'test_alloc_A'
                    }))

        self.assertFalse(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.1' : 'true',
                        'alloc.uid#ptr_in'       : '1',
                        'alloc.index#ptr_in'     : '41',
                        'alloc.label#ptr_in'     : 'test_alloc_A'
                    }))

        self.assertFalse(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'ptr_in', 'ptr_out' }))

        self.assertFalse(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'alloc.uid#ptr_in' }))
    def helper_test_hook(self, hook):

        # test allocated.0

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                              'test_alloc.allocated.0',
                              'alloc.uid#ptr_in',
                              'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.0' : 'true',
                             'alloc.index#ptr_in'     : '0'
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.0',
                             'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_in',
                             'ptr_in', 'ptr_out' }))

        index = '41' if hook == 'calloc' else '167'  # 41*sizeof(int)-1
        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.1' : 'true',
                             'alloc.index#ptr_in'     : index
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'ptr_in', 'ptr_out' }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'alloc.uid#ptr_in' }))
Exemple #26
0
    def helper_test_hook(self, hook):

        # test allocated.0

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                              'test_alloc.allocated.0',
                              'alloc.uid#ptr_in',
                              'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.0' : 'true',
                             'alloc.index#ptr_in'     : '0'
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.0',
                             'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_in',
                             'ptr_in', 'ptr_out' }))

        index = '41' if hook == 'calloc' else '167'  # 41*sizeof(int)-1
        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.1' : 'true',
                             'alloc.index#ptr_in'     : index
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'ptr_in', 'ptr_out' }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'alloc.uid#ptr_in' }))
    def test_alloc(self):
        target_cmd = [ './ci_test_alloc' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'alloc:recorder:trace',
            'CALI_ALLOC_TRACK_RANGES': 'true',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 4)

        # test allocated.0

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'ptr_in', 'ptr_out' }))

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.0' : 'true',
                        'alloc.uid#ptr_in'       : '0',
                        'alloc.index#ptr_in'     : '0'
                    }))

        self.assertFalse(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'ptr_in', 'ptr_out' }))

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.1' : 'true',
                        'alloc.uid#ptr_in'       : '0',
                        'alloc.index#ptr_in'     : '41'
                    }))

        self.assertFalse(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'ptr_in', 'ptr_out' }))

        self.assertFalse(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'alloc.uid#ptr_in' }))
Exemple #28
0
    def test_f_ann_custom_spec(self):
        target_cmd = ['./ci_test_f_ann', 'custom-trace-spec,output=stdout']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {'CALI_LOG_VERBOSITY': '0'}

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots,
                                             {'annotation': 'main/work'}))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots,
                                             {'annotation': 'main/foo'}))
Exemple #29
0
    def test_sampler_symbollookup(self):
        target_cmd = ['./ci_dgemm_memtrack']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'sampler:symbollookup:trace:recorder',
            'CALI_SYMBOLLOOKUP_LOOKUP_FILE': 'true',
            'CALI_SYMBOLLOOKUP_LOOKUP_LINE': 'true',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {
                    'cali.sampler.pc', 'source.function#cali.sampler.pc',
                    'source.file#cali.sampler.pc',
                    'source.line#cali.sampler.pc', 'sourceloc#cali.sampler.pc',
                    'function'
                }))

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots,
                {'source.function#cali.sampler.pc': 'ci_dgemm_do_work'}))
Exemple #30
0
    def test_c_ann_globals(self):
        target_cmd = ['./ci_test_c_ann']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '-e', '--list-globals'
        ]

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

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

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {
                    'global.double', 'global.string', 'global.int',
                    'global.uint', 'cali.caliper.version'
                }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'global.int': '1337',
                    'global.string': 'my global string',
                    'global.uint': '42'
                }))
Exemple #31
0
    def test_largetrace(self):
        target_cmd = ['./ci_test_macros', '0', 'none', '400']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,trace,report',
            # 'CALI_EVENT_ENABLE_SNAPSHOT_INFO' : 'false',
            'CALI_REPORT_FILENAME': 'stdout',
            'CALI_REPORT_CONFIG':
            'select function,event.end#loop,count() group by function,event.end#loop format cali',
            'CALI_TRACE_BUFFER_SIZE': '1',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'function': 'main/foo',
                    'event.end#loop': 'fooloop',
                    'count': '400'
                }))
Exemple #32
0
    def test_ann_metadata(self):
        target_cmd = ['./ci_test_basic']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '--list-attributes', '-e',
            '--print-attributes',
            'cali.attribute.name,meta.int,cali.attribute.prop'
        ]

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots,
                {
                    'cali.attribute.name': 'phase',
                    'meta.int': '42',
                    'cali.attribute.prop':
                    '20'  # default property: CALI_ATTR_SCOPE_THREAD
                }))
Exemple #33
0
    def test_ioservice(self):
        target_cmd = [
            './ci_test_io', 'event-trace(trace.io=true),output=stdout'
        ]
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {'CALI_LOG_VERBOSITY': '0'}

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'io.bytes.read': '16',
                'io.region': 'read',
                'function': 'main'
            }))

        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots, {
                'io.bytes.read', 'io.region', 'io.filesystem', 'io.mount.point'
            }))
Exemple #34
0
    def test_report_caliwriter(self):
        """ Test reader lib's CSV export via report service """

        target_cmd = ['./ci_test_macros']
        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',
            'CALI_REPORT_CONFIG': 'format cali',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 5)

        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'iteration#fooloop': '3',
                'count': '4'
            }))
    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' }))
Exemple #36
0
    def test_c_ann_trace(self):
        target_cmd = ['./ci_test_c_ann']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 10)

        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots, {
                'iteration', 'phase', 'time.inclusive.duration', 'global.int'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#phase': 'loop',
                'phase': 'loop'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#iteration': '3',
                'iteration': '3',
                'phase': 'loop'
            }))
        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots, {
                'attr.int', 'attr.dbl', 'attr.str', 'ci_test_c_ann.setbyname'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'attr.int': '20',
                'attr.str': 'fidibus'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {'test-attr-with-metadata': 'abracadabra'}))
Exemple #37
0
    def test_c_ann_metadata(self):
        target_cmd = [ './ci_test_c_ann' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e', '--list-attributes' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'cali.attribute.name' : 'meta-attr',
                         'cali.attribute.type' : 'int' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'cali.attribute.name' : 'test-attr-with-metadata',
                         'cali.attribute.type' : 'string',
                         'meta-attr'           : '47' }))
Exemple #38
0
    def test_mpi_whitelist_and_blacklist(self):
        target_cmd = ['./ci_test_mpi_before_cali']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'PATH':
            '/usr/bin',  # for ssh/rsh
            'CALI_CHANNEL_FLUSH_ON_EXIT':
            'false',
            'CALI_SERVICES_ENABLE':
            'event,mpi,mpireport,trace',
            'CALI_MPI_WHITELIST':
            'MPI_Bcast,MPI_Reduce',
            'CALI_MPI_BLACKLIST':
            'MPI_Reduce',
            'CALI_MPIREPORT_FILENAME':
            'stdout',
            'CALI_MPIREPORT_CONFIG':
            'select count() group by function,mpi.function format cali'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertFalse(
            cat.has_snapshot_with_attributes(snapshots, {
                'function': 'main',
                'mpi.function': 'MPI_Barrier'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'function': 'main',
                'mpi.function': 'MPI_Bcast',
                'count': '1'
            }))
        self.assertFalse(
            cat.has_snapshot_with_attributes(snapshots, {
                'function': 'main',
                'mpi.function': 'MPI_Reduce'
            }))
    def test_basic_trace(self):
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'event.end#phase': 'initialization', 'phase': 'initialization'}))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'event.end#iteration': '3', 'iteration': '3', 'phase': 'loop'}))
Exemple #40
0
    def test_mpi_blacklist(self):
        target_cmd = [ './ci_test_mpi_before_cali' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'PATH'                    : '/usr/bin', # for ssh/rsh
            'CALI_LOG_VERBOSITY'      : '0',
            'CALI_SERVICES_ENABLE'    : 'event,mpi,mpireport,trace',
            'CALI_MPI_BLACKLIST'      : 'MPI_Barrier,MPI_Reduce',
            'CALI_MPIREPORT_FILENAME' : 'stdout',
            'CALI_MPIREPORT_CONFIG'   : 'select count() group by function,mpi.function format cali'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertFalse(cat.has_snapshot_with_attributes(
            snapshots, { 'function' : 'main', 'mpi.function' : 'MPI_Barrier' }))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function' : 'main', 'mpi.function' : 'MPI_Bcast', 'count' : '1' }))
        self.assertFalse(cat.has_snapshot_with_attributes(
            snapshots, { 'function' : 'main', 'mpi.function' : 'MPI_Reduce'  }))
    def test_aggregate_value_key(self):
        target_cmd = [ './ci_test_aggregate' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'aggregate:event:recorder:timestamp',
            'CALI_AGGREGATE_KEY'     : 'event.end#function:iteration',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {
                'event.end#function': 'foo', 
                'iteration': '1',
                'count': '3' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {
                'event.end#function': 'foo', 
                'iteration': '3',
                'count': '1' }))
    def test_binding(self):
        target_cmd = [ './ci_test_binding' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0',
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'testbinding' : 'binding.nested=outer/binding.nested=inner' }))
Exemple #43
0
    def test_c_ann_snapshot(self):
        target_cmd = [ './ci_test_c_snapshot' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 4)
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'ci_test_c': 'snapshot', 'string_arg': 'teststring', 'int_arg': '42' }))
    def test_postprocess_snapshot(self):
        target_cmd = [ './ci_test_postprocess_snapshot' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'trace:recorder',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0',
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {
                'snapshot.val'     : '49',
                'postprocess.val'  : '42',
                'postprocess.node' : '36' }))
    def test_largetrace(self):
        target_cmd = [ './ci_test_loop', '80000' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'event,trace,report',
            # 'CALI_EVENT_ENABLE_SNAPSHOT_INFO' : 'false',
            'CALI_REPORT_FILENAME'   : 'stdout',
            'CALI_REPORT_CONFIG'     : 'select function,count() group by function format cali',
            'CALI_TRACE_BUFFER_SIZE' : '1',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function' : 'main/foo', 'count' : '80000'}))
    def test_report_caliwriter(self):
        """ Test reader lib's CSV export via report service """
        
        target_cmd = [ './ci_test_macros' ]
        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',
            'CALI_REPORT_CONFIG'     : 'format cali',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 5)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'iteration#fooloop': '3', 'count': '1' }))