DLAMCH routine needs no optimization

Open forum for general discussions relating to PLASMA.

DLAMCH routine needs no optimization

Postby edouard » Wed Oct 14, 2009 9:27 am

When testing the PLASMA-2.0.0 package for the first time (Linux + GCC-4.4.1),
I just updated the variables in the make.inc file.

Examples works fine without optimization (with 2 cores because my machine
is a INTEL Dual Core 2), but there is a problem when the library is compiled with
optimization (-On, whatever the value of n, greater than 1): all programs
never terminate ! Actually, they enter an infinite loop, and a debugger showed
that it is inside the 'core_lapack/dlamch.f' file.
These files contain some routines which are used to detect the floating-point
characteristics of the machine, and it is well known that they must be compiled
WITHOUT optimization.
For example, in the legacy LAPACK-3.2.1, the 'make.inc' configuration file
makes the difference between OPTS and NOOPT variable, and in the INSTALL
directory, the files 'dlamch.f' and 'slamch.f' are compiled using the NOOPT
variable.

So, a work around for this bug (in the build process) is to define another
variable in the make.inc file:

FNOOPTS = <whatever except optimization flag> <-O0 is also possible>

and to add the following lines:

# WARNING: 'slamch.f' and 'dlamch.f' must be compiled WITHOUT optimisation
slamch.o : slamch.f
$(FC) $(FNOOPTS) -c $< -o $@

dlamch.o : dlamch.f
$(FC) $(FNOOPTS) -c $< -o $@

at the end of 'plasma_2.0.0/core_lapack/Makefile'

Hope it will be useful.
Regards,
Edouard
edouard
 
Posts: 3
Joined: Wed Oct 14, 2009 6:41 am

Re: DLAMCH routine needs no optimization

Postby luszczek » Wed Oct 14, 2009 10:51 am

Edouard,

slamch.f and dlamch.f should be replaced by the end user to fit their
hardware. These functions are meant to return constants and are only
provided as an example. Any modern Fortran implementation has these
constants available in the IEEE module.

I'm glad you found a solution and I hope it matches your floating-point hardware.

Piotr
luszczek
 
Posts: 15
Joined: Tue Jul 14, 2009 2:10 pm

Re: DLAMCH routine needs no optimization

Postby edouard » Wed Oct 14, 2009 11:14 am

luszczek wrote:Edouard,

slamch.f and dlamch.f should be replaced by the end user to fit their
hardware. These functions are meant to return constants and are only
provided as an example. Any modern Fortran implementation has these
constants available in the IEEE module.

I'm glad you found a solution and I hope it matches your floating-point hardware.

Piotr


Apparently, only a FORTRAN 77 compiler is required to compile PLASMA,
as we can see if we inspect the source file ! Nothing is written in the
documentation... e.g. small examples included in the User Guide use
the F90-style comment ("!") but they use the old F77 syntax:
INTEGER N
PARAMETER (N = 10)
should writes now:
integer, parameter :: N = 10

So, I deduced that a FORTRAN 77 is sufficient to compile PLASMA.

Therefore, the old 'dlamch.f' and 'slamch.f' files are required to
compute the machine FP parameters...

Moreover, some FP parameters can be obtained with the new intrinsic
functions of Fortran 90 (tiny, huge, ...), but not all.
The IEEE intrinsic module will be available only with full compliant
F2003 standard and today, IMHO, only one compiler verify that,
i.e. the XLF 12 Fortran compiler of IBM.

Regards,
Édouard
edouard
 
Posts: 3
Joined: Wed Oct 14, 2009 6:41 am

Re: DLAMCH routine needs no optimization

Postby luszczek » Wed Oct 14, 2009 11:37 am

Édouard,

I think you're giving us a bit too much credit. I strongly doubt
that we kept our Fortran code digestible for FORTRAN 77 compiler.
I believe we're getting a free ride because modern Fortran
compilers are very permissive.

But back to the point. Fotran 90 has the following intrinsic functions:
digits, epsilon, huge, maxexponent, minexponent, radix, tiny.

A few years ago I used it to implement SLAMCH and DLAMCH.
I think the time has come and we might put them in PLASMA now.

Greetings to the fellow Fortran programmer :lol:

Piotr
luszczek
 
Posts: 15
Joined: Tue Jul 14, 2009 2:10 pm

Re: DLAMCH routine needs no optimization

Postby edouard » Wed Oct 14, 2009 1:47 pm

Thanks. It's also my point of vue.

Ed.
edouard
 
Posts: 3
Joined: Wed Oct 14, 2009 6:41 am


Return to User discussion

Who is online

Users browsing this forum: jianqayn and 1 guest

cron