[1] | 1 | /* NAS Parallel Benchmarks 2.3 UPC Version */ |
---|
| 2 | |
---|
| 3 | #include <stdio.h> |
---|
| 4 | #include <stdlib.h> |
---|
| 5 | #include <math.h> |
---|
| 6 | |
---|
| 7 | #if defined(__CYGWIN__) && defined(__RPCNDR_H__) |
---|
| 8 | /* bug 2419 : workaround a typedef of bool in the cygwin headers */ |
---|
| 9 | #define boolean int |
---|
| 10 | #else |
---|
| 11 | typedef int boolean; |
---|
| 12 | #endif |
---|
| 13 | |
---|
| 14 | typedef struct { |
---|
| 15 | double real; |
---|
| 16 | double imag; |
---|
| 17 | } dcomplex; |
---|
| 18 | |
---|
| 19 | #ifndef TRUE |
---|
| 20 | #define TRUE 1 |
---|
| 21 | #endif |
---|
| 22 | #ifndef FALSE |
---|
| 23 | #define FALSE 0 |
---|
| 24 | #endif |
---|
| 25 | |
---|
| 26 | #define MEM_OK(var) { \ |
---|
| 27 | if( var == NULL ) \ |
---|
| 28 | { \ |
---|
| 29 | printf("TH%02d: ERROR: %s == NULL\n", MYTHREAD, #var ); \ |
---|
| 30 | upc_global_exit(1); \ |
---|
| 31 | } } |
---|
| 32 | |
---|
| 33 | #ifndef max |
---|
| 34 | #define max(a,b) (((a) > (b)) ? (a) : (b)) |
---|
| 35 | #endif |
---|
| 36 | #ifndef min |
---|
| 37 | #define min(a,b) (((a) < (b)) ? (a) : (b)) |
---|
| 38 | #endif |
---|
| 39 | #define pow2(a) ((a)*(a)) |
---|
| 40 | |
---|
| 41 | #define get_real(c) c.real |
---|
| 42 | #define get_imag(c) c.imag |
---|
| 43 | #define cadd(c,a,b) (c.real = a.real + b.real, c.imag = a.imag + b.imag) |
---|
| 44 | #define csub(c,a,b) (c.real = a.real - b.real, c.imag = a.imag - b.imag) |
---|
| 45 | #define cmul(c,a,b) (c.real = a.real * b.real - a.imag * b.imag, \ |
---|
| 46 | c.imag = a.real * b.imag + a.imag * b.real) |
---|
| 47 | #define crmul(c,a,b) (c.real = a.real * b, c.imag = a.imag * b) |
---|
| 48 | |
---|
| 49 | extern double randlc(double *, double); |
---|
| 50 | extern void vranlc(int, double *, double, double *); |
---|
| 51 | |
---|
| 52 | extern void c_print_results(const char *name, char class, int n1, int n2, |
---|
| 53 | int n3, int niter, int nthreads, double t, |
---|
| 54 | double mops, const char *optype, int passed_verification, |
---|
| 55 | const char *npbversion, const char *compiletime, const char *cc, |
---|
| 56 | const char *clink, const char *c_lib, const char *c_inc, |
---|
| 57 | const char *cflags, const char *clinkflags, const char *rand); |
---|