Skip to content

cmaureir/snipmate-snippets-cuda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Snipmate.vim for CUDA files

Author: Cristián Maureira - [email protected]

This plugins aims to provide some snippets for writing CUDA files.

The current content is:

CUDA functions:

  • __syncthreads() (sync),
  • cudathreadsynchronize() (thsync),
  • cudaEventCreate() (eventc),
  • cudaEventRecord() (eventr),
  • cudaEventSynchronize() (events),
  • cudaEventElapsedTime() (evente),
  • cudaEventDestroy() (eventd),
  • cudaMalloc() (malloc),
  • cudaFree() (free),
  • cudaMemCpy() (memcpy),
  • cudaMemCpy(HostToDevice) (memcpyhd),
  • cudaMemCpy(DeviceToHost) (memcpydt),

CUDA structures:

  • __global__ (global),
  • __device__ (device),
  • kernel <<< ... >>> () (kernel),

CUDA data types:

  • cudaEvent_t (eventt),

CUDA words:

  • cudaMemCpyHostToDevice (htod),
  • cudaMemCpyDeviceToHost (dtoh),

CUDA code lines:

  • threadidx.x + blockdim.x * blockidx.x (id)

The last CUDA code line is used in almost all CUDA programs.

Syntax highlight

I found a CUDA syntax file in the Nvidia Forums, but it contains also all the content of a C syntax file, so I remove it, and I added a sentence to import the computer C syntax file, to have a simplest file.

Additionally, I added some extra syntax highlight parameters, to give support to some CUDA functions and special keywords.

Dependencies

How to install

You need to clone this repository to your ~.vim/bundle/ directory, if your use the Pathogen plugin, if not, just clone the repo and move the cu.snippets to your snippets directory.

Due CUDA files are not widely recognized, you need to add the following line to your ~.vimrc file:

au BufNewFile,BufRead *.cu set ft=cuda

About

CUDA snippets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published