Skip to content

Instantly share code, notes, and snippets.

@mroman42
Last active August 29, 2015 14:01
Show Gist options
  • Save mroman42/dd3028088caa8813cfb2 to your computer and use it in GitHub Desktop.
Save mroman42/dd3028088caa8813cfb2 to your computer and use it in GitHub Desktop.
Compila un programa probando varias optimizaciones
#!/bin/bash
CFLAGS="-flto -fopenmp -fwhole-program -Wall -Wl,--no-as-needed"
CXXFLAGS="$CFLAGS -std=c++0x"
LDFLAGS="-lm -lrt"
OPTS="-O0 -O1 -O2 -O3 -Os"
for code in *.cc;
do
for opt in $OPTS;
do
g++ $code $CFLAGS $CXXFLAGS $opt $LDFLAGS -o "${code%.cc}$1$opt"
echo "Tiempo ${code%.cc} $1$opt: `./${code%.cc}$1$opt $2`"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment