Created
December 20, 2014 21:06
-
-
Save def-/64f10c359a6962e06d75 to your computer and use it in GitHub Desktop.
Helloflops on Xeon Phi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Generated by Nim Compiler v0.10.1 */ | |
| /* (c) 2014 Andreas Rumpf */ | |
| /* The generated code is subject to the original license. */ | |
| /* Compiled for: Linux, amd64, gcc */ | |
| /* Command for C compiler: | |
| icc -c -w -vec-report=5 -O3 -mmic -fopenmp -O3 -fno-strict-aliasing -I/amd.home/home/felsing/nim/lib -o /amd.home/home/felsing/test/nimcache/helloflops.o /amd.home/home/felsing/test/nimcache/helloflops.c */ | |
| #define NIM_INTBITS 64 | |
| #include "nimbase.h" | |
| #include <stdio.h> | |
| #include <omp.h> | |
| typedef struct TGenericSeq TGenericSeq; | |
| typedef struct NimStringDesc NimStringDesc; | |
| typedef NF32 TY102030[1048576]; | |
| struct TGenericSeq { | |
| NI len; | |
| NI reserved; | |
| }; | |
| struct NimStringDesc { | |
| TGenericSeq Sup; | |
| NIM_CHAR data[SEQ_DECL_SIZE]; | |
| }; | |
| N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x); | |
| N_NIMCALL(NF, ntepochTime)(void); | |
| N_NIMCALL(NimStringDesc*, nimFloatToStr)(NF f); | |
| static N_INLINE(void, initStackBottomWith)(void* locals); | |
| N_NOINLINE(void, setStackBottom)(void* thestackbottom); | |
| NIM_EXTERNC N_NOINLINE(void, systemInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, systemDatInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, stdlib_parseutilsInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, stdlib_parseutilsDatInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, stdlib_strutilsInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, stdlib_strutilsDatInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, stdlib_timesInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, stdlib_timesDatInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, helloflopsInit)(void); | |
| NIM_EXTERNC N_NOINLINE(void, helloflopsDatInit)(void); | |
| STRING_LITERAL(TMP11, "Initializing", 12); | |
| STRING_LITERAL(TMP12, "Starting Compute on ", 20); | |
| STRING_LITERAL(TMP13, " threads", 8); | |
| STRING_LITERAL(TMP14, "GFlops = ", 9); | |
| STRING_LITERAL(TMP15, ", Secs = ", 9); | |
| STRING_LITERAL(TMP16, "GFlops per sec = ", 17); | |
| TY102030 fa_102032 __attribute__((align(64))); | |
| TY102030 fb_102039 __attribute__((align(64))); | |
| NF32 a_102045; | |
| NI numthreads_102050; | |
| NF tstart_102110; | |
| NI j_102162; | |
| NI k_102185; | |
| NF tstop_102220; | |
| NF ttime_102224; | |
| NF32 gflops_102229; | |
| static N_INLINE(void, initStackBottomWith)(void* locals) { | |
| setStackBottom(locals); | |
| } | |
| void PreMainInner() { | |
| systemInit(); | |
| stdlib_parseutilsDatInit(); | |
| stdlib_strutilsDatInit(); | |
| stdlib_timesDatInit(); | |
| helloflopsDatInit(); | |
| stdlib_parseutilsInit(); | |
| stdlib_strutilsInit(); | |
| stdlib_timesInit(); | |
| } | |
| void PreMain() { | |
| void (*volatile inner)(); | |
| systemDatInit(); | |
| inner = PreMainInner; | |
| initStackBottomWith((void *)&inner); | |
| (*inner)(); | |
| } | |
| int cmdCount; | |
| char** cmdLine; | |
| char** gEnv; | |
| N_CDECL(void, NimMainInner)(void) { | |
| helloflopsInit(); | |
| } | |
| N_CDECL(void, NimMain)(void) { | |
| void (*volatile inner)(); | |
| PreMain(); | |
| inner = NimMainInner; | |
| initStackBottomWith((void *)&inner); | |
| (*inner)(); | |
| } | |
| int main(int argc, char** args, char** env) { | |
| cmdLine = args; | |
| cmdCount = argc; | |
| gEnv = env; | |
| NimMain(); | |
| return nim_program_result; | |
| } | |
| NIM_EXTERNC N_NOINLINE(void, helloflopsInit)(void) { | |
| NI i_102089; | |
| NimStringDesc* LOC6; | |
| NI i_102137; | |
| a_102045 = 1.1000000000000001e+00; | |
| printf("%s\012", (((NimStringDesc*) &TMP11))->data); | |
| #pragma omp parallel for | |
| for (i_102089 = 0; i_102089 <= 1048575; ++i_102089) { | |
| { | |
| if (!(i_102089 == 0)) goto LA4; | |
| numthreads_102050 = omp_get_num_threads(); | |
| } | |
| LA4: ; | |
| fa_102032[(i_102089)- 0] = ((NF32)(((NF32) (i_102089))) + (NF32)(1.0000000000000001e-01)); | |
| fb_102039[(i_102089)- 0] = ((NF32)(((NF32) (i_102089))) + (NF32)(2.0000000000000001e-01)); | |
| } | |
| LOC6 = 0; | |
| LOC6 = nimIntToStr(numthreads_102050); | |
| printf("%s%s%s\012", (((NimStringDesc*) &TMP12))->data, (LOC6)->data, (((NimStringDesc*) &TMP13))->data); | |
| tstart_102110 = ntepochTime(); | |
| #pragma omp parallel for private(j_102162, k_102185) | |
| for (i_102137 = 0; i_102137 <= (numthreads_102050 - 1); ++i_102137) { | |
| NI offset; | |
| offset = (NI64)(i_102137 * 128); | |
| { | |
| { | |
| for(j_102162 = 0; j_102162 <= 99999999; j_102162 += 1) { | |
| { | |
| { | |
| for(k_102185 = 0; k_102185 <= 127; k_102185 += 1) { | |
| fa_102032[((NI64)(k_102185 + offset))- 0] = ((NF32)(((NF32)(a_102045) * (NF32)(fa_102032[((NI64)(k_102185 + offset))- 0]))) + (NF32)(fb_102039[((NI64)(k_102185 + offset))- 0])); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| tstop_102220 = ntepochTime(); | |
| ttime_102224 = ((NF)(tstop_102220) - (NF)(tstart_102110)); | |
| gflops_102229 = ((NF32)(((NF32)(((NF32)(((NF32)(1.0000000000000001e-09) * (NF32)(((NF32) (numthreads_102050))))) * (NF32)(1.2800000000000000e+02))) * (NF32)(1.0000000000000000e+08))) * (NF32)(2.0000000000000000e+00)); | |
| { | |
| NimStringDesc* LOC18; | |
| NimStringDesc* LOC19; | |
| NimStringDesc* LOC20; | |
| if (!(0.0 < ttime_102224)) goto LA16; | |
| LOC18 = 0; | |
| LOC18 = nimFloatToStr(((NF) (gflops_102229))); | |
| LOC19 = 0; | |
| LOC19 = nimFloatToStr(ttime_102224); | |
| printf("%s%s%s%s\012", (((NimStringDesc*) &TMP14))->data, (LOC18)->data, (((NimStringDesc*) &TMP15))->data, (LOC19)->data); | |
| LOC20 = 0; | |
| LOC20 = nimFloatToStr(((NF)(((NF) (gflops_102229))) / (NF)(ttime_102224))); | |
| printf("%s%s\012", (((NimStringDesc*) &TMP16))->data, (LOC20)->data); | |
| } | |
| LA16: ; | |
| } | |
| NIM_EXTERNC N_NOINLINE(void, helloflopsDatInit)(void) { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment