[PATCH] rtems-examples: Add CoreMark Benchmark

Hesham Almatary hesham.almatary at cl.cam.ac.uk
Sun Mar 14 07:26:33 UTC 2021


On Sat, 13 Mar 2021 at 23:38, Joel Sherrill <joel.sherrill at gmail.com> wrote:
>
> I don't see any RTEMS specific instructions added. Especially
> since I think you need them to deal with the submodule.
>
I relied on the existing README.waf which gives instructions to init
and update submodules (including rtems-waf itself being a submodule)
https://github.com/RTEMS/rtems-examples/blob/master/README.waf#L26

> What happens when you haven't dealt with the submodule? Is the
> error reasonable? I would think a directory is missing and the waf
> build will die.
>
> I am thrilled to see these added. Any advice for how we can use
> these in the project. Compare architectures? RTEMS versions?
>
Yeah, we used it to measure CPU performance for baremetal applications
between different processor implementations and compiler toolchains.
It reports iterations/second as a final number for a particular
operation. The benchmark is a bit configurable though; you can specify
the number of iterations, threading, FPU support, memory locations,
etc. That can be further customised in wscript or a header file, but I
just submitted this patch with the minimum default changes.


> --joel
>
> On Sat, Mar 13, 2021 at 1:50 AM Hesham Almatary <hesham.almatary at cl.cam.ac.uk> wrote:
>>
>> CoreMark's primary goals are simplicity and providing a method for
>> testing only a processor's core features. It is used primarily here as
>> a performance benchmark.
>>
>> Built and tested for RISC-V rv64imafdc_medany on QEMU and HW
>> ---
>>  .gitmodules                  |  3 +++
>>  benchmarks/coremark/coremark |  1 +
>>  benchmarks/coremark/wscript  | 50 ++++++++++++++++++++++++++++++++++++
>>  benchmarks/wscript           |  2 +-
>>  4 files changed, 55 insertions(+), 1 deletion(-)
>>  create mode 160000 benchmarks/coremark/coremark
>>  create mode 100644 benchmarks/coremark/wscript
>>
>> diff --git a/.gitmodules b/.gitmodules
>> index ae86e49..d7e52b9 100644
>> --- a/.gitmodules
>> +++ b/.gitmodules
>> @@ -1,3 +1,6 @@
>>  [submodule "rtems_waf"]
>>         path = rtems_waf
>>         url = git://git.rtems.org/rtems_waf.git
>> +[submodule "benchmarks/coremark/coremark"]
>> +       path = benchmarks/coremark/coremark
>> +       url = git at github.com:eembc/coremark.git
>> diff --git a/benchmarks/coremark/coremark b/benchmarks/coremark/coremark
>> new file mode 160000
>> index 0000000..1541482
>> --- /dev/null
>> +++ b/benchmarks/coremark/coremark
>> @@ -0,0 +1 @@
>> +Subproject commit 1541482bf3e6ef7f5c69f5be76b14537b60833d0
>> diff --git a/benchmarks/coremark/wscript b/benchmarks/coremark/wscript
>> new file mode 100644
>> index 0000000..2ec5f1e
>> --- /dev/null
>> +++ b/benchmarks/coremark/wscript
>> @@ -0,0 +1,50 @@
>> +#-
>> +# SPDX-License-Identifier: BSD-2-Clause
>> +#
>> +# Copyright (c) 2021 Hesham Almatary
>> +#
>> +# This software was developed by SRI International and the University of
>> +# Cambridge Computer Laboratory (Department of Computer Science and
>> +# Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
>> +# DARPA SSITH research programme.
>> +#
>> +# Redistribution and use in source and binary forms, with or without
>> +# modification, are permitted provided that the following conditions
>> +# are met:
>> +# 1. Redistributions of source code must retain the above copyright
>> +#    notice, this list of conditions and the following disclaimer.
>> +# 2. Redistributions in binary form must reproduce the above copyright
>> +#    notice, this list of conditions and the following disclaimer in the
>> +#    documentation and/or other materials provided with the distribution.
>> +#
>> +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
>> +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>> +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
>> +# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
>> +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
>> +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
>> +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
>> +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
>> +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
>> +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>> +# SUCH DAMAGE.
>> +#
>> +
>> +import rtems_waf.rtems as rtems
>> +
>> +def build(bld):
>> +    rtems.build(bld)
>> +
>> +    bld(features = 'c cprogram',
>> +        target = 'coremark.bin',
>> +        includes = ['coremark/', 'coremark/posix/'],
>> +        source = ['coremark/rtems/init.c', 'coremark/posix/core_portme.c',
>> +                  'coremark/core_list_join.c', 'coremark/core_main.c',
>> +                  'coremark/core_matrix.c', 'coremark/core_state.c',
>> +                  'coremark/core_util.c'],
>> +
>> +        defines = [
>> +        # FLAGS_STR is used within CoreMark to print the compiler flags used
>> +        'FLAGS_STR="'+' '.join([str(flag) for flag in bld.env.CFLAGS])+'"'
>> +        ]
>> +    )
>> diff --git a/benchmarks/wscript b/benchmarks/wscript
>> index 12741e7..0947060 100644
>> --- a/benchmarks/wscript
>> +++ b/benchmarks/wscript
>> @@ -7,4 +7,4 @@ import rtems_waf.rtems as rtems
>>
>>  def build(bld):
>>      bld.recurse('nbench')
>> -
>> +    bld.recurse('coremark')
>> --
>> 2.25.1
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list