Problems when tuning GMP under MinGW

Basil Peace grv87-dev at yandex.ru
Fri Jun 7 08:30:32 CEST 2013


Good time of day!

 

I try to compile and tune GMP 5.1 trunk version from repository (revision
15426).

 

I build against MinGW32 (latest standard version with MSYS) with the
following configuration options:

 

./configure PREFIX=/v/gmp/mingw32/static --build=k8-pc-mingw32
--disable-shared --enable-static --disable-fat --enable-cxx
--enable-assembly --enable-fft --disable-assert CPPFLAGS=-fexceptions

 

Compiler:

$ gcc -v

Используются внутренние спецификации.

COLLECT_GCC=C:\MinGW\bin\gcc.exe

COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.2/lto-wrapper.ex
e

Целевая архитектура: mingw32

Параметры конфигурации: ../gcc-4.7.2/configure
--enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions
--wit

h-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry
--enable-libstdcxx-debug --disable-build-poststage1-with-cxx

--enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw

Модель многопоточности: win32

gcc версия 4.7.2 (GCC)

 

Output from 'uname -a':

$ uname -a

MINGW32_NT-6.1 DEVELOPMENTVM 1.0.18(0.48/3/2) 2012-11-21 22:34 i686 Msys

 

Output from ./config.guess and ./configfsf.guess:

Developer at DevelopmentVM /s/gnu/lib/gmp/5.1.devel

$ ./config.guess

k8-pc-mingw32

 

Developer at DevelopmentVM /s/gnu/lib/gmp/5.1.devel

$ ./configfsf.guess

i686-pc-mingw32

 

I experience the following problems while tuning GMP:

 

 

1. I've noted an misstatement in documentation (file doc/gmp.texi), section
"Performance optimization". 'make tuneup' doesn't work.

 

Developer at DevelopmentVM /s/gnu/lib/gmp/5.1.devel/tune

$ make tuneup

gcc -std=gnu99 -m32 -O2 -pedantic -fomit-frame-pointer -mtune=k8 -march=k8
-fexceptions   tuneup.c   -o tuneup

tuneup.c:103:20: fatal error: config.h: No such file or directory

compilation terminated.

make: *** [tuneup] Error 1

 

tune/README states that command for making tuneup program is 'make tune',
not 'make tuneup'.

 

 

2. Errors while making tuneup programs:

 

/bin/sh ../libtool --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H
-I. -I.. -I.. -I../tests  -fexceptions  -m32 -O2 -pe

dantic -fomit-frame-pointer -mtune=k8 -march=k8 -c -o time.lo time.c

libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests
-fexceptions -m32 -O2 -pedantic -fomit-frame-pointer

-mtune=k8 -march=k8 -c time.c -o time.o

time.c: In function 'getrusage_backwards_p':

time.c:664:18: error: storage size of 'start' isn't known

time.c:664:25: error: storage size of 'prev' isn't known

time.c:664:31: error: storage size of 'next' isn't known

time.c: In function 'cgt_works_p':

time.c:773:23: error: storage size of 'start' isn't known

time.c:773:30: error: storage size of 'end' isn't known

make[1]: *** [time.lo] Error 1

make[1]: Leaving directory `/s/gnu/lib/gmp/5.1.devel/tune'

make: *** [tune] Error 2

 

I don't sure but it seems for me that these are simply typos. Looking at
macros, I suppose these lines should be:

664:

struct_rusage  start, prev, next;

and 773:

struct_timespec start, end;

 

I've made these corrections in source and successfully compiled tuneup.

 

3. Tuneup crashes with the following output:

 

Parameters for ./mpn/x86/k8/gmp-mparam.h

Системе не удается найти указанный путь.

Системе не удается найти указанный путь.

Системе не удается найти указанный путь.

Using: CPU cycle counter

speed_precision 10000, speed_unittime 1 cycle, CPU freq unknown

DEFAULT_MAX_SIZE 1000, fft_max_size 50000

 

/* Generated by tuneup.c, 2013-06-07, gcc 4.7 */

 

#define MOD_1_NORM_THRESHOLD                 0  /* always */

#define MOD_1_UNNORM_THRESHOLD               0  /* always */

#define MOD_1N_TO_MOD_1_1_THRESHOLD          2

#define MOD_1U_TO_MOD_1_1_THRESHOLD          4

#define MOD_1_1_TO_MOD_1_2_THRESHOLD        45

#define MOD_1_2_TO_MOD_1_4_THRESHOLD     MP_SIZE_T_MAX

#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     47

#define USE_PREINV_DIVREM_1                  1  /* native */

#define DIV_QR_2_PI2_THRESHOLD           MP_SIZE_T_MAX  /* never */

#define DIVEXACT_1_THRESHOLD                 0  /* always (native) */

#define BMOD_1_TO_MOD_1_THRESHOLD        MP_SIZE_T_MAX  /* never */

 

#define MUL_TOOM22_THRESHOLD                30

#define MUL_TOOM33_THRESHOLD                56

#define MUL_TOOM44_THRESHOLD                63

#define MUL_TOOM6H_THRESHOLD               226

#define MUL_TOOM8H_THRESHOLD               296

 

#define MUL_TOOM32_TO_TOOM43_THRESHOLD      81

#define MUL_TOOM32_TO_TOOM53_THRESHOLD      75

#define MUL_TOOM42_TO_TOOM53_THRESHOLD      81

#define MUL_TOOM42_TO_TOOM63_THRESHOLD      92

#define MUL_TOOM43_TO_TOOM54_THRESHOLD     121

 

#define SQR_BASECASE_THRESHOLD               0  /* always (native) */

#define SQR_TOOM2_THRESHOLD                 50

#define SQR_TOOM3_THRESHOLD                 84

#define SQR_TOOM4_THRESHOLD                202

#define SQR_TOOM6_THRESHOLD                309

#define SQR_TOOM8_THRESHOLD                406

 

#define MULMID_TOOM42_THRESHOLD             74

 

#define MULMOD_BNM1_THRESHOLD               19

#define SQRMOD_BNM1_THRESHOLD               21

 

#define MUL_FFT_MODF_THRESHOLD             492  /* k = 5 */

#define MUL_FFT_TABLE3                                      \

  { {    492, 5}, {    104, 8}../mpn/generic/mul_fft.c:459: GNU MP assertion
failed: nprime2 < n

 

This application has requested the Runtime to terminate it in an unusual
way.

Please contact the application's support team for more information.

make: *** [tune] Error 3

 

1) Actual path is ../mpn/x86/k8/gmp-mparam.h.

2) Tuneup crashed and was terminated by Windows.

 

 

4. At the last, I can't build tuneup against shared libraries (MinGW doesn't
allow to build shared and static libraries at the same time). I think that
it should be noted somewhere in documentation.

 

 

I hope I've done everything well, and my report will be useful.

 

 

Best regards,

Basil Peace



More information about the gmp-bugs mailing list