-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fallback binary chains
Here's how to build OpenMP and/or CPU fallback, with Jumbo & autoconf. In Jumbo, we can do this without JOHN_SYSTEMWIDE.
Note that as soon as we define CFLAGS
, we need to populate it with -g -O2
because that's the default for it.
Here's how to do just OpenMP fallback (native)
./configure --disable-openmp && make -s clean && make -sj8 && mv ../run/john ../run/john-non-omp &&
./configure CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-non-omp\""' &&
make -s clean && make -sj8 && echo All Done
Then, you always run "john" but it will silently switch to "john-non-omp" when applicable, for better performance.
Here's how to build a CPU-fallback chain (with OpenMP fallback too) without JOHN_SYSTEMWIDE. For eg. heterogenous MPI clusters, fallback is required so you can just run "john" on all nodes regardless of what SIMD feature set it's got.
./configure --disable-native-tests --disable-openmp &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-sse2-non-omp &&
./configure --disable-native-tests CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-sse2-non-omp\""' &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-sse2 &&
./configure --disable-native-tests --enable-simd=avx --disable-openmp &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-avx-non-omp &&
./configure --disable-native-tests --enable-simd=avx CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-avx-non-omp\"" -DCPU_FALLBACK -DCPU_FALLBACK_BINARY="\"john-sse2\""' &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-avx &&
./configure --disable-native-tests --enable-simd=xop --disable-openmp &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-xop-non-omp &&
./configure --disable-native-tests --enable-simd=xop CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-xop-non-omp\"" -DCPU_FALLBACK -DCPU_FALLBACK_BINARY="\"john-avx\""' &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-xop &&
./configure --disable-native-tests --enable-simd=avx2 --disable-openmp &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-non-omp &&
./configure --disable-native-tests --enable-simd=avx2 CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-non-omp\"" -DCPU_FALLBACK -DCPU_FALLBACK_BINARY="\"john-xop\""' &&
make -s clean && make -sj8 && echo All Done
Then, you always run "john" but it will fallback to john-xop -> john-avx -> john-sse2 or to any of them with -non-omp, as appropriate.
To be 100% optimized, john-ssse3 and john-sse4.1 could be added to the above too.
Here's the same as above but without XOP, because eg. Homebrew's gcc can't build XOP.
./configure --disable-native-tests --disable-openmp &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-sse2-non-omp &&
./configure --disable-native-tests CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-sse2-non-omp\""' &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-sse2 &&
./configure --disable-native-tests --enable-simd=avx --disable-openmp &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-avx-non-omp &&
./configure --disable-native-tests CFLAGS='-g -O2 -mavx -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-avx-non-omp\"" -DCPU_FALLBACK -DCPU_FALLBACK_BINARY="\"john-sse2\""' &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-avx &&
./configure --disable-native-tests CFLAGS='-g -O2 -mavx2' --disable-openmp &&
make -s clean && make -sj8 &&
mv ../run/john ../run/john-non-omp &&
./configure --disable-native-tests --enable-simd=avx2 CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-non-omp\"" -DCPU_FALLBACK -DCPU_FALLBACK_BINARY="\"john-avx\""' &&
make -s clean && make -sj8 && echo All Done
Just add -DJOHN_SYSTEMWIDE
to all CFLAGS above. The binary directory defaults to /usr/libexec/john, the shared one (which should contain all but the executables from "run") defaults to "/usr/share/john" and the private one to "~/.john". They can be changed by defining JOHN_SYSTEMWIDE_EXEC, JOHN_SYSTEMWIDE_HOME and/or JOHN_PRIVATE_HOME but take care to enclose them in quotes - and escape the quotes as needed - eg.
./configure --disable-native-tests --enable-simd=avx2 CFLAGS='-g -O2 -DOMP_FALLBACK -DOMP_FALLBACK_BINARY="\"john-non-omp\"" -DCPU_FALLBACK -DCPU_FALLBACK_BINARY="\"john-avx\"" -DJOHN_SYSTEMWIDE -DJOHN_SYSTEMWIDE_EXEC="\"/usr/local/bin\""'