ASCOT5
|
Offload functions. More...
Go to the source code of this file.
Functions | |
void | offload_init_offload (offload_package *o, real **offload_array, int **int_offload_array) |
Initialize offload package. | |
void | offload_free_offload (offload_package *o, real **offload_array, int **int_offload_array) |
Free offload array and set offload_package to clean state. | |
void | offload_pack (offload_package *o, real **offload_array, real *pack_array, size_t pack_length, int **int_offload_array, int *int_pack_array, size_t int_pack_length) |
Pack an offload array to package array. | |
void | offload_unpack (offload_package *o, real *offload_array, size_t pack_length, int *int_offload_array, size_t int_pack_length, real **ptr, int **intptr) |
Unpack offload array from the package. | |
Offload functions.
An offload package that is used to collect all offload arrays into a single one so that offloading can be done nice and clean. offload_pack() takes an offload data array and appends it to the common offload array. offload_unpack() returns a pointer at the start of the common offload array. offload_unpack() must be called in the same order as offload_pack() was called when data was packaged.
Since input data may contain both floats and integers, we store those separately (i.e. there is one common offload array for floats and one common offload array for integers).
Definition in file offload.c.
void offload_init_offload | ( | offload_package * | o, |
real ** | offload_array, | ||
int ** | int_offload_array ) |
Initialize offload package.
Sets offload_package.pack_array_length and offload_package.unpack_pos to zero and assigns NULL to offload_array pointer.
o | uninitialized offload package |
offload_array | pointer to packarray |
int_offload_array | pointer to int packarray |
void offload_free_offload | ( | offload_package * | o, |
real ** | offload_array, | ||
int ** | int_offload_array ) |
Free offload array and set offload_package to clean state.
o | offload package |
offload_array | pointer to offload_array |
int_offload_array | pointer to int packarray |
void offload_pack | ( | offload_package * | o, |
real ** | offload_array, | ||
real * | pack_array, | ||
size_t | pack_length, | ||
int ** | int_offload_array, | ||
int * | int_pack_array, | ||
size_t | int_pack_length ) |
Pack an offload array to package array.
Reallocates the offload array so that the new data from the package array can be appended. Once the data has been appended, the old offload array is freed. The new length of the offload array is stored to offload_package struct.
o | offload package |
offload_array | pointer to offload array where data will be packed |
pack_array | pack array containing the data to be appended |
pack_length | length of the offload_array |
int_offload_array | pointer to offload array where integer data will be packed |
int_pack_array | pack array containing the integer data to be appended |
int_pack_length | length of the int_offload_array |
void offload_unpack | ( | offload_package * | o, |
real * | offload_array, | ||
size_t | pack_length, | ||
int * | int_offload_array, | ||
size_t | int_pack_length, | ||
real ** | ptr, | ||
int ** | intptr ) |
Unpack offload array from the package.
The data is not actually moved anywhere. Unpacking means that pointers to the start of packed offload arrays are returned. Unpacking must be done in the same order as data was packed.
o | offload package |
offload_array | offload array |
pack_length | length of the data that is unpacked |
int_offload_array | int offload array |
int_pack_length | |
ptr | pointer where the unpacked data begins |
intptr | pointer where the unpacked int data begins |