Re: Any libraries for vector mask and vector population count?



Dan wrote:

Thank you very, very much. *** asked me to me clearer on what the
problem is. I have the legacy code (posted earlier) that uses vector
mask (VM) and vector popcount (PS) to compare two 2-bit encoded
strings. The code posted assumes 64 bit vector registers and 2-bit
encoded DNA sequences (00=A, 01=B, 10=C, 11=D). The international
standard for DNA codes has expanded from 4 to 16(*), so the new
version I have to produce must operate on DNA sequences encoded into 4
bits.

Yes, including the ambiguity codes for all 2**4 combinations
including or excluding each base. Usually, you won't do a
direct comparison of ambiguity codes, though. But you probably
know that.

Both vector merge and population count can be written in reasonably
standard Fortran. (There are complications due to signed arithmetic,
but they most likely won't cause a problem on real machines.)
The MERGE intrinsic might be slightly faster, but maybe not
a lot faster. Population count without hardware support
also might be only slightly faster with an intrinsic, if
one existed.

The Fortran 2003 C interoperability facility is supported reasonably
well by some current compilers.

As someone mentioned but didn't give the details, there is a fairly
fast way to do vector population count using logical operators
and shift operators, which should work well with Fortran intrinsic
functions. The fastest form for vectors likely depends how fast
memory (hopefully cached) cycles are.

-- glen

.


Loading