Skip to content

Instantly share code, notes, and snippets.

@0xjac
Created Sep 23, 2016
Embed
What would you like to do?
FLOPS
#!/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"
#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