- gcc -std=c17 -m32 -mtune=generic -mfpmath=sse -msse2 -g -Wall -O2 -fstrict-aliasing simple_mandel_bench1.c -lm -o simple_mandel_bench1.sse_gcc
- gcc -std=c17 -m32 -mtune=generic -g -Wall -O2 -fstrict-aliasing simple_mandel_bench1.c -lm -o simple_mandel_bench1.nosse_gcc
- ksh93 -c 'set -o xtrace ; \
- uname -a ; \
- cat simple_mandel_bench1.c ; \
- cat Makefile ; \
- for i in simple_mandel_bench1.sse_gcc simple_mandel_bench1.nosse_gcc ; do time "./$i" ; done'
- + uname -a
- Linux DERFWNB4966 5.10.0-13-rt-686-pae #1 SMP PREEMPT_RT Debian 5.10.106-1 (2022-03-17) i686 GNU/Linux
- + cat simple_mandel_bench1.c
- /*
- * sse_vs_387_perf1/simple_mandel_bench1.c - simple mandelbrot code
- * used for benchmarking
- *
- * Based on http://svn.nrubsig.org/svn/people/gisburn/scripts/mandelbrotset1.sh
- *
- * Written by Roland Mainz <roland.mainz@nrubsig.org>
- *
- */
- #define _XOPEN_SOURCE 600
- #include <stdlib.h>
- #include <stdio.h>
- #include <stdint.h>
- #include <math.h>
- static const char mandel_chars[] =
- "..:-;!0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%@#";
- #define MANDEL_Y_MIN (-12)
- #define MANDEL_Y_MAX (+18)
- #define MANDEL_X_MIN (-40)
- #define MANDEL_X_MAX (+102)
- #define MANDEL_X_SCALE (32)
- #define MANDEL_Y_SCALE (16)
- // enforce FMA usage for testing if platform does not support it
- // #define FP_FAST_FMA 1
- #define MY_MIN(x, y) ((x)<(y)?(x):(y))
- int main(int ac, char *av[])
- {
- intmax_t k;
- double i, j;
- double r;
- double x, y;
- (void)ac;
- (void)av;
- #if FP_FAST_FMA
- (void)printf("# has fast FMA\n");
- #else
- (void)printf("# does not have fast FMA\n");
- #endif /* FP_FAST_FMA */
- for(y=MANDEL_Y_MIN ; y < MANDEL_Y_MAX ; y++) {
- for(x=MANDEL_X_MIN ; x < MANDEL_X_MAX ; x++) {
- for(i=j=r=0.,k=0 ;
- (((j*j + i*i)) < 11) && (k < 8388608UL) ;
- k++) {
- j=r*r - i*i - 2.+x/MANDEL_X_SCALE,
- #if FP_FAST_FMA
- i=fma(2.*r, i, y/MANDEL_Y_SCALE);
- #else
- i=2.*r*i + y/MANDEL_Y_SCALE;
- #endif /* FP_FAST_FMA */
- r=j;
- }
- (void)putchar_unlocked(
- mandel_chars[(size_t)MY_MIN(k, (sizeof(mandel_chars)-2))]);
- }
- (void)putchar_unlocked('\n');
- }
- return EXIT_SUCCESS;
- }
- + cat Makefile
- #
- # sse_vs_387_perf1/Makefile
- #
- CSTD=-std=c17
- ARCHFLAGS=-m32 -mtune=generic
- MATHSSEFLAGS=-mfpmath=sse -msse2 # -mfma
- #MATH387FLAGS=-mfpmath=387
- OPTFLAGS=-O2 -fstrict-aliasing
- CC=gcc
- all: tests
- #
- # we use mandelbrot for benchmarking because it uses lots of math
- # and is proven to be a good benchmark
- #
- simple_mandel_bench1.sse_$(CC): simple_mandel_bench1.c
- $(CC) $(CSTD) $(ARCHFLAGS) $(MATHSSEFLAGS) -g -Wall $(OPTFLAGS) $< -lm -o $@
- simple_mandel_bench1.nosse_$(CC): simple_mandel_bench1.c
- $(CC) $(CSTD) $(ARCHFLAGS) $(MATH387FLAGS) -g -Wall $(OPTFLAGS) $< -lm -o $@
- #
- # run tests
- #
- # first we print outselves (sources and build config/Makefile)
- # so the output contains the accurate config used for testing,
- # then we run the tests, one time with SSE enabled and one time
- # with SSE disabled.
- #
- tests: \
- simple_mandel_bench1.sse_$(CC) \
- simple_mandel_bench1.nosse_$(CC)
- ksh93 -c 'set -o xtrace ; \
- uname -a ; \
- cat simple_mandel_bench1.c ; \
- cat Makefile ; \
- for i in $^ ; do time "./$$i" ; done'
- clean:
- rm -f \
- simple_mandel_bench1.sse_$(CC) \
- simple_mandel_bench1.nosse_$(CC)
- # EOF.
- + ./simple_mandel_bench1.sse_gcc
- # does not have fast FMA
- .:::::::::::::::::::::::::::::::::--------------------------;;;;;;;;;;;;;;;!!!!!!!!0000111112236g#######t43211000000!!!;;;;;;;----------------
- .::::::::::::::::::::::::::::::::-----------------------;;;;;;;;;;;;;;!!!!!!!!!!0001744i533455568h#####f86546321112330!!!;;;;;;---------------
- ::::::::::::::::::::::::::::::::---------------------;;;;;;;;;;;;;!!!!!!!!!!!!0000124kgnfh79###############f#c54c757630!!!;;;;;---------------
- :::::::::::::::::::::::::::::::-------------------;;;;;;;;;;;;!!!!!!!!!!!!!00000112236q#######################nb###m7510!!!;;;;;--------------
- :::::::::::::::::::::::::::::::----------------;;;;;;;;;;;;!!!!!!000000000000011123F68dL###########################c3210!!!;;;;;;-------------
- ::::::::::::::::::::::::::::::--------------;;;;;;;;;;;;!!!!!014111111111111111224aF#u############################Xd42110!!!;;;;;;------------
- :::::::::::::::::::::::::::::-------------;;;;;;;;;;;;!!!!!!0013932222373222222346gV###############################vcbx30!!!;;;;;;------------
- :::::::::::::::::::::::::::::------------;;;;;;;;;;;!!!!!!0001236aed756af6a644445a###################################t5200!!;;;;;;;-----------
- :::::::::::::::::::::::::::::----------;;;;;;;;;;!!!!!!!!000112348j##i####uVj7668####################################7810!!!;;;;;;;-----------
- ::::::::::::::::::::::::::::----------;;;;;;;;;!!!!!!000001222398e############Jac####################################7310!!!;;;;;;;-----------
- ::::::::::::::::::::::::::::----------;;;;!!!!!!00000011123i5567d###############l###################################b5100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::---------;;;!!!00012211112223347c##J################K##################################c31100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::---------;;;#########################################################################b6321000!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::---------;;;!!!00012211112223347c##J################K##################################c31100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::----------;;;;!!!!!!00000011123i5567d###############l###################################b5100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::----------;;;;;;;;;!!!!!!000001222398e############Jac####################################7310!!!;;;;;;;-----------
- :::::::::::::::::::::::::::::----------;;;;;;;;;;!!!!!!!!000112348j##i####uVj7668####################################7810!!!;;;;;;;-----------
- :::::::::::::::::::::::::::::------------;;;;;;;;;;;!!!!!!0001236aed756af6a644445a###################################t5200!!;;;;;;;-----------
- :::::::::::::::::::::::::::::-------------;;;;;;;;;;;;!!!!!!0013932222373222222346gV###############################vcbx30!!!;;;;;;------------
- ::::::::::::::::::::::::::::::--------------;;;;;;;;;;;;!!!!!014111111111111111224aF#u############################Xd42110!!!;;;;;;------------
- :::::::::::::::::::::::::::::::----------------;;;;;;;;;;;;!!!!!!000000000000011123F68dL###########################c3210!!!;;;;;;-------------
- :::::::::::::::::::::::::::::::-------------------;;;;;;;;;;;;!!!!!!!!!!!!!00000112236q#######################nb###m7510!!!;;;;;--------------
- ::::::::::::::::::::::::::::::::---------------------;;;;;;;;;;;;;!!!!!!!!!!!!0000124kgnfh79###############f#c54c757630!!!;;;;;---------------
- .::::::::::::::::::::::::::::::::-----------------------;;;;;;;;;;;;;;!!!!!!!!!!0001744i533455568h#####f86546321112330!!!;;;;;;---------------
- .:::::::::::::::::::::::::::::::::--------------------------;;;;;;;;;;;;;;;!!!!!!!!0000111112236g#######t43211000000!!!;;;;;;;----------------
- ..:::::::::::::::::::::::::::::::::----------------------------;;;;;;;;;;;;;;;;!!!!!!!0000011135b######pyd210000!!!!!;;;;;;;------------------
- ..::::::::::::::::::::::::::::::::::------------------------------;;;;;;;;;;;;;;;;!!!!!!!!000113866d#Pb533100!!!!!!;;;;;;;;------------------:
- ...::::::::::::::::::::::::::::::::::-------------------------------;;;;;;;;;;;;;;;;;!!!!!!!000112358a532100!!!!!;;;;;;;;;------------------::
- ...::::::::::::::::::::::::::::::::::::--------------------------------;;;;;;;;;;;;;;;;;!!!!!!00113584e7#00!!!;;;;;;;;;;------------------::::
- ....::::::::::::::::::::::::::::::::::::----------------------------------;;;;;;;;;;;;;;;;!!!!!0014421000!!!;;;;;;;;;;-------------------:::::
- real 1m8.48s
- user 1m8.84s
- sys 0m0.00s
- + ./simple_mandel_bench1.nosse_gcc
- # does not have fast FMA
- .:::::::::::::::::::::::::::::::::--------------------------;;;;;;;;;;;;;;;!!!!!!!!0000111112236g#######t43211000000!!!;;;;;;;----------------
- .::::::::::::::::::::::::::::::::-----------------------;;;;;;;;;;;;;;!!!!!!!!!!0001744i533455568h#####f86546321112330!!!;;;;;;---------------
- ::::::::::::::::::::::::::::::::---------------------;;;;;;;;;;;;;!!!!!!!!!!!!0000124kgnfh79###############f#c54c757630!!!;;;;;---------------
- :::::::::::::::::::::::::::::::-------------------;;;;;;;;;;;;!!!!!!!!!!!!!00000112236q#######################nb###m7510!!!;;;;;--------------
- :::::::::::::::::::::::::::::::----------------;;;;;;;;;;;;!!!!!!000000000000011123F68dL###########################c3210!!!;;;;;;-------------
- ::::::::::::::::::::::::::::::--------------;;;;;;;;;;;;!!!!!014111111111111111224aF#u############################Xd42110!!!;;;;;;------------
- :::::::::::::::::::::::::::::-------------;;;;;;;;;;;;!!!!!!0013932222373222222346gV###############################vcbx30!!!;;;;;;------------
- :::::::::::::::::::::::::::::------------;;;;;;;;;;;!!!!!!0001236aed756af6a644445a###################################t5200!!;;;;;;;-----------
- :::::::::::::::::::::::::::::----------;;;;;;;;;;!!!!!!!!000112348j##i####uVj7668####################################7810!!!;;;;;;;-----------
- ::::::::::::::::::::::::::::----------;;;;;;;;;!!!!!!000001222398e############Jac####################################7310!!!;;;;;;;-----------
- ::::::::::::::::::::::::::::----------;;;;!!!!!!00000011123i5567d###############l###################################b5100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::---------;;;!!!00012211112223347c##J################K##################################c31100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::---------;;;#########################################################################b6321000!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::---------;;;!!!00012211112223347c##J################K##################################c31100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::----------;;;;!!!!!!00000011123i5567d###############l###################################b5100!!!;;;;;;;;----------
- ::::::::::::::::::::::::::::----------;;;;;;;;;!!!!!!000001222398e############Jac####################################7310!!!;;;;;;;-----------
- :::::::::::::::::::::::::::::----------;;;;;;;;;;!!!!!!!!000112348j##i####uVj7668####################################7810!!!;;;;;;;-----------
- :::::::::::::::::::::::::::::------------;;;;;;;;;;;!!!!!!0001236aed756af6a644445a###################################t5200!!;;;;;;;-----------
- :::::::::::::::::::::::::::::-------------;;;;;;;;;;;;!!!!!!0013932222373222222346gV###############################vcbx30!!!;;;;;;------------
- ::::::::::::::::::::::::::::::--------------;;;;;;;;;;;;!!!!!014111111111111111224aF#u############################Xd42110!!!;;;;;;------------
- :::::::::::::::::::::::::::::::----------------;;;;;;;;;;;;!!!!!!000000000000011123F68dL###########################c3210!!!;;;;;;-------------
- :::::::::::::::::::::::::::::::-------------------;;;;;;;;;;;;!!!!!!!!!!!!!00000112236q#######################nb###m7510!!!;;;;;--------------
- ::::::::::::::::::::::::::::::::---------------------;;;;;;;;;;;;;!!!!!!!!!!!!0000124kgnfh79###############f#c54c757630!!!;;;;;---------------
- .::::::::::::::::::::::::::::::::-----------------------;;;;;;;;;;;;;;!!!!!!!!!!0001744i533455568h#####f86546321112330!!!;;;;;;---------------
- .:::::::::::::::::::::::::::::::::--------------------------;;;;;;;;;;;;;;;!!!!!!!!0000111112236g#######t43211000000!!!;;;;;;;----------------
- ..:::::::::::::::::::::::::::::::::----------------------------;;;;;;;;;;;;;;;;!!!!!!!0000011135b######pyd210000!!!!!;;;;;;;------------------
- ..::::::::::::::::::::::::::::::::::------------------------------;;;;;;;;;;;;;;;;!!!!!!!!000113866d#Pb533100!!!!!!;;;;;;;;------------------:
- ...::::::::::::::::::::::::::::::::::-------------------------------;;;;;;;;;;;;;;;;;!!!!!!!000112358a532100!!!!!;;;;;;;;;------------------::
- ...::::::::::::::::::::::::::::::::::::--------------------------------;;;;;;;;;;;;;;;;;!!!!!!00113584e7#00!!!;;;;;;;;;;------------------::::
- ....::::::::::::::::::::::::::::::::::::----------------------------------;;;;;;;;;;;;;;;;!!!!!0014421000!!!;;;;;;;;;;-------------------:::::
- real 1m37.89s
- user 1m38.34s
- sys 0m0.00s
sse_vs_387_perf_report2_20220919_002
Posted by Anonymous on Mon 19th Sep 2022 19:03
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.