1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
#ifndef HPC_ULMBLAS_BLOCKSIZE_H
#define HPC_ULMBLAS_BLOCKSIZE_H 1

#include <complex>
#include <hpc/ulmblas/config.h>

namespace hpc { namespace ulmblas {

template <typename T>
struct BlockSize
{
    static const int MC = DEFAULT_BLOCKSIZE_MC;
    static const int KC = DEFAULT_BLOCKSIZE_KC;
    static const int NC = DEFAULT_BLOCKSIZE_NC;
    static const int MR = DEFAULT_BLOCKSIZE_MR;
    static const int NR = DEFAULT_BLOCKSIZE_NR;


    static_assert(MC>0 && KC>0 && NC>0 && MR>0 && NR>0, "Invalid block size.");
    static_assert(MC % MR == 0, "MC must be a multiple of MR.");
    static_assert(NC % NR == 0, "NC must be a multiple of NR.");
};

template <>
struct BlockSize<float>
{
    static const int MC = S_BLOCKSIZE_MC;
    static const int KC = S_BLOCKSIZE_KC;
    static const int NC = S_BLOCKSIZE_NC;
    static const int MR = S_BLOCKSIZE_MR;
    static const int NR = S_BLOCKSIZE_NR;

    static_assert(MC>0 && KC>0 && NC>0 && MR>0 && NR>0, "Invalid block size.");
    static_assert(MC % MR == 0, "MC must be a multiple of MR.");
    static_assert(NC % NR == 0, "NC must be a multiple of NR.");
};

template <>
struct BlockSize<double>
{
    static const int MC = D_BLOCKSIZE_MC;
    static const int KC = D_BLOCKSIZE_KC;
    static const int NC = D_BLOCKSIZE_NC;
    static const int MR = D_BLOCKSIZE_MR;
    static const int NR = D_BLOCKSIZE_NR;

    static_assert(MC>0 && KC>0 && NC>0 && MR>0 && NR>0, "Invalid block size.");
    static_assert(MC % MR == 0, "MC must be a multiple of MR.");
    static_assert(NC % NR == 0, "NC must be a multiple of NR.");
};

template <>
struct BlockSize<std::complex<float> >
{
    static const int MC = C_BLOCKSIZE_MC;
    static const int KC = C_BLOCKSIZE_KC;
    static const int NC = C_BLOCKSIZE_NC;
    static const int MR = C_BLOCKSIZE_MR;
    static const int NR = C_BLOCKSIZE_NR;

    static_assert(MC>0 && KC>0 && NC>0 && MR>0 && NR>0, "Invalid block size.");
    static_assert(MC % MR == 0, "MC must be a multiple of MR.");
    static_assert(NC % NR == 0, "NC must be a multiple of NR.");
};

template <>
struct BlockSize<std::complex<double> >
{
    static const int MC = Z_BLOCKSIZE_MC;
    static const int KC = Z_BLOCKSIZE_KC;
    static const int NC = Z_BLOCKSIZE_NC;
    static const int MR = Z_BLOCKSIZE_MR;
    static const int NR = Z_BLOCKSIZE_NR;

    static_assert(MC>0 && KC>0 && NC>0 && MR>0 && NR>0, "Invalid block size.");
    static_assert(MC % MR == 0, "MC must be a multiple of MR.");
    static_assert(NC % NR == 0, "NC must be a multiple of NR.");
};

} } // namespace ulmblas, hpc

#endif // HPC_ULMBLAS_BLOCKSIZE_H