C API

Typedefs

typedef struct _iris_mem *iris_mem
typedef struct _iris_task *iris_task

Functions

int iris_init(int *argc, char ***argv, int sync)

Initializes the IRIS execution environment.

Parameters
  • argc – pointer to the number of arguments

  • argv – argument array

  • sync – 0: non-blocking, 1: blocking

Returns

All IRIS functions return an error value. IRIS_SUCCESS, IRIS_ERR

int iris_finalize()

Terminates the IRIS execution environment.

int iris_synchronize()

Waits for all the submitted tasks to complete.

int iris_env_set(const char *key, const char *value)

Sets an IRIS environment variable.

Parameters
  • key – key string

  • value – value to be stored into key

int iris_env_get(const char *key, char **value, size_t *vallen)

Gets an IRIS environment variable.

Parameters
  • key – key string

  • value – pointer to the value to be retrieved

  • vallen – size in bytes of value

int iris_platform_count(int *nplatforms)

Returns the number of platforms.

Parameters

nplatforms – pointer to the number of platform

int iris_platform_info(int platform, int param, void *value, size_t *size)

Returns the platform information.

Parameters
  • platform – platform number

  • param – information type

  • value – information value

  • size – size in bytes of value

int iris_platform_build_program(int model, char *path)

Builds a probram containing kernels

Parameters
  • model – target model

  • path – file path

int iris_device_count(int *ndevs)

Returns the number of devices.

Parameters

ndevs – pointer to the number of devices

int iris_device_info(int device, int param, void *value, size_t *size)

Returns the device information.

Parameters
  • device – device number

  • param – information type

  • value – information value

  • size – size in bytes of value

int iris_device_synchronize(int ndevs, int *devices)

Waits for all the submitted tasks in a device to complete.

Parameters
  • ndevs – number of devices

  • devices – device array

int iris_register_policy(const char *lib, const char *name, void *params)

Registers a new device selector

Parameters
  • lib – shared library path

  • name – selector name

  • params – parameter to the selector init function

int iris_mem_create(size_t size, iris_mem *mem)

Creates a new memory object

Parameters
  • size – size in bytes

  • mem – pointer of the new memory object

int iris_mem_release(iris_mem mem)

Releases a memory object.

Parameters

mem – memory object

int iris_task_create(iris_task *task)

Creates a new task.

Parameters

task – pointer of the new task

int iris_task_depend(iris_task task, int ntasks, iris_task *tasks)

Adds a dependency to a task.

Parameters
  • task – source task

  • ntasks – number of tasks

  • tasks – target tasks array

int iris_task_h2d(iris_task task, iris_mem mem, size_t off, size_t size, void *host)

Adds a H2D command to the target task.

Parameters
  • task – target task

  • mem – target memory object

  • off – offset in bytes

  • size – size in bytes

  • host – source host address

int iris_task_d2h(iris_task task, iris_mem mem, size_t off, size_t size, void *host)

Adds a D2H command to the target task.

Parameters
  • task – target task

  • mem – source memory object

  • off – offset in bytes

  • size – size in bytes

  • host – target host address

int iris_task_h2d_full(iris_task task, iris_mem mem, void *host)

Adds a H2D command with the size of the target memory to the target task.

Parameters
  • task – target task

  • mem – target memory object

  • host – source host address

int iris_task_d2h_full(iris_task task, iris_mem mem, void *host)

Adds a D2H command with the size of the source memory to the target task.

Parameters
  • task – target task

  • mem – source memory object

  • host – target host address

int iris_task_kernel(iris_task task, const char *kernel, int dim, size_t *off, size_t *gws, size_t *lws, int nparams, void **params, int *params_info)

Launch a kernel

Parameters
  • task – target task

  • kernel – kernel name

  • dim – dimension

  • off – global workitem space offsets

  • gws – global workitem space

  • lws – local workitem space

  • nparams – number of kernel parameters

  • params – kernel parameters

  • params_info – kernel parameters information

int iris_task_submit(iris_task task, int device, const char *opt, int sync)

Submits a task.

Parameters
  • task – target task

  • device – device_selector

  • opt – option string

  • sync – 0: non-blocking, 1: blocking

int iris_task_wait(iris_task task)

Waits for the task to complete.

Parameters

task – target task

int iris_task_wait_all(int ntasks, iris_task *tasks)

Waits for all the tasks to complete.

Parameters
  • ntasks – number of tasks

  • tasks – target tasks array

int iris_task_release(iris_task task)

Releases a target.

Parameters

task – target task

int iris_timer_now(double *time)

Returns current time in seconds.

Parameters

time – pointer of time

C++ API

Fortran API

Python API