libxmp/libxmpf in Omni Compiler
1.3.4
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <omp.h>
#include <complex.h>
#include "xmp_internal.h"
|
void | _XMP_pack_vector (char *restrict dst, char *restrict src, int count, int blocklength, long stride) |
|
void | _XMP_pack_vector2 (char *restrict dst, char *restrict src, int count, int blocklength, int nnodes, int type_size, int src_block_dim) |
|
void | _XMP_unpack_vector (char *restrict dst, char *restrict src, int count, int blocklength, long stride) |
|
void | _XMPF_unpack_transpose_vector (char *restrict dst, char *restrict src, int dst_stride, int src_stride, int type_size, int dst_block_dim) |
|
void | _XMP_sum_vector (int type, char *restrict dst, char *restrict src, int count, int blocklength, long stride) |
|
void | _XMP_check_reflect_type (void) |
|
◆ _XMP_SUM_VECTOR
#define _XMP_SUM_VECTOR |
( |
|
_type | ) |
|
Value: for (long i = 0; i < count; i++){ \
for (long j = 0; j < blocklength; j++){ \
((_type *)dst)[i * stride + j] += ((_type *)src)[i * blocklength + j]; \
} \
}
◆ _XMP_check_reflect_type()
void _XMP_check_reflect_type |
( |
void |
| ) |
|
302 char *reflect_type = getenv(
"XMP_REFLECT_TYPE");
307 if (strcmp(reflect_type,
"REFLECT_NOPACK") == 0){
312 else if (strcmp(reflect_type,
"REFLECT_PACK") == 0){
◆ _XMP_pack_vector()
void _XMP_pack_vector |
( |
char *restrict |
dst, |
|
|
char *restrict |
src, |
|
|
int |
count, |
|
|
int |
blocklength, |
|
|
long |
stride |
|
) |
| |
13 #pragma omp parallel for private(i)
14 for (i = 0; i < count; i++){
15 memcpy(dst + i * blocklength, src + i * stride, blocklength);
19 for (i = 0; i < count; i++){
20 memcpy(dst + i * blocklength, src + i * stride, blocklength);
◆ _XMP_pack_vector2()
void _XMP_pack_vector2 |
( |
char *restrict |
dst, |
|
|
char *restrict |
src, |
|
|
int |
count, |
|
|
int |
blocklength, |
|
|
int |
nnodes, |
|
|
int |
type_size, |
|
|
int |
src_block_dim |
|
) |
| |
30 if (src_block_dim == 1){
31 #pragma omp parallel for private(j,k)
32 for (j = 0; j < count; j++){
33 for (k = 0; k < nnodes; k++){
34 memcpy(dst + ((k * count +j ) * blocklength ) * type_size,
35 src + ((k + j * nnodes) * blocklength ) * type_size,
36 blocklength * type_size);
◆ _XMP_sum_vector()
void _XMP_sum_vector |
( |
int |
type, |
|
|
char *restrict |
dst, |
|
|
char *restrict |
src, |
|
|
int |
count, |
|
|
int |
blocklength, |
|
|
long |
stride |
|
) |
| |
109 #pragma omp parallel for
114 #pragma omp parallel for
119 #pragma omp parallel for
124 #pragma omp parallel for
129 #pragma omp parallel for
134 #pragma omp parallel for
139 #pragma omp parallel for
144 #pragma omp parallel for
149 #pragma omp parallel for
154 #pragma omp parallel for
159 #pragma omp parallel for
163 #ifdef __STD_IEC_559_COMPLEX__
165 case _XMP_N_TYPE_FLOAT_IMAGINARY:
166 #pragma omp parallel for
171 #pragma omp parallel for
175 case _XMP_N_TYPE_DOUBLE_IMAGINARY:
176 #pragma omp parallel for
181 #pragma omp parallel for
185 case _XMP_N_TYPE_LONG_DOUBLE_IMAGINARY:
186 #pragma omp parallel for
191 #pragma omp parallel for
202 _XMP_fatal(
"_XMP_sum_vector: array arguments must be of a numerical type");
255 #ifdef __STD_IEC_559_COMPLEX__
257 case _XMP_N_TYPE_FLOAT_IMAGINARY:
265 case _XMP_N_TYPE_DOUBLE_IMAGINARY:
273 case _XMP_N_TYPE_LONG_DOUBLE_IMAGINARY:
288 _XMP_fatal(
"_XMP_sum_vector: array arguments must be of a numerical type");
◆ _XMP_unpack_vector()
void _XMP_unpack_vector |
( |
char *restrict |
dst, |
|
|
char *restrict |
src, |
|
|
int |
count, |
|
|
int |
blocklength, |
|
|
long |
stride |
|
) |
| |
46 #pragma omp parallel for private(i)
47 for (i = 0; i < count; i++){
48 memcpy(dst + i * stride, src + i * blocklength, blocklength);
52 for (i = 0; i < count; i++){
53 memcpy(dst + i * stride, src + i * blocklength, blocklength);
◆ _XMPF_unpack_transpose_vector()
void _XMPF_unpack_transpose_vector |
( |
char *restrict |
dst, |
|
|
char *restrict |
src, |
|
|
int |
dst_stride, |
|
|
int |
src_stride, |
|
|
int |
type_size, |
|
|
int |
dst_block_dim |
|
) |
| |
63 if (dst_block_dim == 1){
65 long ii,jj,imin,jmin,nblk=16;
66 double _Complex *dst0 = (
double _Complex *)dst;
67 double _Complex *src0 = (
double _Complex *)src;
68 for (jj = 0; jj < src_stride; jj+=nblk){
69 jmin=((jj+nblk) < src_stride)? (jj+nblk):src_stride;
70 #pragma omp parallel for private(i,j,ii,imin)
71 for (ii = 0; ii < dst_stride; ii+=nblk){
72 imin=((ii+nblk) < dst_stride)? (ii+nblk):dst_stride;
73 for (j = jj; j < jmin; j++){
74 for (i = ii; i < imin; i++){
75 dst0[j * dst_stride + i] = src0[i * src_stride + j];
82 for (j = 0; j < src_stride; j++){
83 for (i = 0; i < dst_stride; i++){
84 memcpy(dst + (j * dst_stride + i) * type_size,
85 src + (i * src_stride + j) * type_size, type_size);
◆ _xmp_omp_num_procs
int _xmp_omp_num_procs = 1 |
◆ _xmp_reflect_pack_flag
int _xmp_reflect_pack_flag = 0 |
#define _XMP_N_TYPE_BOOL
Definition: xmp_constant.h:80
#define _XMP_N_TYPE_INT
Definition: xmp_constant.h:85
#define _XMP_N_TYPE_DOUBLE
Definition: xmp_constant.h:92
#define _XMP_N_TYPE_DOUBLE_COMPLEX
Definition: xmp_constant.h:102
#define _XMP_N_TYPE_LONG_DOUBLE
Definition: xmp_constant.h:93
int _xmp_reflect_pack_flag
Definition: xmp_pack_vector.c:298
#define _XMP_N_TYPE_NONBASIC
Definition: xmp_constant.h:104
int _xmp_omp_num_procs
Definition: xmp_pack_vector.c:7
#define _XMP_N_TYPE_UNSIGNED_LONGLONG
Definition: xmp_constant.h:90
#define _XMP_N_TYPE_LONG
Definition: xmp_constant.h:87
#define _XMP_N_TYPE_SHORT
Definition: xmp_constant.h:83
#define _XMP_N_TYPE_FLOAT_COMPLEX
Definition: xmp_constant.h:101
#define _XMP_N_TYPE_FLOAT
Definition: xmp_constant.h:91
#define _XMP_N_TYPE_UNSIGNED_INT
Definition: xmp_constant.h:86
#define _XMP_N_TYPE_UNSIGNED_LONG
Definition: xmp_constant.h:88
#define _XMP_N_TYPE_UNSIGNED_SHORT
Definition: xmp_constant.h:84
#define _XMP_N_TYPE_CHAR
Definition: xmp_constant.h:81
#define _XMP_N_TYPE_UNSIGNED_CHAR
Definition: xmp_constant.h:82
#define _XMP_N_TYPE_LONG_DOUBLE_COMPLEX
Definition: xmp_constant.h:103
void _XMP_fatal(char *msg)
Definition: xmp_util.c:42
#define _XMP_N_TYPE_LONGLONG
Definition: xmp_constant.h:89
#define _XMP_SUM_VECTOR(_type)
Definition: xmp_pack_vector.c:94