core_portme.h

Summary
core_portme.h
DescriptionThis file contains configuration constants required to execute on different platforms
Configuration
HAS_FLOATDefine to 1 if the platform supports floating point.
HAS_TIME_HDefine to 1 if platform has the time.h header file, and implementation of functions thereof.
USE_CLOCKDefine to 1 if platform has the time.h header file, and implementation of functions thereof.
HAS_STDIODefine to 1 if the platform has stdio.h.
HAS_PRINTFDefine to 1 if the platform has stdio.h and implements the printf function.
CORE_TICKSDefine type of return from the timing functions.
SEED_METHODDefines method to get seed values that cannot be computed at compile time.
MEM_METHODDefines method to get a block of memry.
MULTITHREADDefine for parallel execution
USE_PTHREADSample implementation for launching parallel contexts This implementation uses pthread_thread_create and pthread_join.
USE_FORKSample implementation for launching parallel contexts This implementation uses fork, waitpid, shmget,shmat and shmdt.
USE_SOCKETSample implementation for launching parallel contexts This implementation uses fork, socket, sendto and recvfrom
MAIN_HAS_NOARGCNeeded if platform does not support getting arguments to main.
MAIN_HAS_NORETURNNeeded if platform does not support returning a value from main.
Variables
default_num_contextsNumber of contexts to spawn in multicore context.

Description

This file contains configuration constants required to execute on different platforms

Configuration

HAS_FLOAT

Define to 1 if the platform supports floating point.

HAS_TIME_H

Define to 1 if platform has the time.h header file, and implementation of functions thereof.

USE_CLOCK

Define to 1 if platform has the time.h header file, and implementation of functions thereof.

HAS_STDIO

Define to 1 if the platform has stdio.h.

HAS_PRINTF

Define to 1 if the platform has stdio.h and implements the printf function.

CORE_TICKS

Define type of return from the timing functions.

SEED_METHOD

Defines method to get seed values that cannot be computed at compile time.

Valid values

SEED_ARGfrom command line.
SEED_FUNCfrom a system function.
SEED_VOLATILEfrom volatile variables.

MEM_METHOD

Defines method to get a block of memry.

Valid values

MEM_MALLOCfor platforms that implement malloc and have malloc.h.
MEM_STATICto use a static memory array.
MEM_STACKto allocate the data block on the stack (NYI).

MULTITHREAD

Define for parallel execution

Valid values

1only one context (default).
N>1will execute N copies in parallel.

Note

If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.

Two sample implementations are provided.  Use USE_PTHREAD or USE_FORK to enable them.

It is valid to have a different implementation of core_start_parallel and <core_end_parallel> in core_portme.c, to fit a particular architecture.

USE_PTHREAD

Sample implementation for launching parallel contexts This implementation uses pthread_thread_create and pthread_join.

Valid values

0Do not use pthreads API.
1Use pthreads API

Note

This flag only matters if MULTITHREAD has been defined to a value greater then 1.

USE_FORK

Sample implementation for launching parallel contexts This implementation uses fork, waitpid, shmget,shmat and shmdt.

Valid values

0Do not use fork API.
1Use fork API

Note

This flag only matters if MULTITHREAD has been defined to a value greater then 1.

USE_SOCKET

Sample implementation for launching parallel contexts This implementation uses fork, socket, sendto and recvfrom

Valid values

0Do not use fork and sockets API.
1Use fork and sockets API

Note

This flag only matters if MULTITHREAD has been defined to a value greater then 1.

MAIN_HAS_NOARGC

Needed if platform does not support getting arguments to main.

Valid values

0argc/argv to main is supported
1argc/argv to main is not supported

MAIN_HAS_NORETURN

Needed if platform does not support returning a value from main.

Valid values

0main returns an int, and return value will be 0.
1platform does not support returning a value from main

Variables

default_num_contexts

extern ee_u32 default_num_contexts

Number of contexts to spawn in multicore context.  Override this global value to change number of contexts used.

Note

This value may not be set higher then the MULTITHREAD define.

To experiment, you can set the MULTITHREAD define to the highest value expected, and use argc/argv in the portable_init to set this value from the command line.

extern ee_u32 default_num_contexts
Number of contexts to spawn in multicore context.
Sample implementation for launching parallel contexts This implementation uses pthread_thread_create and pthread_join.
Sample implementation for launching parallel contexts This implementation uses fork, waitpid, shmget,shmat and shmdt.
Start benchmarking in a parallel context.
Define for parallel execution
void portable_init(core_portable *p,
int *argc,
char *argv[])
Target specific initialization code Test for some common mistakes.
Close