extern __shared__ int buf[]; //when you launch the kernel you should launch it this way; kernel<<<blocks,threads,numbytes_for_shared>>>(...);