Vim Tips Wiki
Register
No edit summary
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=941
 
|id=941
  +
|previous=939
|title=Adding MPI and PVM syntax highlighting
 
  +
|next=944
|created=June 2, 2005 17:03
+
|created=June 2, 2005
 
|complexity=basic
 
|complexity=basic
 
|author=Dave Turner
 
|author=Dave Turner
 
|version=6.0
 
|version=6.0
 
|rating=7/6
 
|rating=7/6
  +
|category1=LanguageSpecific
|text=
 
  +
|category2=Syntax
The MPI standard and the PVM library are commonly used to parallelize codes to run them across multiprocessor systems. The lines below can be added to the c.vim syntax file to highlight all MPI and PVM function calls, as well as the MPI data types. The Fortran syntax is the same except that PVM uses the pvmf prefix instead of pvm_. You will also need to add a line to your favorite colorization file to highlight the new Communicator group. I use a Yellow background which shows up well on both light and dark backgrounds to really illustrate where the communications calls are in a program. If the powers that be ever wish to include these capabilities in the official VIM release, I'd be happy to add OpenMP functions as well.
 
 
}}
 
The MPI standard and the PVM library are commonly used to parallelize codes to run them across multiprocessor systems. The lines below can be added to the c.vim syntax file to highlight all MPI and PVM function calls, as well as the MPI data types. The Fortran syntax is the same except that PVM uses the pvmf prefix instead of pvm_. You will also need to add a line to your favorite colorization file to highlight the new Communicator group. I use a Yellow background which shows up well on both light and dark backgrounds to really illustrate where the communications calls are in a program.
   
  +
<pre>
 
syn match cCommunicator "MPI_[A-Z][A-Z_a-z2 ]*("me=e-1
 
syn match cCommunicator "MPIO_[A-Z][A-Z_a-z ]*("me=e-1
 
syn match cCommunicator "pvm_[a-z ]*("me=e-1
 
syn match cCommunicator "MP_[A-Z_a-z ]*("me=e-1
   
 
syn keyword cType MPI_Group MPI_Status MPI_Request MPI_Win MPI_Aint
 
syn keyword cType MPI_Info MPI_Op MPI_Datatype MPI_Comm
   
 
HiLink cCommunicator Communicator
Dave Turner
 
  +
</pre>
 
 
 
syn match cCommunicator "MPI_[A-Z][A-Z_a-z2 ]*("me=e-1
 
 
syn match cCommunicator "MPIO_[A-Z][A-Z_a-z ]*("me=e-1
 
 
syn match cCommunicator "pvm_[a-z ]*("me=e-1
 
 
syn match cCommunicator "MP_[A-Z_a-z ]*("me=e-1
 
 
 
 
syn keyword cType MPI_Group MPI_Status MPI_Request MPI_Win MPI_Aint
 
 
syn keyword cType MPI_Info MPI_Op MPI_Datatype MPI_Comm
 
 
 
 
HiLink cCommunicator Communicator
 
 
 
 
Example addition to the colorization file for dark backgrounds:
 
 
 
 
hi Communicator guibg=yellow2 guifg=black gui=bold ctermbg=yellow ctermfg=black
 
 
 
 
Example addition to the colorization file for light backgrounds:
 
 
 
 
hi Communicator guibg=yellow2 guifg=white gui=bold ctermbg=yellow ctermfg=white
 
 
 
}}
 
 
== Comments ==
 
   
 
Example addition to the colorization file for dark backgrounds:
I put first part in syntax/fortran.vim but I am not sure about where to put the second part (guibg...)
 
  +
<pre>
 
hi Communicator guibg=yellow2 guifg=black gui=bold ctermbg=yellow ctermfg=black
  +
</pre>
   
 
Example addition to the colorization file for light backgrounds:
Can you explain please ?
 
  +
<pre>
 
hi Communicator guibg=yellow2 guifg=white gui=bold ctermbg=yellow ctermfg=white
  +
</pre>
   
 
==Comments==
jgpiccinali--AT--free.fr
 
  +
I think the idea is great (I had just implemented my own syntax file to do the same), but part of the reason I want syntax highlighting is to catch typos, so if anything starting with MPI is highlighed, the mispelled ones will be highlighed also. It's not so bad to enumerate all 20 or so of the most common ones. I've enumerated a bunch of them here:
, July 10, 2006 8:41
 
  +
http://www.acm.caltech.edu/~srbecker/code/c.vim . -Stephen
----
 
<!-- parsed by vimtips.py in 0.459900 seconds-->
 

Latest revision as of 21:46, 6 February 2010

Tip 941 Printable Monobook Previous Next

created June 2, 2005 · complexity basic · author Dave Turner · version 6.0


The MPI standard and the PVM library are commonly used to parallelize codes to run them across multiprocessor systems. The lines below can be added to the c.vim syntax file to highlight all MPI and PVM function calls, as well as the MPI data types. The Fortran syntax is the same except that PVM uses the pvmf prefix instead of pvm_. You will also need to add a line to your favorite colorization file to highlight the new Communicator group. I use a Yellow background which shows up well on both light and dark backgrounds to really illustrate where the communications calls are in a program.

syn match cCommunicator "MPI_[A-Z][A-Z_a-z2 ]*("me=e-1
syn match cCommunicator "MPIO_[A-Z][A-Z_a-z ]*("me=e-1
syn match cCommunicator "pvm_[a-z ]*("me=e-1
syn match cCommunicator "MP_[A-Z_a-z ]*("me=e-1

syn keyword cType MPI_Group MPI_Status MPI_Request MPI_Win MPI_Aint
syn keyword cType MPI_Info MPI_Op MPI_Datatype MPI_Comm

HiLink cCommunicator Communicator

Example addition to the colorization file for dark backgrounds:

hi Communicator guibg=yellow2 guifg=black gui=bold ctermbg=yellow ctermfg=black

Example addition to the colorization file for light backgrounds:

 hi Communicator guibg=yellow2 guifg=white gui=bold ctermbg=yellow ctermfg=white

Comments[]

I think the idea is great (I had just implemented my own syntax file to do the same), but part of the reason I want syntax highlighting is to catch typos, so if anything starting with MPI is highlighed, the mispelled ones will be highlighed also. It's not so bad to enumerate all 20 or so of the most common ones. I've enumerated a bunch of them here: http://www.acm.caltech.edu/~srbecker/code/c.vim . -Stephen