float vs double
Matthias Kretz
[please enable javascript to see the address]
Tue Aug 21 08:24:37 CEST 2012
On Monday 20 August 2012 22:42:57 Kulakov, Igor wrote:
> From time to time we want to check our single precision algorithms in double
> precision. This is interesting from both precision point of view and time
> (scalability) point of view.
>
> I think It would be nice (at least for us) if Vc provide easy way to do
> this.
>
> What do you think?
Ah, you mean because of the Vector::Size? There are many possible ways to do
this, and it very much depends on the problem which way is best for a fair
comparison...
I'd rather not have a flag to redefine the meaning of float_v. I'm more
thinking of a new type that will always have a size of max(float_v::Size,
double_v::Size) and be implemented with different precisions depending on some
flag.
Or even more flexible: provide a template class like this:
template<typename MemoryEntryType, typename OperationEntryType, int Size>
class CustomVector
Then you could do this:
#ifdef USE_REAL_16_64
typedef Vc::CustomVector<float16, double, float_v::Size> real_v;
#elif defined(USE_REAL_32_64)
typedef Vc::CustomVector<float, double, float_v::Size> real_v;
#elif defined(USE_REAL_64)
typedef Vc::CustomVector<double, double, float_v::Size> real_v;
#elif defined(USE_REAL_16_32)
typedef Vc::CustomVector<float16, float, float_v::Size> real_v;
#else
typedef Vc::float_v real_v;
#endif
typedef real_v::EntryType real_t;
typedef real_v::Mask real_m;
That would require quite a bit of work in Vc, but would certainly be
interesting for benchmarking.
I can't promise to work on this anytime soon, though. This could be a nice
task for somebody to get into Vc hacking, though. :)
Cheers,
Matthias
--
Dipl.-Phys. Matthias Kretz
http://compeng.uni-frankfurt.de/?mkretz
SIMD easy and portable: http://compeng.uni-frankfurt.de/?vc
More information about the Vc-devel
mailing list