Project

General

Profile

Bug #233

Incorrect C code produced by mknb in single-precision when configure included --enable-ppc-sqrt

Added by Mark Abraham about 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Erik Lindahl
Category:
mdrun
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

On an IBM PowerPC architecture, when using configure line

./configure --enable-ppc-sqrt

the combination of single-precision and --enable-ppc-sqrt means that line 47 of src/gmxlib/nonbonded/nb_kernel/mknb_innerloop.c outputs C code such as

__frsqrte(double(rsq11))

This should be

__frsqrte((double)rsq11)

and so line 47 of mknb_innerloop.c should read

mknb_assign (rinv,"__frsqrte((double)%s)",rsq);

The conversion to and from double-precision probably makes the use of a non-vectorized intrinsic reciprocal square root a net loser. I'd suggest a warning in configure that the combination of single-precision and --enable-ppc-sqrt could be ineffective and the user should compare performance with (--enable-double and --enable-ppc-sqrt) or (--enable-float and --disable-ppc-sqrt).

History

#1 Updated by Mark Abraham about 11 years ago

The same problem arises in include/vec.h on line 194 as

lu = __frsqrte(double(x));

which should read

lu = __frsqrte((double)x);

#2 Updated by Erik Lindahl about 11 years ago

I've changed it to use the single-precision frsqrtes() instead. The drawback is that this call is only available on power5 or later CPUs, but it is more important to get good speedup on modern processors rather than a tiny amount (or worse, slowdown) on old ones.

#3 Updated by Mark Abraham almost 11 years ago

The problem in comment #1 is still there, viz

"The same problem arises in include/vec.h on line 194 as

lu = __frsqrte(double(x));

which should read

lu = __frsqrte((double)x);"

#4 Updated by Erik Lindahl almost 11 years ago

My bad - fixed now.

Warning Mark: We've just set up a new server to make it easier to give trustable people repository write access, and with all your reports you're very close to the top of that list ;-)

Also available in: Atom PDF