# core_portme.h

Summary

core_portme.h |
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.
MEM_METHOD | Defines method to get a block of memry.
MULTITHREAD | Define for parallel execution
USE_PTHREAD | Sample implementation for launching parallel contexts This implementation uses pthread_thread_create and pthread_join.
USE_FORK | Sample implementation for launching parallel contexts This implementation uses fork, waitpid, shmget,shmat and shmdt.
USE_SOCKET | Sample implementation for launching parallel contexts This implementation uses fork, socket, sendto and recvfrom
MAIN_HAS_NOARGC | Needed if platform does not support getting arguments to main.
MAIN_HAS_NORETURN | Needed if platform does not support returning a value from main.
Variables |
default_num_contexts | Number 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_ARG | from command line.
SEED_FUNC | from a system function.
SEED_VOLATILE | from volatile variables.

### MEM_METHOD

Defines method to get a block of memry.

#### Valid values

MEM_MALLOC | for platforms that implement malloc and have malloc.h.
MEM_STATIC | to use a static memory array.
MEM_STACK | to allocate the data block on the stack (NYI).

### MULTITHREAD

Define for parallel execution

#### Valid values

1 | only one context (default).
N>1 | will 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

0 | Do not use pthreads API.
1 | Use 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

0 | Do not use fork API.
1 | Use 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

0 | Do not use fork and sockets API.
1 | Use 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

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

### MAIN_HAS_NORETURN

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

#### Valid values

0 | main returns an int, and return value will be 0.
1 | platform 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