Solved by ptrblck in post #2 
              
              
                As described in the tutorial, the next step after writing the extension is to write a custom CUDA kernel and reduce the kernel launch overheads: 

A definite method of speeding things up is therefore to rewrite parts in C++ (or CUDA) and  fuse  particular groups of operations. Fusing means combining…