Vim Tips Wiki
Register
No edit summary
 
m (Added to LanguageSpecific + Syntax Categories ; code reformatted.)
Line 11: Line 11:
 
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. 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.
   
 
Dave Turner
   
  +
<pre>
 
Dave Turner
 
 
 
 
 
syn match cCommunicator "MPI_[A-Z][A-Z_a-z2 ]*("me=e-1
 
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 "MPIO_[A-Z][A-Z_a-z ]*("me=e-1
 
 
syn match cCommunicator "pvm_[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 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_Group MPI_Status MPI_Request MPI_Win MPI_Aint
 
 
syn keyword cType MPI_Info MPI_Op MPI_Datatype MPI_Comm
 
syn keyword cType MPI_Info MPI_Op MPI_Datatype MPI_Comm
   
 
HiLink cCommunicator Communicator
 
  +
</pre>
 
HiLink cCommunicator Communicator
 
 
 
   
 
Example addition to the colorization file for dark backgrounds:
 
Example addition to the colorization file for dark backgrounds:
  +
<pre>
 
 
hi Communicator guibg=yellow2 guifg=black gui=bold ctermbg=yellow ctermfg=black
 
  +
</pre>
 
hi Communicator guibg=yellow2 guifg=black gui=bold ctermbg=yellow ctermfg=black
 
 
 
   
 
Example addition to the colorization file for light backgrounds:
 
Example addition to the colorization file for light backgrounds:
  +
<pre>
 
 
 
 
hi Communicator guibg=yellow2 guifg=white gui=bold ctermbg=yellow ctermfg=white
 
hi Communicator guibg=yellow2 guifg=white gui=bold ctermbg=yellow ctermfg=white
  +
</pre>
 
   
 
}}
 
}}
Line 64: Line 47:
 
----
 
----
 
<!-- parsed by vimtips.py in 0.459900 seconds-->
 
<!-- parsed by vimtips.py in 0.459900 seconds-->
  +
  +
[[Category:LanguageSpecific]]
  +
[[Category:Syntax]]

Revision as of 12:01, 7 September 2007

Previous TipNext Tip

Tip: #941 - Adding MPI and PVM syntax highlighting

Created: June 2, 2005 17:03 Complexity: basic Author: Dave Turner Version: 6.0 Karma: 7/6 Imported from: Tip#941

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.

Dave Turner

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 put first part in syntax/fortran.vim but I am not sure about where to put the second part (guibg...)

Can you explain please ?

jgpiccinali--AT--free.fr , July 10, 2006 8:41