CoreMark's primary goals are simplicity and providing a method for testing only a processor's core features. For more information about EEMBC's comprehensive embedded benchmark suites, please see www.eembc.org.
To build and run the benchmark, type
> make
Full results are available in the files run1.log and run2.log. CoreMark result can be found in run1.log.
For cross compile platforms please adjust core_portme.mak, core_portme.h (and possibly core_portme.c) according to the specific platform used. When porting to a new platform, it is recommended to copy one of the default port folders (e.g. mkdir <platform> && cp linux/* <platform>), adjust the porting files, and run:
% make PORT_DIR=<platform>
run - Default target, creates run1.log and run2.log.
run1.log - Run the benchmark with performance parameters, and output to run1.log
run2.log - Run the benchmark with validation parameters, and output to run2.log
run3.log - Run the benchmark with profile generation parameters, and output to run3.log
compile - compile the benchmark executable
link - link the benchmark executable
check - test MD5 of sources that may not be modified
clean - clean temporary files
ITERATIONSBy default, the benchmark will run between 10-100 seconds. To override, use ITERATIONS=N
% make ITERATIONS=10
Will run the benchmark for 10 iterations. It is recommended to set a specific number of iterations in certain situations e.g.:
Minimum required run time: Results are only valid for reporting if the benchmark ran for at least 10 secs!
XCFLAGSTo add compiler flags from the command line, use XCFLAGS e.g.:
% make XCFLAGS="-g -DMULTITHREAD=4 -DUSE_FORK=1"
CORE_DEBUGDefine to compile for a debug run if you get incorrect CRC.
% make XCFLAGS="-DCORE_DEBUG=1"
REBUILDForce a rebuild of the executable.
makeThe following files need to be compiled:
* core_list_join.c
* core_main.c
* core_matrix.c
* core_state.c
* core_util.c
* PORT_DIR/core_portme.c
For example:
% gcc -O2 -o coremark.exe core_list_join.c core_main.c core_matrix.c core_state.c core_util.c simple/core_portme.c -DPERFORMANCE_RUN=1 -DITERATIONS=1000
% ./coremark.exe > run1.log
The above will compile the benchmark for a performance run and 1000 iterations. Output is redirected to run1.log.
Use XCFLAGS=-DMULTITHREAD=N where N is number of threads to run in parallel. Several implementations are available to execute in multiple contexts, or you can implement your own in core_portme.c.
% make XCFLAGS="-DMULTITHREAD=4 -DUSE_PTHREAD"
Above will compile the benchmark for execution on 4 cores, using POSIX Threads API.
CoreMark's executable takes several parameters as follows (but only if main() accepts arguments):
1st - A seed value used for initialization of data.
2nd - A seed value used for initialization of data.
3rd - A seed value used for initialization of data.
4th - Number of iterations (0 for auto : default value)
5th - Reserved for internal use.
6th - Reserved for internal use.
7th - For malloc users only, ovreride the size of the input data buffer.
The run target from make will run coremark with 2 different data initialization seeds.
If not using malloc or command line arguments are not supported, the buffer size
for the algorithms must be defined via the compiler define TOTAL_DATA_SIZE.
TOTAL_DATA_SIZE must be set to 2000 bytes (default) for standard runs.
The default for such a target when testing different configurations could be:
% make XCFLAGS="-DTOTAL_DATA_SIZE=6000 -DMAIN_HAS_NOARGC=1"
CoreMark results can be submitted on the web. Open a web browser and go to http://www.coremark.org/benchmark/index.php?pg=benchmark. Select the link to add a new score and follow the instructions.
What is and is not allowed.
0,0,0x66 and 0x3415,0x3415,0x66, buffer size of 2000 bytes total. % make XCFLAGS="-DPERFORMANCE_RUN=1" REBUILD=1 run1.log
% make XCFLAGS="-DVALIDATION_RUN=1" REBUILD=1 run2.log
8,8,8, and buffer size of 1200 bytes total. % make XCFLAGS="-DTOTAL_DATA_SIZE=1200 -DPROFILE_RUN=1" REBUILD=1 run3.log
ee_u8 is an 8 bits datatype.ee_s16 is a 16 bits datatype.ee_u16 is a 16 bits datatype.ee_s32 is a 32 bits datatype.ee_u32 is a 32 bits datatype.in core_portme.ccore_portme.hcore_portme.makcore_portme* (use make check to validate)Use the following syntax to report results on a data sheet:
CoreMark 1.0 : N / C [/ P] [/ M]
N - Number of iterations per second with seeds 0,0,0x66,size=2000)
C - Compiler version and flags
P - Parameters such as data and code allocation specifics
M - Type of parallel execution (if used) and number of contexts * This parameter may be omitted if parallel execution was not used.
e.g.:
CoreMark 1.0 : 128 / GCC 4.1.2 -O2 -fprofile-use / Heap in TCRAM / FORK:2
or
CoreMark 1.0 : 1400 / GCC 3.4 -O4
If reporting scaling results, the results must be reported as follows:
CoreMark/MHz 1.0 : N / C / P [/ M]
P - When reporting scaling results, memory parameter must also indicate memory frequency:core frequency ratio. 1. If the core has cache and cache frequency to core frequency ratio is configurable, that must also be included.
e.g.:
CoreMark/MHz 1.0 : 1.47 / GCC 4.1.2 -O2 / DDR3(Heap) 30:1 Memory 1:1 Cache
The log files have the following format
2K performance run parameters for coremark. (Run type)
CoreMark Size : 666 (Buffer size)
Total ticks : 25875 (platform dependent value)
Total time (secs) : 25.875000 (actual time in seconds)
Iterations/Sec : 3864.734300 (Performance value to report)
Iterations : 100000 (number of iterations used)
Compiler version : GCC3.4.4 (Compiler and version)
Compiler flags : -O2 (Compiler and linker flags)
Memory location : Code in flash, data in on chip RAM
seedcrc : 0xe9f5 (identifier for the input seeds)
[0]crclist : 0xe714 (validation for list part)
[0]crcmatrix : 0x1fd7 (validation for matrix part)
[0]crcstate : 0x8e3a (validation for state part)
[0]crcfinal : 0x33ff (iteration dependent output)
Correct operation validated. See readme.txt for run and reporting rules. (*Only when run is successful*)
CoreMark 1.0 : 6508.490622 / GCC3.4.4 -O2 / Heap (*Only on a successful performance run*)
This section describes the initial goals of CoreMark and their implementation.
A thin abstraction layer will be provided for I/O and timing in a separate file. All I/O and timing of the benchmark will be done through this layer.
This may be the most difficult goal. Compilers are constantly improving and getting better at analyzing code. To create work that cannot be computed at compile time and must be computed at run time, we will rely on two assumptions:
Some system functions (e.g. time, scanf) and parameters cannot be computed at compile time. In most cases, marking a variable volatile means the compiler is force to read this variable every time it is read. This will be used to introduce a factor into the input that cannot be precomputed at compile time. Since the results are input dependent, that will make sure that computation has to happen at run time.
Either a system function or I/O (e.g. scanf) or command line parameters or volatile variables will be used before the timed portion to generate data which is not available at compile time. Specific method used is not relevant as long as it can be controlled, and that it cannot be computed or eliminated by the compiler at compile time. E.g. if the clock() functions is a compiler stub, it may not be used. The derived values will be reported on the output so that verification can be done on a different machine.
We cannot rely on command line parameters since some embedded systems do not have the capability to provide command line parameters. All 3 methods above will be implemented (time based, scanf and command line parameters) and all 3 are valid if the compiler cannot determine the value at compile time.
It is important to note that The actual values that are to be supplied at run time will be standardized. The methodology is not intended to provide random data, but simply to provide controlled data that cannot be precomputed at compile time.
Printed results must be valid at run time. This will be used to make sure the computation has been executed.
Some embedded systems do not provide “printf” or other I/O functionality. All I/O will be done through a thin abstraction interface to allow execution on such systems (e.g. allow output via JTAG).
The following linked list structure will be used:
typedef struct list_data_s {
ee_s16 data16;
ee_s16 idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
While adding a level of indirection accessing the data, this structure is realistic and used in many embedded applications for small to medium lists.
The list itself will be initialized on a block of memory that will be passed in to the initialization function. While in general linked lists use malloc for new nodes, embedded applications sometime control the memory for small data structures such as arrays and lists directly to avoid the overhead of system calls, so this approach is realistic.
The linked list will be initialized such that 1/4 of the list pointers point to sequential areas in memory, and 3.4 of the list pointers are distributed in a non sequential manner. This is done to emulate a linked list that had add/remove happen for a while disrupting the neat order, and then a series of adds that are likely to come from sequential memory locations.
For the benchmark itself: - Multiple find operations are going to be performed. These find operations may result in the whole list being traversed. The result of each find will become part of the output chain. - The list will be sorted using merge sort based on the data16 value, and then derive CRC of the data16 item in order for part of the list. The CRC will become part of the output chain. - The list will be sorted again using merge sort based on the idx value. This sort will guarantee that the list is returned to the primary state before leaving the function, so that multiple iterations of the function will have the same result. CRC of the data16 for part of the list will again be calculated and become part of the output chain.
The actual data16 in each cell will be pseudo random based on a single 16b input that cannot be determined at compile time. In addition, the part of the list which is used for CRC will also be passed to the function, and determined based on an input that cannot be determined at run time.
This very simple algorithm forms the basis of many more complex algorithms. The tight inner loop is the focus of many optimizations (compiler as well as hardware based) and is thus relevant for embedded processing.
The total available data space will be divided to 3 parts: 1. NxN matrix A. 2. NxN matrix B. 3. NxN matrix C.
E.g. for 2K we will have 3 12x12 matrices (assuming data type of 32b 12(len)12(wid)4(size)*3(num) =1728 bytes).
Matrix A will be initialized with small values (upper 3/4 of the bits all zero). Matrix B will be initialized with medium values (upper half of the bits all zero). Matrix C will be used for the result.
For the benchmark itself: - Multiple A by a constant into C, add the upper bits of each of the values in the result matrix. The result will become part of the output chain. - Multiple A by column X of B into C, add the upper bits of each of the values in the result matrix. The result will become part of the output chain. - Multiple A by B into C, add the upper bits of each of the values in the result matrix. The result
$ claude mcp add coremark \
-- python -m otcore.mcp_server <graph>