Created
September 23, 2016 14:27
-
-
Save 0xjac/35552902898c5546372becbfdad7c6c4 to your computer and use it in GitHub Desktop.
FLOPS
This file contains 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
#!/usr/bin/env bash | |
FLOP=4000000; | |
gcc -o main main.c; | |
TIMEFORMAT=%R | |
ELAPSED=`( time ./main ) 2>&1 > /dev/null` | |
FLOPS=$(echo "$FLOP/$ELAPSED" | bc) | |
echo "elapsed: $ELAPSED seconds" | |
echo "flops: $FLOPS" |
This file contains 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
#define NUMBERS 1000000 | |
int main(void) { | |
float values[NUMBERS]; | |
float res; | |
int i, j=3, k=42; | |
for(i=0; i < NUMBERS; i++) { | |
values[i] = (i + k) * j; | |
res = values[i] / (float)k; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment