eembc / coremark

CoreMark® is an industry-standard benchmark that measures the performance of central processing units (CPU) and embedded microcrontrollers (MCU).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The use of DMULTITHREAD

ilya1725 opened this issue · comments

Hello:

What is the point of -DMULTITHREAD? I've tried running the benchmark on my system with this flag set to 1,2,4,16 and getting the same results.
However, the more complex underlined question is how CoreMarks takes into account multiple cores? There is nothing about it in the README or the EEMBC whitepaper.

Thank you.

You also have to specify which multithread implementation to use.
-DUSE_PTHREAD=1 or -DUSE_FORK=1 or -DUSE_SOCKET=1 are the options I think.

I used -DUSE_FORK=1. Same result.

MULTITHREAD=N enables code for parallel execution, where the value of N determines the number of instances. The parallel implementation may be USE_(FORK|PTHREAD|SOCKET)=1. The implementation is defined in the core_portme.c file for the particular platform using the two functions core_start_parallel and core_stop_parallel. The linux and linux64 targets both implement all three modes with example code. Here is a pthreads example:

#if USE_PTHREAD
ee_u8 core_start_parallel(core_results *res) {
return (ee_u8)pthread_create(&(res->port.thread),NULL,iterate,(void *)res);
}
ee_u8 core_stop_parallel(core_results *res) {
void *retval;
return (ee_u8)pthread_join(res->port.thread,&retval);
}

Example:

$ make PORT_DIR=macOS
$ grep "Iterations/Sec" run2.log
Iterations/Sec   : 19559.264572
$ make PORT_DIR=macOS clean
$ make PORT_DIR=macOS XCFLAGS='-DMULTITHREAD=4 -DUSE_PTHREAD'
$ grep "Iteration/Sec" run2.log
Iterations/Sec   : 71577.691619

I had the same problem @ilya1725 had. My solution is to delete coremark.exe every time I run make XCFLAGS='-DMULTITHREAD=4 -DUSE_PTHREAD'