snipmate-snippets-cuda


Ⅰ. 插件描述

CUDA snippets

Ⅱ. 基本信息

创建日期:  2011-12-02
使用用户:  3
Github星:  9
插件作者:  Cristián Maureira-Fredes

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'cmaureir/snipmate-snippets-cuda'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'cmaureir/snipmate-snippets-cuda'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'cmaureir/snipmate-snippets-cuda'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/cmaureir/snipmate-snippets-cuda

Ⅳ. 文档说明

Snipmate.vim for CUDA files

Author: Cristián Maureira - cmaureirafredes@gmail.com

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

  • Vim
  • Snipmate_.

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

.. _Pathogen: https://github.com/tpope/vim-pathogen
.. _Snipmate: https://github.com/garbas/vim-snipmate
.. _Nvidia Forums: http://forums.nvidia.com/index.php?showtopic=43774

添加新评论