0

Compiler error that I cannot figure out. My function call seems to match the argument list.

nvcc -o main main.cu

error:  no instance of function template "gemm_template_batched_nn_kernel" matches the argument list argument types are (int, int, int, double **, int, double **, int, double **, int, double, double)

gemm.h

template <typename T, const int DIM_X, const int DIM_Y,
         const int BLK_M, const int BLK_N, const int BLK_K, 
         const int DIM_XA, const int DIM_YA, const int DIM_XB, const int DIM_YB, 
         const int CONJA, const int CONJB>
static __global__
void gemm_template_batched_nn_kernel(
    int M, int N, int K,
    T const * const * Aarray, int LDA,
    T const * const * Barray, int LDB,
    T**       Carray, int LDC,
    T alpha, T beta)
{
    const int batchid = blockIdx.z;

    gemm_template_device_nn
        <T, DIM_X, DIM_Y, BLK_M, BLK_N, BLK_K, DIM_XA, DIM_YA, DIM_XB, DIM_YB, (BLK_M/DIM_X), (BLK_N/DIM_Y), CONJA, CONJB>
        ( M, N, K, 
          Aarray[batchid], LDA, 
          Barray[batchid], LDB, 
          Carray[batchid], LDC, 
          alpha, beta );
}

main.cu

#include "gemm.h"
#define N 256
#define BLK_M 16
#define DIM_X 16
#define DIM_Y 16

int main() {
    double *Ad, *Bd, *Cd;
    dim3 dimGrid(N/BLK_M, N/BLK_M);
    dim3 dimBlock(DIM_X, DIM_Y);
    ...
    gemm_template_batched_nn_kernel<double><<<dimGrid,dimBlock>>>(N,N,N,&Ad,N,&Bd,N,&Cd,N,1.0,1.0);
    ...
}
einpoklum
  • 118,144
  • 57
  • 340
  • 684
Whitebeard
  • 5,945
  • 5
  • 24
  • 31

1 Answers1

1

My comment seems to have worked, so making it an answer...

Your template has twelve template parameters, with no defaults; and you're trying to instantiate it with just one (<double>). Either specify all of them, or specify none.

Other notes:

  • Having this many parameters is not a good idea, consider putting them into some struct, or using spans.
  • Array-of-pointers in CUDA? Probably a bad idea
  • As the CUDA programming guide suggests, you should probably be using __restrict__ for your pointer parameters.
einpoklum
  • 118,144
  • 57
  • 340
  • 684