# Template in culaunchkernel or cudalaunchkernel

**URL:** <https://forums.developer.nvidia.com/t/template-in-culaunchkernel-or-cudalaunchkernel/209510>\
**Category:** CUDA NVCC Compiler\
**Tags:** driver\
**Created:** [March 28, 2022, 1:38am UTC](https://forums.developer.nvidia.com/t/template-in-culaunchkernel-or-cudalaunchkernel/209510 "2022-03-28T01:38:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user102782](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@user102782](https://forums.developer.nvidia.com/u/user102782)\
**Post date:** [March 28, 2022, 1:38am UTC](https://forums.developer.nvidia.com/t/template-in-culaunchkernel-or-cudalaunchkernel/209510/1 "2022-03-28T01:38:20Z")

</div>

Hi:

I was wondering how can I call a template kernel function using driver api ?  
for example:

> \<template typename T, typename BLK1, typename BLK2, typename BLK3\>  
> \ __gloabal\__ void add(T a, intN){  
> …  
> if (BLk1==32)…  
> if (BLk2==32)…  
> if (BLk3==32)…
> 
> }

this kernel can be launched by

> cuLaunchKernel(cufunc, griddim, blockdim,args, sharedMem, Stream)

but how can I pass the template blk1 to 3 to this kernel function? I know it can be called by sth like

> add\<float, 32,64,32\>\<\<\<griddim, blockdim \>\>\>(A, N)

, but I have too may kernels and I wantted to use culaunchkernel or cudalaunchkernel, how can I do that ?

Shawn
